How rahid-khan/fag-chatbot works
FAQ Chatbot accepts questions through a Flask web interface, semantically matches them against normalized FAQ data, and returns either a confidence-qualified answer or a fallback with suggestions. The main path runs from browser interaction through the HTTP route, response service, retrieval, and dataset; request and chat events are logged separately. The README also documents local chat persistence and a standalone evaluation workflow. The sampled source confirms the request, retrieval, loading, and logging links; unsampled UI wiring and evaluation details are represented only where documented or supported by the tree.
Main entry points: chatbot.py Response policy · chat.js Chat interaction · routes.py HTTP routes · retrieval.py Semantic retrieval
Components 18
Web interface
- Chat interface
templates/index.html - Chat interaction
static/js/chat.js - Browser storage
Chat service
- Flask app
app/__init__.py - HTTP routes
app/routes.py - JSON responses
app/api.py - Response policy
app/chatbot.py - Runtime settings
app/config.py
FAQ retrieval
- FAQ loader
utils/file_loader.py - FAQ dataset
data/faq.json - Semantic retrieval
app/retrieval.py - Text preprocessing
app/preprocessing.py - Sentence Transformer
Logging and evaluation
- Structured logger
utils/logger.py - Chat logs
- Evaluation runner
scripts/evaluate_chatbot.py - Evaluation cases
data/eval_set.json
Other components
- Chat user
Connections 22
- Chat user → Chat interaction: asks
- Chat interaction → HTTP routes: posts question
- HTTP routes → Response policy: requests answer
- Response policy → FAQ loader: loads FAQ
- FAQ loader → FAQ dataset: reads
- Response policy → Semantic retrieval: retrieves match
- Semantic retrieval → Text preprocessing: normalizes text
- Semantic retrieval → Sentence Transformer: encodes and scores
- Semantic retrieval → FAQ dataset: uses loaded rows
- Response policy → Runtime settings: reads settings
- HTTP routes → JSON responses: formats response
- HTTP routes → Structured logger: logs request
- Response policy → Structured logger: logs query
- Structured logger → Chat logs: writes events
- Flask app → HTTP routes: registers routes
- Flask app → Runtime settings: reads settings
- Flask app → Structured logger: configures logging
- Chat interface → Chat interaction: loads script
- Chat interaction → Browser storage: persists chat
- Chat interaction → Chat interface: updates interface
- Evaluation runner → Evaluation cases: reads cases
- Evaluation runner → Response policy: evaluates responses