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

Method incrementalImport

src/services/import/fetch.ts:214–241  ·  view source on GitHub ↗
(
    sessionId: string,
    file: File | string,
    onProgress?: (p: ImportProgress) => void
  )

Source from the content-addressed store, hash-verified

212 }
213
214 async incrementalImport(
215 sessionId: string,
216 file: File | string,
217 onProgress?: (p: ImportProgress) => void
218 ): Promise<IncrementalImportResult> {
219 if (typeof file === 'string') {
220 return { success: false, newMessageCount: 0, error: 'File path not supported in Web mode' }
221 }
222
223 const form = new FormData()
224 form.append('file', file)
225
226 const res = await fetchWithAuth(`${getBaseUrl()}/sessions/${sessionId}/import/incremental`, {
227 method: 'POST',
228 body: form,
229 })
230
231 if (!res.ok) {
232 const text = await res.text()
233 return { success: false, newMessageCount: 0, error: `HTTP ${res.status}: ${text}` }
234 }
235
236 return consumeSseStream<IncrementalImportResult>(
237 res,
238 { success: false, newMessageCount: 0, error: 'Unknown error' },
239 onProgress
240 )
241 }
242
243 async importDirectory(
244 source: File[] | string,

Callers

nothing calls this directly

Calls 4

fetchWithAuthFunction · 0.90
getBaseUrlFunction · 0.90
consumeSseStreamFunction · 0.85
textMethod · 0.80

Tested by

no test coverage detected