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

Method importPreparedChat

src/services/import/fetch.ts:117–132  ·  view source on GitHub ↗
(
    sourceId: string,
    chatId: string,
    onProgress?: (p: ImportProgress) => void
  )

Source from the content-addressed store, hash-verified

115 }
116
117 async importPreparedChat(
118 sourceId: string,
119 chatId: string,
120 onProgress?: (p: ImportProgress) => void
121 ): Promise<ImportResult> {
122 const res = await fetchWithAuth(`${getBaseUrl()}/import-sources/${encodeURIComponent(sourceId)}/import`, {
123 method: 'POST',
124 headers: { 'Content-Type': 'application/json' },
125 body: JSON.stringify({ chatId }),
126 })
127 if (!res.ok) {
128 const text = await res.text()
129 return { success: false, error: `HTTP ${res.status}: ${text}` }
130 }
131 return consumeSseStream<ImportResult>(res, { success: false, error: 'Unknown error' }, onProgress)
132 }
133
134 async releaseImportSource(sourceId: string): Promise<void> {
135 await fetchWithAuth(`${getBaseUrl()}/import-sources/${encodeURIComponent(sourceId)}`, {

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