* 选择文件并导入
()
| 182 | * 选择文件并导入 |
| 183 | */ |
| 184 | async function importFile(): Promise<{ |
| 185 | success: boolean |
| 186 | error?: string |
| 187 | }> { |
| 188 | try { |
| 189 | const dialogResult = await usePlatformService().showOpenDialog({ |
| 190 | properties: ['openFile'], |
| 191 | filters: [ |
| 192 | { name: 'Chat Files', extensions: ['json', 'jsonl', 'txt'] }, |
| 193 | { name: 'All Files', extensions: ['*'] }, |
| 194 | ], |
| 195 | }) |
| 196 | if (dialogResult.canceled || dialogResult.filePaths.length === 0) { |
| 197 | return { success: false, error: 'error.no_file_selected' } |
| 198 | } |
| 199 | return await importFileFromPath(dialogResult.filePaths[0]) |
| 200 | } catch (error) { |
| 201 | return { success: false, error: String(error) } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | /** 导入诊断信息类型 */ |
| 206 | interface ImportDiagnosticsInfo { |
nothing calls this directly
no test coverage detected