File Handling & Indexing
The platform supports ingesting various document types (PDF, DOCX, CSV, TXT) to serve as context for the AI.
Upload Flow
- User drops a file into the
ContextManagerPane. - The frontend validates the file size and type against constants defined in the app.
- The file is uploaded to the backend via a
multipart/form-datarequest. - The backend stores the file as a
BLOBin PostgreSQL.
Smart Indexing Polling
Because processing large PDFs or Docx files for AI embedding can take time, files have an indexStatus property:
PENDING: File metadata exists but indexing has not started yet.INDEXING: Currently being processed by the backend/Python service.READY: Ready to be used as context.FAILED: Processing failed.
Polling Mechanism
The frontend utilizes a smart conditional polling strategy via React Query (refetchInterval).
- It checks the list of files in the current project.
- If any file has
indexStatus === 'INDEXING', the hook polls the backend every 4 seconds. - Once all files are no longer
INDEXING, polling automatically suspends to preserve network resources.