How xytex-s/eam-ai-chatbot works
This is a local Flask chatbot for SHU student-support questions, with sourced answers from university pages, fixed crisis responses, nearby-place recommendations, and streamed answers. The main workflow routes a question through safety and place checks before retrieval and local-model generation. Its knowledge pipeline discovers pages, collects and chunks them, then builds the searchable index. The graph preserves these distinct stages and the optional OpenStreetMap integration. Some runtime details are unsampled; uncertain links are omitted.
Main entry points: app.py Flask API · rag.py RAG workflow · collect_pages.py Page collection · build_index.py Index building
Components 14
Knowledge preparation
- Page discovery
paging/find_pages.py - SHU pages
- Page collection
paging/collect_pages.py - Page chunks
paging/data/chunks.json - Index building
chatbot/build_index.py
Question answering
- Search index
chatbot/data/index.pt - RAG workflow
chatbot/rag.py - Local language model
chatbot/rag.py
Specialized responses
- Safety check
chatbot/safety.py - Nearby places
chatbot/places.py
Other components
- Student
- OpenStreetMap
Connections 13
- Student → Chat page: asks
README.md - Chat page → Flask API: sends question
chatbot/app.py - Flask API → Safety check: checks first
chatbot/app.py - Flask API → Nearby places: checks next
chatbot/app.py - Flask API → RAG workflow: requests answer
README.md - RAG workflow → Search index: searches
chatbot/rag.py - RAG workflow → Local language model: generates answer
chatbot/rag.py - Nearby places → OpenStreetMap: queries
chatbot/places.py - Page discovery → SHU pages: finds URLs
paging/find_pages.py - Page collection → SHU pages: downloads
paging/collect_pages.py - Page collection → Page chunks: writes chunks
README.md - Index building → Page chunks: reads chunks
README.md - Index building → Search index: builds index
README.md