(file: File | string)
| 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, |
nothing calls this directly
no test coverage detected