MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / importFile

Function importFile

src/stores/session.ts:184–203  ·  view source on GitHub ↗

* 选择文件并导入

()

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

usePlatformServiceFunction · 0.90
importFileFromPathFunction · 0.85
showOpenDialogMethod · 0.65

Tested by

no test coverage detected