How suyashkumarsingour/ai-learning-assistant works
AI Learning Assistant is a document-grounded chat application: users upload PDFs, which are extracted, chunked, embedded, and indexed; chat retrieves relevant chunks and generates answers, while conversations and document metadata are persisted. The backend exposes document, chat, and conversation routes, with a separate frontend for login, dashboard, chat, and document management. Backend calls are supported by sampled source or the source index; frontend-to-API wiring is not shown, so that link is left unverified.
Main entry points: api.ts API client · documents.py Document routes · ingestion_service.py PDF ingestion · chat.py Chat route
Components 29
Web interface
- Login page
frontend/app/login/page.tsx - Dashboard
frontend/app/dashboard/page.tsx - Chat UI
frontend/components/Chat.tsx - Conversation list
frontend/components/ConversationList.tsx - Document list
frontend/components/DocumentList.tsx - Document upload
frontend/components/UploadDocument.tsx - API client
frontend/lib/api.ts
API and access
- FastAPI app
app/main.py - Token validation
app/auth/dependencies.py - Chat route
app/routers/chat.py - Conversation routes
app/routers/conversations.py - Document routes
app/routers/documents.py - Conversation service
app/services/conversation_service.py - Document service
app/services/document_service.py
Document Q&A
- PDF ingestion
app/services/ingestion_service.py - Text extraction
app/services/extraction_service.py - Text chunking
app/services/chunking_service.py - Embedding generation
app/services/embedding_service.py - Chunk retrieval
app/services/retrieval_service.py - RAG orchestration
app/services/rag_service.py - Answer generation
app/services/generation_service.py
Persistence and AI
- Supabase auth
frontend/lib/supabase.ts - Qdrant client
app/clients/qdrant_client.py - Vector store
- Google AI client
app/clients/google_client.py - Google Gemini
- Supabase REST client
app/clients/supabase_client.py - Supabase
Other components
- Learner
Connections 35
- Learner → Login page: uses
- Dashboard → API client: requests data
- Chat UI → API client: sends chat
- Document upload → API client: uploads PDF
- Conversation list → API client: requests history
- Document list → API client: requests documents
- API client → Supabase auth: uses auth
frontend/lib/api.ts - FastAPI app → Chat route: mounts
app/main.py - FastAPI app → Conversation routes: mounts
app/main.py - FastAPI app → Document routes: mounts
app/main.py - Chat route → Token validation: validates user
app/routers/chat.py - Chat route → Conversation service: manages conversation
app/routers/chat.py - Chat route → RAG orchestration: requests answer
app/routers/chat.py - Conversation routes → Token validation: validates user
app/routers/conversations.py - Conversation routes → Conversation service: manages history
app/routers/conversations.py - Document routes → Token validation: validates user
app/routers/documents.py - Document routes → PDF ingestion: ingests PDF
app/routers/documents.py - Document routes → Document service: manages records
app/routers/documents.py - Document routes → Chunk retrieval: deletes chunks
app/routers/documents.py - Conversation service → Supabase REST client: uses REST helpers
app/services/conversation_service.py - Document service → Supabase REST client: uses REST helpers
app/services/document_service.py - Token validation → Supabase: checks signing keys
app/auth/dependencies.py - PDF ingestion → Text extraction: extracts text
app/services/ingestion_service.py - PDF ingestion → Text chunking: splits text
app/services/ingestion_service.py - PDF ingestion → Embedding generation: embeds chunks
app/services/ingestion_service.py - PDF ingestion → Qdrant client: upserts vectors
app/services/ingestion_service.py - Chunk retrieval → Embedding generation: embeds query
app/services/retrieval_service.py - Chunk retrieval → Qdrant client: queries and deletes
app/services/retrieval_service.py - Qdrant client → Vector store: connects
app/clients/qdrant_client.py - RAG orchestration → Chunk retrieval: retrieves chunks
app/services/rag_service.py - RAG orchestration → Answer generation: generates answer
app/services/rag_service.py - Embedding generation → Google AI client: requests embeddings
app/services/embedding_service.py - Answer generation → Google AI client: requests completion
app/services/generation_service.py - Google AI client → Google Gemini: connects
app/clients/google_client.py - Supabase REST client → Supabase: configures REST access
app/clients/supabase_client.py