MCPcopy Create free account
hub / github.com/PromtEngineer/localGPT / uploadFilesToIndex

Method uploadFilesToIndex

src/lib/api.ts:453–462  ·  view source on GitHub ↗
(indexId: string, files: File[])

Source from the content-addressed store, hash-verified

451 }
452
453 async uploadFilesToIndex(indexId: string, files: File[]): Promise<{ message: string; uploaded_files: any[] }> {
454 const fd = new FormData();
455 files.forEach((f) => fd.append('files', f, f.name));
456 const resp = await fetch(`${API_BASE_URL}/indexes/${indexId}/upload`, { method: 'POST', body: fd });
457 if (!resp.ok) {
458 const err = await resp.json().catch(() => ({}));
459 throw new Error(`Upload to index error: ${err.error || resp.statusText}`);
460 }
461 return resp.json();
462 }
463
464 async buildIndex(indexId: string, opts: {
465 latechunk?: boolean;

Callers 1

handleSubmitFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected