How patildhrup/set2-l2-01-rag-chatbot works
This is a knowledge-base application for uploading documents, managing conversations, and asking questions grounded in stored content. The frontend routes users through authentication, workspace, document, and chat screens; the backend exposes corresponding API areas and has a document-ingestion worker that processes uploaded files into searchable vectors. The sampled code supports the ingestion flow and frontend chat wiring, but not the internal chat API/service calls or retrieval-to-generation orchestration, so those links are omitted. Unsampled features are represented at their existing directory paths.
Main entry points: worker.py Ingestion worker · pipeline.py Processing pipeline · service.py Upload service · main.py Application setup
Components 29
Web application
- Route application
frontend/src/App.jsx - Chat screen
frontend/src/pages/ChatPage.jsx - Session hook
frontend/src/hooks/useSessions.js - Chat client
frontend/src/services/chatService.js - HTTP client
frontend/src/services/http.js - Auth state
frontend/src/store/authStore.js - Auth clients
frontend/src/services - Document screens
frontend/src/pages/DocumentsPage.jsx - Document client
frontend/src/services/documentService.js
API and identity
- API router
backend/app/api/v1/router.py - Authentication API
backend/app/api/v1/auth.py - Workspace and content APIs
backend/app/api/v1 - Auth dependencies
backend/app/api
Document ingestion
- Ingestion worker
backend/app/services/ingestion/worker.py - Upload service
backend/app/services/ingestion/service.py - File storage
backend/app/services/ingestion/storage.py - Processing pipeline
backend/app/services/ingestion/pipeline.py - Text extraction
backend/app/services/ingestion/extraction.py - Text chunking
backend/app/services/ingestion/chunking.py - Upload validation
backend/app/services/ingestion/validation.py
Knowledge and chat data
- Relational models
backend/app/db/models.py - Document repository
backend/app/db/repositories/documents.py - Knowledge-base repository
backend/app/db/repositories/knowledge_bases.py - Vector store
backend/app/vectorstore/chroma.py - Retrieval service
backend/app/services/retrieval.py - Chat and generation
backend/app/services
Application runtime
- Application setup
backend/app/main.py - Configuration
backend/app/core/config.py
Other components
- User
Connections 32
- User → Route application: uses
frontend/src/App.jsx - Route application → Chat screen: routes to
frontend/src/App.jsx - Chat screen → Session hook: uses
frontend/src/pages/ChatPage.jsx - Chat screen → Chat client: calls
frontend/src/pages/ChatPage.jsx - Session hook → Chat client: calls
frontend/src/hooks/useSessions.js - Chat client → HTTP client: uses
frontend/src/services/chatService.js - Route application → Auth state: initializes
frontend/src/App.jsx - Auth state → Auth clients: uses
frontend/src/store/authStore.js - Route application → Document screens: routes to
frontend/src/App.jsx - Document screens → Document client: calls
- API router → Authentication API: registers
backend/app/api/v1/router.py - API router → Workspace and content APIs: registers
backend/app/api/v1/router.py - Authentication API → Auth dependencies: uses
backend/app/api/v1/auth.py - Application setup → API router: mounts
backend/app/main.py - Application setup → Configuration: loads
backend/app/main.py - Application setup → Ingestion worker: configures
backend/app/main.py - Application setup → Processing pipeline: constructs
backend/app/main.py - Ingestion worker → Processing pipeline: runs
backend/app/services/ingestion/worker.py - Ingestion worker → File storage: reads files
backend/app/services/ingestion/worker.py - Ingestion worker → Document repository: updates records
backend/app/services/ingestion/worker.py - Ingestion worker → Knowledge-base repository: loads workspace
backend/app/services/ingestion/worker.py - Upload service → File storage: stores uploads
backend/app/services/ingestion/service.py - Upload service → Upload validation: validates files
backend/app/services/ingestion/service.py - Upload service → Document repository: records uploads
backend/app/services/ingestion/service.py - Upload service → Knowledge-base repository: checks workspace
backend/app/services/ingestion/service.py - File storage → Upload validation: checks extensions
backend/app/services/ingestion/storage.py - Processing pipeline → Text extraction: extracts text
backend/app/services/ingestion/pipeline.py - Processing pipeline → Text chunking: chunks text
backend/app/services/ingestion/pipeline.py - Processing pipeline → Vector store: writes vectors
backend/app/services/ingestion/pipeline.py - Document repository → Relational models: reads and writes
backend/app/db/repositories/documents.py - Knowledge-base repository → Relational models: reads and writes
backend/app/db/repositories/knowledge_bases.py - Retrieval service → Vector store: queries
backend/app/services/retrieval.py