How sukumarmuthusamy/docmind-xai works
DocMind XAI is a local-first document RAG application. Users upload documents for asynchronous parsing, chunking, embedding, and storage, then search or chat over them; chat streams answers with citations and an auditable XAI trail. The map includes the documented health/model endpoints and intent routing. Source excerpts show the ingestion and retrieval internals; chat generation and several route implementations are not excerpted, so those internal links are omitted where unverified.
Main entry points: router.py API router · retrieval.py Hybrid retrieval and XAI · pipeline.py Ingestion orchestration · chat.py Chat endpoint
Components 27
User interface
- Web app shell
frontend/components/AppShell.tsx - Streaming chat UI
frontend/components/Chat.tsx - Document upload UI
frontend/components/DocumentUpload.tsx - Frontend API proxy
frontend/app/api/_backend.ts
API and routing
- FastAPI application
backend/app/main.py - API router
backend/app/api/router.py - Upload and task status
backend/app/api/routes/ingest.py - Chat endpoint
backend/app/api/routes/chat.py - Search endpoint
backend/app/api/routes/search.py - Document listing
backend/app/api/routes/documents.py - Health and model routes
backend/app/api/routes/health.py
Document ingestion
- Celery worker
backend/app/worker.py - Ingestion task
backend/app/tasks/ingestion.py - Ingestion orchestration
backend/app/services/pipeline.py - Parse and chunk
backend/app/services/ingestion.py - Embedding generation
backend/app/services/embeddings.py
Search and answers
- Intent routing
backend/app/services/intent_router.py - Hybrid retrieval and XAI
backend/app/services/retrieval.py - Cross-encoder reranker
backend/app/services/reranker.py - Answer generation
backend/app/services/llm.py
Persistence and services
- FAISS vector index
backend/app/services/vector_store.py - PostgreSQL records
backend/app/db/session.py - Ollama service
backend/app/services/ollama_client.py - Runtime settings
backend/app/core/config.py
Other components
- User
- Redis broker and results
- Ollama runtime
Connections 35
- User → Web app shell: uses
- Web app shell → Streaming chat UI: renders
frontend/components/AppShell.tsx - Web app shell → Document upload UI: renders
frontend/components/AppShell.tsx - Streaming chat UI → Frontend API proxy: requests via
frontend/components/Chat.tsx - Document upload UI → Frontend API proxy: requests via
- Frontend API proxy → FastAPI application: forwards requests
- FastAPI application → API router: mounts
backend/app/main.py - API router → Upload and task status: registers
backend/app/api/router.py - API router → Chat endpoint: registers
backend/app/api/router.py - API router → Search endpoint: registers
backend/app/api/router.py - API router → Document listing: registers
backend/app/api/router.py - API router → Health and model routes: registers
backend/app/api/router.py - Upload and task status → Celery worker: enqueues task
backend/app/api/routes/ingest.py - Celery worker → Redis broker and results: uses broker
- Redis broker and results → Ingestion task: dispatches
- Ingestion task → Ingestion orchestration: invokes
backend/app/tasks/ingestion.py - Ingestion orchestration → Parse and chunk: parses and chunks
backend/app/services/pipeline.py - Ingestion orchestration → Embedding generation: embeds chunks
backend/app/services/pipeline.py - Ingestion orchestration → FAISS vector index: writes vectors
backend/app/services/pipeline.py - Ingestion orchestration → PostgreSQL records: persists records
backend/app/services/pipeline.py - Chat endpoint → Intent routing: classifies query
backend/app/api/routes/chat.py - Chat endpoint → Hybrid retrieval and XAI: requests evidence
backend/app/api/routes/chat.py - Chat endpoint → Answer generation: requests answer
backend/app/api/routes/chat.py - Search endpoint → Intent routing: classifies query
backend/app/api/routes/search.py - Search endpoint → Hybrid retrieval and XAI: requests results
backend/app/api/routes/search.py - Hybrid retrieval and XAI → PostgreSQL records: reads chunks
backend/app/services/retrieval.py - Hybrid retrieval and XAI → FAISS vector index: searches vectors
backend/app/services/retrieval.py - Hybrid retrieval and XAI → Embedding generation: embeds query
backend/app/services/retrieval.py - Hybrid retrieval and XAI → Cross-encoder reranker: reranks candidates
backend/app/services/retrieval.py - Answer generation → Ollama service: generates with
- Ollama service → Ollama runtime: calls
- Document listing → PostgreSQL records: reads documents
backend/app/api/routes/documents.py - Upload and task status → Redis broker and results: polls task status
- Health and model routes → Ollama service: checks service
- Streaming chat UI → User: shows citations
frontend/components/Chat.tsx