Overview
When a user sends a message with file attachments in chat, the system processes them through multiple parallel paths:- File Upload and Storage — files are stored and made accessible
- RAG Retrieval — the user’s message (and images) search the knowledge base
- Knowledge Graph Enhancement — entity-based context enrichment
- LLM Invocation — the model receives the message, files, KB context, and graph context
Architecture
Step 1: File Upload and Storage
- Images: JPEG, PNG, WebP
- Documents: PDF
- Text: .txt, .md
- Audio: MP3, WAV
Step 2: Chat Request Processing
Step 3: RAG Retrieval (Parallel)
For each linked knowledge base, four parallel operations run:- Text Search
- Image Search
- KB Map
- Graph Search
Query Enhancement
The search query is enhanced with conversation context:Merge and Rerank
Results from all KBs are merged:- Hybrid scoring: 60% vector similarity + 25% text relevance + 15% importance weight
- Top 5 chunks returned with citations
Formatted Context
Step 4: LLM Invocation
Size limits:- Images: 2MB each (base64 data URL)
- PDFs: 2MB each (base64 file)
- Total multimodal content: 5MB
- Large files (>2MB): “[File too large: name (size)]“
Step 5: Response
File Type Processing Matrix
RAG search is driven by the user’s text message and image embeddings. PDF content is NOT extracted for search — the PDF is sent directly to the LLM. Only documents ingested into the Knowledge Base via the KB upload flow are searchable via RAG.

