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

Method prepareImportSource

src/services/import/fetch.ts:102–115  ·  view source on GitHub ↗
(file: File | string)

Source from the content-addressed store, hash-verified

100 }
101
102 async prepareImportSource(file: File | string): Promise<PreparedImportSourceResult> {
103 if (typeof file === 'string') {
104 return { success: false, error: 'File path import is not supported in Web mode' }
105 }
106
107 const form = new FormData()
108 form.append('file', file)
109 const res = await fetchWithAuth(`${getBaseUrl()}/import-sources`, { method: 'POST', body: form })
110 const data = (await res.json().catch(() => null)) as PreparedImportSourceResult | null
111 if (!res.ok) {
112 return { success: false, error: data?.error || `HTTP ${res.status}` }
113 }
114 return data ?? { success: false, error: 'Invalid import source response' }
115 }
116
117 async importPreparedChat(
118 sourceId: string,

Callers

nothing calls this directly

Calls 2

fetchWithAuthFunction · 0.90
getBaseUrlFunction · 0.90

Tested by

no test coverage detected