| 110 | // ==================== 核心接口 ==================== |
| 111 | |
| 112 | export interface ImportAdapter { |
| 113 | /** |
| 114 | * 导入文件。Electron 接受 File 或文件路径,Web 只接受 File。 |
| 115 | */ |
| 116 | importFile( |
| 117 | file: File | string, |
| 118 | options?: ImportOptions, |
| 119 | onProgress?: (p: ImportProgress) => void |
| 120 | ): Promise<ImportResult> |
| 121 | |
| 122 | /** 检测文件格式 */ |
| 123 | detectFormat(file: File | string): Promise<FormatInfo | null> |
| 124 | |
| 125 | /** 扫描包含多个聊天的文件 */ |
| 126 | scanMultiChatFile(file: File | string): Promise<MultiChatEntry[]> |
| 127 | |
| 128 | /** 注册 ZIP 导入源。Web 上传一次,Electron 记录本地路径。 */ |
| 129 | prepareImportSource(file: File | string): Promise<PreparedImportSourceResult> |
| 130 | |
| 131 | /** 从已注册导入源中导入一个聊天。 */ |
| 132 | importPreparedChat(sourceId: string, chatId: string, onProgress?: (p: ImportProgress) => void): Promise<ImportResult> |
| 133 | |
| 134 | /** 释放导入源及其临时文件;重复调用应保持幂等。 */ |
| 135 | releaseImportSource(sourceId: string): Promise<void> |
| 136 | |
| 137 | /** 获取支持的导入格式列表 */ |
| 138 | getSupportedFormats(): Promise<FormatInfo[]> |
| 139 | |
| 140 | /** 导入 Demo 数据 */ |
| 141 | importDemo(locale: string, onProgress?: (p: DemoProgress) => void): Promise<DemoImportResult> |
| 142 | |
| 143 | /** 分析增量导入(预览去重后可新增多少消息) */ |
| 144 | analyzeIncrementalImport(sessionId: string, file: File | string): Promise<IncrementalAnalysis> |
| 145 | |
| 146 | /** 执行增量导入 */ |
| 147 | incrementalImport( |
| 148 | sessionId: string, |
| 149 | file: File | string, |
| 150 | onProgress?: (p: ImportProgress) => void |
| 151 | ): Promise<IncrementalImportResult> |
| 152 | |
| 153 | /** 导入目录(多文件格式如 chunked-jsonl)。Electron 传目录路径,Web 传 File[](含 webkitRelativePath) */ |
| 154 | importDirectory( |
| 155 | source: File[] | string, |
| 156 | options?: ImportOptions, |
| 157 | onProgress?: (p: ImportProgress) => void |
| 158 | ): Promise<ImportResult> |
| 159 | } |
| 160 | |
| 161 | export type { ImportProgress } |
no outgoing calls
no test coverage detected