(data: unknown)
| 31 | * 自动检测格式并解析 |
| 32 | */ |
| 33 | export function parseImportFile(data: unknown): { |
| 34 | importer: ConversationImporter |
| 35 | conversations: ParsedConversation[] |
| 36 | } | null { |
| 37 | const importer = detectImporter(data) |
| 38 | if (!importer) return null |
| 39 | |
| 40 | try { |
| 41 | return { |
| 42 | importer, |
| 43 | conversations: importer.parse(data) |
| 44 | } |
| 45 | } catch { |
| 46 | return null |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * 获取支持的平台列表(用于 UI 显示) |
no test coverage detected