📄 Document Chat (RAG Feature)
Reading time: ~6 minutes
Chat with your documents! Upload PDFs, text files, and more, then ask questions about their content. The AI will find relevant information and provide accurate answers based on your documents.
What is Document Chat?
Document Chat lets you:
- Upload documents (PDF, TXT, DOCX, etc.)
- Ask questions about their content
- Get accurate answers with relevant context from your files
- Keep everything private - documents are processed locally
The system uses semantic search to find the most relevant parts of your documents and includes them in the AI's response.
Quick Start
1. Upload Documents
- Go to Settings (⚙️ icon)
- Click Upload Documents
- Select your files (PDF, TXT, DOCX supported)
- Wait for processing to complete
2. Start Chatting
- Go back to the main chat
- Ask questions about your documents
- The AI will automatically find and use relevant information
Example questions:
- "What are the main points in this report?"
- "Summarize the key findings"
- "What does it say about [specific topic]?"
Document Management
Viewing Your Documents
- In Settings, see all uploaded documents
- Check processing status (✅ Ready, ⏳ Processing, ❌ Error)
- View document details and chunk count
Document Processing Status
- Ready (✅): Document is processed and ready for chat
- Processing (⏳): Document is being broken into searchable chunks
- Error (❌): Something went wrong - try re-uploading
Removing Documents
- Click the trash icon (🗑️) next to any document
- Confirm removal when prompted
- Document will be immediately removed from chat context
Advanced Settings
Embedding Settings
Fine-tune how documents are processed and searched:
Embedding Model
- The AI model used to understand document content
- Default:
nomic-embed-text
(good balance of speed and quality) - Requires Ollama to be running locally
Chunk Size
- How much text is processed at once
- Default: 1000 characters
- Larger = more context, slower processing
- Smaller = faster processing, less context
Chunk Overlap
- How much text overlaps between chunks
- Default: 200 characters
- Prevents important information from being split
Similarity Threshold
- How closely related content must be to your question
- Default: 0.3 (lower = more results included)
- Higher values = more precise but fewer results
- Lower values = more results but potentially less relevant
Regenerating Embeddings
If you change embedding settings:
- Click Regenerate Embeddings
- Wait for all documents to be reprocessed
- Settings will apply to all future searches
Supported File Types
Format | Extension | Notes |
---|---|---|
.pdf | Most common document format | |
Text | .txt | Plain text files |
Word | .docx | Microsoft Word documents |
Markdown | .md | Formatted text files |
More formats coming soon!
Tips for Best Results
Document Quality
- Clean text: Documents with clear, readable text work best
- Good structure: Headers and sections help the AI understand context
- Avoid scanned images: Text in images isn't processed yet
Asking Questions
- Be specific: "What budget was allocated for marketing?" vs "What about money?"
- Use document language: If your document uses specific terms, use them in questions
- Ask follow-ups: Build on previous answers with more detailed questions
Managing Many Documents
- Organize by topic: Group related documents together
- Use descriptive filenames: Helps you remember what each document contains
- Remove old documents: Keep only what you need for better performance
Troubleshooting
Documents Not Processing
Problem: Document stuck in "Processing" status Solutions:
- Wait a few minutes (large documents take time)
- Check that Ollama is running locally
- Try re-uploading the document
- Check the browser console for errors
Poor Search Results
Problem: AI doesn't find relevant information Solutions:
- Lower the similarity threshold in settings
- Try rephrasing your question
- Use keywords that appear in your document
- Check if the document processed correctly
Embedding Errors
Problem: "Error" status on documents Solutions:
- Ensure Ollama is running with the embedding model
- Check if the document file is corrupted
- Try a different file format
- Look at browser console for specific error messages
Performance Issues
Problem: Slow responses or processing Solutions:
- Reduce chunk size in settings
- Remove unused documents
- Ensure Ollama has sufficient system resources
- Consider using a faster embedding model
Privacy & Security
- Local Processing: Documents are processed on your computer
- No Cloud Upload: Files never leave your machine unless you use cloud AI services
- Temporary Storage: Document chunks are stored locally and can be deleted anytime
- No Tracking: Your documents and questions are completely private
Technical Details
For developers and advanced users:
How It Works
- Document Upload: Files are uploaded to the local backend
- Text Extraction: Content is extracted from various file formats
- Chunking: Text is split into overlapping segments
- Embedding: Each chunk gets a vector representation using Ollama
- Storage: Embeddings are stored locally in JSON files
- Search: When you ask a question, it's compared against all chunks
- Context: Most relevant chunks are included in the AI response
Storage Location
- Documents:
backend/documents.json
- Embeddings:
backend/document-chunks.json
- Settings:
backend/preferences.json
API Endpoints
POST /api/documents/upload
- Upload documentsGET /api/documents
- List documentsDELETE /api/documents/:id
- Remove documentPOST /api/documents/regenerate-embeddings
- Reprocess all documentsGET /api/documents/embedding-status
- Check processing status
Need Help?
- General Issues: Check the Troubleshooting Guide
- Quick Start: See the Quick Start Guide
- Keyboard Shortcuts: View Keyboard Shortcuts
Happy document chatting! 📄✨