feat(import): support unified directory import for Electron and Web

Add directory import support for multi-file formats (e.g. shuakami chunked-jsonl).
Users can select or drag-and-drop a directory via the "Import Folder" checkbox.

- Add `findEntryFileInDirectory()` to parser layer for format-agnostic entry file discovery
- Add `importDirectory` method to ImportAdapter interface
- Implement FetchImportAdapter.importDirectory with multi-file FormData upload
- Add `POST /_web/import-directory` CLI route with directory reconstruction
- Add `chat:importDirectory` IPC handler in Electron main process
- Enhance FileDropZone with `directory` prop and drag-and-drop directory support
- Refactor FetchImportAdapter to extract reusable `consumeSseStream` helper

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
diguaandCursor authored and digua committed 2026-05-22 10:20:39 +08:00
1 parent 8bb904fb22
commit 9421662a52
16 files changed
+462 -76

No files matched your search

+7
View File
@@ -60,6 +60,13 @@ export const chatApi = {
return ipcRenderer.invoke('chat:import', filePath)
},
/**
* Import from a directory path (scans for entry file)
*/
importDirectory: (dirPath: string): Promise<{ success: boolean; sessionId?: string; error?: string }> => {
return ipcRenderer.invoke('chat:importDirectory', dirPath)
},
/**
* 检测文件格式(轻量级)
*/