How princevegetaiv/document-rag-chatbot works
Local single-user document RAG chatbot: a user adds supported files through the knowledge-base panel, the backend extracts and chunks them into persistent Chroma storage, then chat requests retrieve relevant passages and generate grounded answers through Groq. The browser retains follow-up history. The README documents the health/status and ingestion capabilities. The graph follows shown calls and documented HTTP behavior; unsampled frontend page wiring and some runtime details are not inferred.
Main entry points: vector_store.py Persistent vector store · chat.py Chat endpoint · chain.py Conversational RAG chain · ingestion.py Ingestion endpoint
Components 20
Browser UI
- Knowledge base panel
frontend/components/KnowledgeBase.tsx - Chat interface
frontend/components/Chat.tsx - Backend API client
frontend/lib/api.ts - Conversation history
frontend/components/Chat.tsx
HTTP Backend
- FastAPI application
backend/app/main.py - Application settings
backend/app/config.py - Shared dependencies
backend/app/deps.py - Request schemas
backend/app/schemas/requests.py - Ingestion endpoint
backend/app/api/ingestion.py - Chat endpoint
backend/app/api/chat.py
Document Indexing
- File discovery and loading
backend/app/rag/document_loader.py - Document chunker
backend/app/rag/chunker.py - Local embeddings
backend/app/rag/embeddings.py - Persistent vector store
backend/app/rag/vector_store.py - User document files
backend/data/documents - Ingestion manifest
backend/app/rag/vector_store.py
Grounded Chat
- Conversational RAG chain
backend/app/rag/chain.py - Thresholded retrieval
backend/app/rag/retriever.py - Groq language model
Other components
- Local user
Connections 31
- Local user → Knowledge base panel: uploads via
README.md - Local user → Chat interface: asks
README.md - Knowledge base panel → Backend API client: requests ingestion
README.md - Chat interface → Backend API client: sends chat
README.md - Chat interface → Conversation history: stores history
README.md - Backend API client → Ingestion endpoint: POST /api/ingest
README.md - Backend API client → Chat endpoint: POST /api/chat
README.md - FastAPI application → Ingestion endpoint: registers route
backend/app/main.py - FastAPI application → Chat endpoint: registers route
backend/app/main.py - FastAPI application → Shared dependencies: resolves settings/store
backend/app/main.py - Shared dependencies → Application settings: loads configuration
backend/app/deps.py - Shared dependencies → Persistent vector store: opens store
backend/app/deps.py - Ingestion endpoint → Shared dependencies: uses dependencies
backend/app/api/ingestion.py - Chat endpoint → Shared dependencies: uses dependencies
backend/app/api/chat.py - Ingestion endpoint → Request schemas: returns schema
backend/app/api/ingestion.py - Chat endpoint → Request schemas: validates and responds
backend/app/api/chat.py - Ingestion endpoint → Persistent vector store: ingests files
backend/app/api/ingestion.py - Chat endpoint → Persistent vector store: counts chunks
backend/app/api/chat.py - Chat endpoint → Conversational RAG chain: answers question
backend/app/api/chat.py - User document files → File discovery and loading: provides files
README.md - Persistent vector store → File discovery and loading: discovers and loads
backend/app/rag/vector_store.py - Persistent vector store → Document chunker: chunks documents
backend/app/rag/vector_store.py - Persistent vector store → Local embeddings: configures embeddings
backend/app/rag/vector_store.py - Persistent vector store → Ingestion manifest: reads and writes
backend/app/rag/vector_store.py - Persistent vector store → User document files: reads source files
README.md - Persistent vector store → Thresholded retrieval: stores searchable chunks
- Conversational RAG chain → Application settings: uses model settings
backend/app/rag/chain.py - Conversational RAG chain → Thresholded retrieval: retrieves passages
backend/app/rag/chain.py - Thresholded retrieval → Persistent vector store: searches chunks
backend/app/rag/retriever.py - Conversational RAG chain → Groq language model: invokes generation
backend/app/rag/chain.py - Conversational RAG chain → Conversation history: uses follow-up context
README.md