(
source: File[] | string,
_options?: ImportOptions,
onProgress?: (p: ImportProgress) => void
)
| 160 | } |
| 161 | |
| 162 | async importDirectory( |
| 163 | source: File[] | string, |
| 164 | _options?: ImportOptions, |
| 165 | onProgress?: (p: ImportProgress) => void |
| 166 | ): Promise<ImportResult> { |
| 167 | if (typeof source !== 'string') { |
| 168 | return { success: false, error: 'Expected directory path in Electron mode' } |
| 169 | } |
| 170 | |
| 171 | return new Promise((resolve) => { |
| 172 | const unlisten = window.chatApi.onImportProgress((progress: any) => { |
| 173 | onProgress?.({ |
| 174 | stage: progress.stage || 'parsing', |
| 175 | progress: progress.percentage || progress.progress || 0, |
| 176 | message: progress.message || '', |
| 177 | bytesRead: progress.bytesRead, |
| 178 | totalBytes: progress.totalBytes, |
| 179 | messagesProcessed: progress.messagesProcessed, |
| 180 | }) |
| 181 | }) |
| 182 | |
| 183 | window.chatApi |
| 184 | .importDirectory(source) |
| 185 | .then((result: any) => { |
| 186 | unlisten() |
| 187 | resolve({ |
| 188 | success: result.success, |
| 189 | sessionId: result.sessionId, |
| 190 | error: result.error, |
| 191 | diagnostics: result.diagnostics, |
| 192 | }) |
| 193 | }) |
| 194 | .catch((err: Error) => { |
| 195 | unlisten() |
| 196 | resolve({ success: false, error: err.message }) |
| 197 | }) |
| 198 | }) |
| 199 | } |
| 200 | } |
nothing calls this directly
no test coverage detected