How vishwassk15/privatedoc-ai works
PrivateDoc AI is a local-first document intelligence and grounded RAG application. Users upload and inspect documents, then ask questions answered from retrieved page-level evidence with deterministic citations; unknown questions can be refused, and generation remains useful but optional when a local LLM is unavailable. The graph also preserves the dashboard, system diagnostics, and privacy audit capabilities. README statements support the documented pipeline; source excerpts and the index support key API, frontend, persistence, and service relationships. OCR and several subsystem internals were not sampled, so uncertain wiring is omitted.
Main entry points: api.ts API Client · documents.py Document API · main.py FastAPI Application · App.tsx Application Shell
Components 25
User Interface
- Application Shell
frontend/src/App.tsx - Document Workspace
frontend/src/pages/Documents.tsx - Evidence Inspector
frontend/src/pages/DocumentDetail.tsx - Ask AI
frontend/src/pages/AskAI.tsx - Dashboard
frontend/src/pages/Dashboard.tsx - API Client
frontend/src/services/api.ts
API and Persistence
- FastAPI Application
backend/app/main.py - Document API
backend/app/api/documents.py - Query API
backend/app/api/query.py - System API
backend/app/api/system.py - SQLite Metadata
backend/app/database.py
Document Ingestion
- Document Processor
backend/app/services/document_processor.py - OCR Provider
backend/app/services/ocr.py - Page Chunker
backend/app/services/chunker.py - Embedding Provider
backend/app/services/embeddings.py - FAISS Vector Index
backend/app/services/vector_store.py
Grounded RAG
- RAG Orchestrator
backend/app/services/rag.py - Local Retriever
backend/app/services/retriever.py - Citation Builder
backend/app/services/citations.py - Local LLM Provider
backend/app/services/llm.py
Status and Privacy
- System Status
frontend/src/pages/SystemStatus.tsx - Privacy Audit
frontend/src/pages/PrivacyStatus.tsx - Privacy Service
backend/app/services/privacy.py - Runtime Configuration
backend/app/config.py
Other components
- User
Connections 36
- User → Application Shell: uses
frontend/src/App.tsx - Application Shell → Document Workspace: renders
frontend/src/App.tsx - Application Shell → Evidence Inspector: renders
frontend/src/App.tsx - Application Shell → Ask AI: renders
frontend/src/App.tsx - Application Shell → Dashboard: renders
frontend/src/App.tsx - Document Workspace → API Client: requests data
frontend/src/pages/Documents.tsx - Evidence Inspector → API Client: requests data
frontend/src/pages/DocumentDetail.tsx - Ask AI → API Client: submits queries
frontend/src/pages/AskAI.tsx - Dashboard → API Client: requests data
frontend/src/pages/Dashboard.tsx - API Client → Document API: calls documents
frontend/src/services/api.ts - API Client → Query API: calls query
frontend/src/services/api.ts - API Client → System API: calls status
frontend/src/services/api.ts - FastAPI Application → Document API: registers route
backend/app/main.py - FastAPI Application → Query API: registers route
backend/app/main.py - FastAPI Application → System API: registers route
backend/app/main.py - Document API → Document Processor: processes uploads
backend/app/api/documents.py - Document API → Page Chunker: chunks pages
backend/app/api/documents.py - Document API → Embedding Provider: embeds chunks
backend/app/api/documents.py - Document API → FAISS Vector Index: indexes vectors
backend/app/api/documents.py - Document API → SQLite Metadata: stores metadata
backend/app/api/documents.py - Document Processor → OCR Provider: uses when needed
backend/app/services/document_processor.py - Document Processor → Page Chunker: chunks extracted text
- Embedding Provider → FAISS Vector Index: indexes embeddings
- FAISS Vector Index → SQLite Metadata: stores metadata alongside
- Query API → RAG Orchestrator: runs query
backend/app/api/query.py - RAG Orchestrator → Local Retriever: retrieves evidence
backend/app/services/rag.py - Local Retriever → Embedding Provider: embeds query
backend/app/services/retriever.py - Local Retriever → FAISS Vector Index: searches index
backend/app/services/retriever.py - RAG Orchestrator → Citation Builder: builds citations
backend/app/services/rag.py - RAG Orchestrator → Local LLM Provider: generates answer
backend/app/services/rag.py - System Status → API Client: requests status
frontend/src/pages/SystemStatus.tsx - Privacy Audit → API Client: requests audit
frontend/src/pages/PrivacyStatus.tsx - API Client → FastAPI Application: uses local API
- System API → Privacy Service: reports privacy
backend/app/api/system.py - FastAPI Application → Runtime Configuration: configures runtime
backend/app/main.py - FastAPI Application → SQLite Metadata: initializes store
backend/app/main.py