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

Method indexDocuments

src/lib/api.ts:322–340  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

320 }
321
322 async indexDocuments(sessionId: string): Promise<{ message: string }> {
323 try {
324 const response = await fetch(`${API_BASE_URL}/sessions/${sessionId}/index`, {
325 method: 'POST',
326 headers: {
327 'Content-Type': 'application/json',
328 },
329 });
330
331 if (!response.ok) {
332 const errorData = await response.json().catch(() => ({ error: 'Indexing failed' }));
333 throw new Error(`Indexing error: ${errorData.error || response.statusText}`);
334 }
335 return await response.json();
336 } catch (error) {
337 console.error('Indexing failed:', error);
338 throw error;
339 }
340 }
341
342 // Legacy upload function - can be removed if no longer needed
343 async uploadPDFs(sessionId: string, files: File[]): Promise<{

Callers 1

handleIndexDocumentsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected