How iam-sharath/college_ai_chat_assistant works
College AI Assistant serves student questions through a web chat and optional WhatsApp, then returns grounded answers with sources and confidence. The Python engine rewrites queries, retrieves and reranks knowledge-base chunks, and generates answers through provider failover; repeated successful answers can be cached. Administrators upload, list, and delete documents through a protected panel, with ingestion feeding searchable indexes and SQLite tracking documents and chunks. The graph follows documented routes and excerpted calls; unsampled frontend and WhatsApp internals are represented only where README or route registration supports the relationship.
Main entry points: retrieval.py Knowledge store · server.js Express server · app.py RAG endpoints · admin.js Admin API
Components 21
User interfaces
- Web chat
frontend/app.js - Admin panel
frontend/admin.js
API gateway
- Express server
backend/server.js - Chat API
backend/routes/chat.js - WhatsApp route
backend/routes/whatsapp.js - Admin API
backend/routes/admin.js - Admin auth
backend/middleware/adminAuth.js - Response formatter
backend/utils/response.js
RAG engine
- RAG endpoints
rag-engine/app.py - Query rewriting
rag-engine/query_rewriter.py - Hybrid retrieval
rag-engine/retrieval.py - LLM failover
rag-engine/llm_router.py - Response cache
rag-engine/cache.py - Engine config
rag-engine/config.py
Knowledge management
- Document endpoints
rag-engine/app.py - Document ingestion
rag-engine/ingestion.py - Knowledge store
rag-engine/retrieval.py - Document registry
rag-engine/db.py - FAISS index
rag-engine/retrieval.py
Other components
- Student
- Twilio WhatsApp
Connections 23
- Student → Web chat: asks
README.md - Web chat → Express server: uses
README.md - Express server → Chat API: routes to
backend/server.js - Chat API → RAG endpoints: posts question
backend/routes/chat.js - RAG endpoints → Response cache: checks and stores
rag-engine/app.py - RAG endpoints → Knowledge store: searches
rag-engine/app.py - RAG endpoints → LLM failover: generates answer
rag-engine/app.py - Knowledge store → Query rewriting: rewrites query
rag-engine/retrieval.py - Knowledge store → FAISS index: searches and updates
rag-engine/retrieval.py - Knowledge store → Document registry: reads and writes chunks
rag-engine/retrieval.py - Admin panel → Express server: manages documents
README.md - Express server → Admin API: routes to
backend/server.js - Admin API → Admin auth: protects routes
backend/routes/admin.js - Admin API → Response formatter: formats responses
backend/routes/admin.js - Admin API → Document endpoints: proxies document requests
backend/routes/admin.js - Document endpoints → Document registry: lists and records
rag-engine/app.py - Document endpoints → Document ingestion: extracts and chunks
rag-engine/app.py - Document endpoints → Knowledge store: adds and removes chunks
rag-engine/app.py - Knowledge store → Document registry: persists chunk mappings
rag-engine/retrieval.py - Knowledge store → FAISS index: persists vectors
rag-engine/retrieval.py - Twilio WhatsApp → WhatsApp route: sends webhook
README.md - Express server → WhatsApp route: routes to
backend/server.js - WhatsApp route → RAG endpoints: forwards messages