How mahad816/drivemind_ai works
DriveMind is a single-user Google Drive knowledge assistant. A user authorizes read-only Drive access, prepares a local index through sync, ingest, chunk, and build stages, then asks questions in chat and follows citations to indexed text. The graph preserves the documented specialized query routes, optional LangGraph and hybrid retrieval, file inspection, and browser-local chat history. Preparation and RAG service excerpts are partial; stage wiring beyond documented behavior is shown at subsystem level, not as unverified internal calls.
Main entry points: router.py FastAPI routes · rag_service.py RAG orchestration · client.ts Browser API client · chat-interface.tsx Chat interface
Components 27
Browser experience
- Chat interface
frontend/components/chat/chat-interface.tsx - Prepare knowledge
frontend/components/knowledge/prepare-knowledge-view.tsx - File library
frontend/components/files/knowledge-library.tsx - Source viewer
frontend/components/sources/source-viewer.tsx - Chat history
frontend/lib/conversations/storage.ts
API and access
- Browser API client
frontend/lib/api/client.ts - FastAPI routes
backend/app/api/router.py - Drive OAuth
backend/app/services/google_oauth_service.py - Citation source API
backend/app/api/sources.py
Knowledge preparation
- Metadata sync
backend/app/services/drive_sync_service.py - Drive connector
backend/app/connectors/google_drive/client.py - Content ingestion
backend/app/services/ingestion_service.py - Text extraction
backend/app/ingestion/extractors/registry.py - Chunking
backend/app/services/chunking_service.py - Index building
backend/app/services/indexing_service.py - Embedding service
backend/app/embeddings/openai_service.py
Question answering
- RAG orchestration
backend/app/services/rag_service.py - Query routing
backend/app/retrieval/query_router.py - Retrieval
backend/app/retrieval/hybrid.py - File inventory
backend/app/retrieval/file_inventory.py - Named-file search
backend/app/retrieval/file_target.py - Optional agent graph
backend/app/agents/drive_graph/graph.py
Persistent state
- PostgreSQL
- Qdrant vectors
Other components
- DriveMind user
- Google Drive API
- OpenAI services
Connections 33
- DriveMind user → Chat interface: asks
- DriveMind user → Prepare knowledge: prepares
- Chat interface → Browser API client: submits questions
- Prepare knowledge → Browser API client: starts jobs
- File library → Browser API client: requests files
- Source viewer → Browser API client: requests chunks
- Browser API client → FastAPI routes: HTTP requests
- Chat interface → Chat history: stores history
- FastAPI routes → Drive OAuth: starts authorization
- Drive OAuth → Google Drive API: authorizes access
- FastAPI routes → Metadata sync: starts sync
- Metadata sync → Drive connector: lists changes
- Drive connector → Google Drive API: reads metadata
- FastAPI routes → Content ingestion: starts ingest
- Content ingestion → Drive connector: fetches content
- Content ingestion → Text extraction: extracts text
- FastAPI routes → Chunking: starts chunking
- FastAPI routes → Index building: starts build
- Index building → Embedding service: embeds chunks
- Embedding service → OpenAI services: requests embeddings
- Index building → Qdrant vectors: writes vectors
- FastAPI routes → RAG orchestration: dispatches chat
- RAG orchestration → Query routing: classifies question
- RAG orchestration → Retrieval: retrieves evidence
- RAG orchestration → File inventory: searches inventory
- RAG orchestration → Named-file search: searches named file
- RAG orchestration → Optional agent graph: optionally dispatches
- Retrieval → Qdrant vectors: searches vectors
- Retrieval → PostgreSQL: searches text and metadata
- RAG orchestration → OpenAI services: generates answers
- RAG orchestration → PostgreSQL: persists answers
- FastAPI routes → Citation source API: routes citation lookup
- Citation source API → PostgreSQL: reads indexed chunks