How hungcb123/ctu-chat_bot works
CTU Academic Chatbot is a Vietnamese university-support chatbot combining supervisor-routed agents, hybrid RAG, and Neo4j academic and tuition tools. The main workflow is user question → supervisor rewrite and intent routing → academic graph tools or retrieval and a specialist agent → answer. Separate capabilities include account/chat history and administrator document upload with OCR and indexing. Relationships follow the README and shown imports; detailed wiring inside unsampled modules is not assumed.
Main entry points: graph.py Supervisor and agents · rag_engine.py Hybrid RAG engine · main.py Application startup · chat.py Chat API
Components 28
API and sessions
- Application startup
app/main.py - Chat API
app/api/chat.py - Authentication
app/api/auth.py - Chat history API
app/api/history.py - Document upload API
app/api/document.py
Agent routing
- Supervisor and agents
app/agents/graph.py - Agent prompts
app/agents/prompts.py - Intent routing
app/services/query_intent.py
RAG and documents
- Hybrid RAG engine
app/services/rag_engine.py - BM25 search
app/services/bm25_service.py - Remote reranker
app/services/remote_reranker.py - Document metadata
app/services/document_metadata.py - PDF OCR
app/services/ocr_service.py
Academic and finance
- Academic graph service
app/services/graph_service.py - Academic tools
app/tools/academic_program.py - Tuition graph tools
app/tools/tuition_graph.py - Tuition catalog
app/services/tuition_catalog.py - Scholarship tools
app/tools/scholarship.py - Tuition calculator
app/tools/tuition.py - Curriculum graph ingest
Graph_DB/app/ingest.py - Tuition graph ingest
Graph_DB/app/ingest_tuition.py
Data stores
- PostgreSQL
app/core/database.py - Neo4j
- Qdrant
- Redis
Other components
- Chat user
- Gemini LLM
- Reranking service
Connections 33
- Chat user → Chat API: asks
README.md - Application startup → Chat API: registers
app/main.py - Application startup → Supervisor and agents: builds
app/main.py - Application startup → Hybrid RAG engine: initializes
app/main.py - Chat API → Supervisor and agents: routes question
README.md - Supervisor and agents → Intent routing: classifies intent
app/agents/graph.py - Supervisor and agents → Agent prompts: uses prompts
app/agents/graph.py - Supervisor and agents → Hybrid RAG engine: requests retrieval
README.md - Supervisor and agents → Academic tools: dispatches academic
README.md - Supervisor and agents → Tuition graph tools: dispatches finance
README.md - Supervisor and agents → Scholarship tools: dispatches scholarship
README.md - Supervisor and agents → Tuition calculator: uses calculator
README.md - Hybrid RAG engine → BM25 search: uses lexical search
app/services/rag_engine.py - Hybrid RAG engine → Remote reranker: uses reranking
app/services/rag_engine.py - Hybrid RAG engine → Document metadata: filters documents
app/services/rag_engine.py - Hybrid RAG engine → Qdrant: vector search
README.md - Hybrid RAG engine → Reranking service: reranks results
README.md - Hybrid RAG engine → Gemini LLM: embeds queries
README.md - Document upload API → PDF OCR: extracts PDF
app/api/document.py - Document upload API → Document metadata: updates metadata
app/api/document.py - Academic tools → Academic graph service: calls queries
app/tools/academic_program.py - Tuition graph tools → Academic graph service: calls queries
app/tools/tuition_graph.py - Tuition graph tools → Tuition catalog: fallback lookup
app/tools/tuition_graph.py - Academic graph service → Neo4j: queries graph
README.md - Curriculum graph ingest → Neo4j: loads curriculum
Graph_DB/app/ingest.py - Tuition graph ingest → Neo4j: loads tuition
Graph_DB/app/ingest_tuition.py - Application startup → Academic graph service: initializes service
app/main.py - Application startup → Redis: connects
app/main.py - Chat API → Authentication: requires identity
app/api/chat.py - Chat history API → Authentication: requires identity
app/api/history.py - Authentication → PostgreSQL: reads users
app/api/auth.py - Chat history API → PostgreSQL: reads history
app/api/history.py - Chat API → PostgreSQL: stores messages
README.md