(sessionId: string)
| 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<{ |
no outgoing calls
no test coverage detected