How harshvaibhav09/opspilot works
OpsPilot is a logistics document-intelligence assistant. Users upload PDFs, receive background processing and per-file progress, then ask typed or spoken questions grounded in those documents; answers include citations, and voice playback is an optional presentation path over the same chat. The backend classifies and chunks documents, embeds and stores them, retrieves relevant passages, and generates answers while retaining session history. The README documents contradiction analysis and developer retrieval details. Some implementation files were not excerpted, so those features are represented at subsystem level and only documented relationships are shown.
Main entry points: chat_service.py Chat orchestration · ChatWindow.jsx Chat interface · ingestion_service.py PDF ingestion · api.js API client
Components 26
Web client
- App shell
frontend/src/App.jsx - Chat interface
frontend/src/components/ChatWindow.jsx - Upload and library
frontend/src/components/Uploader.jsx - Speech input
frontend/src/hooks/useSpeechRecognition.js - Audio playback
frontend/src/services/audioPlayer.js - API client
frontend/src/services/api.js
Backend API
- API routes
backend/app/main.py - Chat endpoint
backend/app/api/chat.py - Document endpoints
backend/app/api/documents.py - Voice endpoint
backend/app/api/voice.py
Document ingestion
- PDF ingestion
backend/app/services/ingestion_service.py - Document classification
backend/app/services/classification_service.py - Type-aware chunking
backend/app/services/chunkers.py - Contradiction analysis
backend/app/services/document_analysis_service.py - Upload jobs
backend/app/services/job_service.py
Chat and retrieval
- Chat orchestration
backend/app/services/chat_service.py - Hybrid retrieval
backend/app/services/retrieval_service.py - Embedding service
backend/app/services/embedding_service.py - Prompt templates
backend/app/core/prompts.py
State and integrations
- LLM client
backend/app/core/llm_client.py - Vector and BM25 store
backend/app/db/vector_store.py - Session store
backend/app/db/session_store.py - Conversation memory
backend/app/services/memory_service.py - Speech synthesis
backend/app/services/voice_service.py
Other components
- Ops user
- Groq service
Connections 33
- Ops user → App shell: uses
- App shell → API client: creates session
frontend/src/App.jsx - App shell → Chat interface: renders
frontend/src/App.jsx - App shell → Upload and library: shows library
frontend/src/App.jsx - Chat interface → API client: sends chat
frontend/src/components/ChatWindow.jsx - Chat interface → Speech input: accepts voice
- Chat interface → Audio playback: plays answer
frontend/src/components/ChatWindow.jsx - Upload and library → API client: uploads files
frontend/src/components/Uploader.jsx - API client → API routes: calls API
- API routes → Chat endpoint: routes chat
backend/app/main.py - API routes → Document endpoints: routes documents
backend/app/main.py - API routes → Voice endpoint: routes voice
backend/app/main.py - Chat endpoint → Chat orchestration: handles message
backend/app/api/chat.py - Chat endpoint → Conversation memory: loads history
backend/app/api/chat.py - Document endpoints → Upload jobs: starts background job
backend/app/api/documents.py - Upload jobs → PDF ingestion: runs ingestion
- PDF ingestion → Document classification: classifies sample
backend/app/services/ingestion_service.py - PDF ingestion → Type-aware chunking: chunks pages
backend/app/services/ingestion_service.py - PDF ingestion → Embedding service: embeds chunks
backend/app/services/ingestion_service.py - PDF ingestion → Vector and BM25 store: stores chunks
backend/app/services/ingestion_service.py - Document endpoints → Contradiction analysis: starts analysis
backend/app/api/documents.py - Chat orchestration → Hybrid retrieval: retrieves passages
backend/app/services/chat_service.py - Chat orchestration → Conversation memory: loads and saves turns
backend/app/services/chat_service.py - Chat orchestration → Prompt templates: uses prompts
backend/app/services/chat_service.py - Chat orchestration → LLM client: generates answer
backend/app/services/chat_service.py - Chat orchestration → Contradiction analysis: adds document findings
backend/app/services/chat_service.py - Hybrid retrieval → Embedding service: embeds query
backend/app/services/retrieval_service.py - Hybrid retrieval → Vector and BM25 store: queries hybrid index
backend/app/services/retrieval_service.py - Conversation memory → Session store: reads and writes turns
backend/app/services/memory_service.py - LLM client → Groq service: requests completion
backend/app/core/llm_client.py - Voice endpoint → Speech synthesis: synthesizes speech
backend/app/api/voice.py - Speech synthesis → Groq service: uses configured provider
- Chat interface → API client: requests speech
frontend/src/components/ChatWindow.jsx