How singhamit55/smartdoc-ai works
SmartDoc AI is a multi-tenant PDF chat application. Users authenticate with Google, upload PDFs for indexing, then ask questions and receive streamed answers grounded in retrieved document passages, with a documented DuckDuckGo fallback. The FastAPI entry point owns these workflows and scopes resources by user. The graph includes the documented chat-history and document-management capabilities. Some endpoint internals and frontend wiring were excerpted only partially; edges are limited to relationships visible in those excerpts or explicitly documented in the README.
Main entry points: main.py FastAPI workflows · script.js Chat and documents UI · vectorstore.py Tenant vector store · memory.py SQLite application data
Components 16
User interface
- Chat and documents UI
frontend/script.js - Application pages
frontend
API and identity
- FastAPI workflows
main.py - Google OAuth
Document ingestion
- PDF extraction
Backend/pdf_loader.py - Text chunking
Backend/chunker.py - Embedding generation
Backend/embeddings.py - Tenant vector store
Backend/vectorstore.py
Retrieval and answers
- Semantic retriever
Backend/retriever.py - QA prompt and citations
Backend/chat.py - Language model
Backend/llm.py - DuckDuckGo search
Tenant state
- Conversation memory
Backend/memory.py - SQLite application data
Backend/memory.py - Tenant PDF files
main.py
Other components
- User
Connections 20
- User → Chat and documents UI: uses
README.md - Chat and documents UI → FastAPI workflows: calls API
frontend/script.js - FastAPI workflows → Google OAuth: verifies tokens
main.py - FastAPI workflows → SQLite application data: registers users
main.py - FastAPI workflows → PDF extraction: extracts PDF
README.md - FastAPI workflows → Text chunking: chunks text
main.py - FastAPI workflows → Embedding generation: creates embeddings
main.py - FastAPI workflows → Tenant vector store: indexes documents
main.py - FastAPI workflows → Tenant PDF files: stores PDFs
main.py - FastAPI workflows → Semantic retriever: retrieves context
main.py - FastAPI workflows → Conversation memory: loads history
main.py - FastAPI workflows → QA prompt and citations: formats prompt
main.py - FastAPI workflows → Language model: streams answer
main.py - FastAPI workflows → DuckDuckGo search: searches fallback
main.py - FastAPI workflows → SQLite application data: stores conversations
main.py - Chat and documents UI → Application pages: renders
README.md - FastAPI workflows → Tenant vector store: removes document chunks
main.py - FastAPI workflows → Tenant PDF files: lists and deletes
main.py - FastAPI workflows → SQLite application data: lists chat records
main.py - Semantic retriever → Tenant vector store: searches vectors
README.md