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

Method createIndex

src/lib/api.ts:440–451  ·  view source on GitHub ↗
(name: string, description?: string, metadata: Record<string, unknown> = {})

Source from the content-addressed store, hash-verified

438 // ---------- Index endpoints ----------
439
440 async createIndex(name: string, description?: string, metadata: Record<string, unknown> = {}): Promise<{ index_id: string }> {
441 const resp = await fetch(`${API_BASE_URL}/indexes`, {
442 method: 'POST',
443 headers: { 'Content-Type': 'application/json' },
444 body: JSON.stringify({ name, description, metadata }),
445 });
446 if (!resp.ok) {
447 const err = await resp.json().catch(() => ({}));
448 throw new Error(`Create index error: ${err.error || resp.statusText}`);
449 }
450 return resp.json();
451 }
452
453 async uploadFilesToIndex(indexId: string, files: File[]): Promise<{ message: string; uploaded_files: any[] }> {
454 const fd = new FormData();

Callers 1

handleSubmitFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected