How thaieaut-engineer/tri-tue-nhan-tao-ai- works
TourAI is a Flask tour-booking and management site with an AI travel-advice chatbot. Visitors browse tours or submit questions; the chat route manages conversation sessions and invokes the chatbot, which preprocesses questions, matches its knowledge and tour data, and can consult weather or web-search services. Users can book, review, and favorite tours; admins manage catalog, accounts, bookings, reviews, and AI knowledge. README documents continual learning and question harvesting, but excerpts do not show every runtime handoff, so some documented or unverified links are marked accordingly.
Main entry points: chatbot.py Chatbot engine · db.py MySQL database · app.py Flask app · chat_routes.py Chat routes
Components 24
Web entry and routes
- Flask app
app.py - Chat routes
routes/chat_routes.py - Tour routes
routes/tour_routes.py - Auth routes
routes/auth_routes.py - Admin routes
routes/admin_routes.py
Chatbot and AI
- Chatbot engine
ai/chatbot.py - Text preprocessing
ai/preprocess.py - Intent training
ai/train_model.py - Continual learning
ai/self_learning.py - QA harvesting
ai/qa_generator.py
Travel services
- Weather lookup
ai/weather_service.py - Directed web search
ai/web_search.py - Weather APIs
- Web sources
Accounts and engagement
- User accounts
models/user.py - Favorites
models/favorite.py
Persistence
- Tour catalog
models/tour.py - Bookings
models/booking.py - Reviews
models/review.py - Chat history
models/chat_history.py - Chat sessions
models/chat_session.py - QA knowledge
models/qa_data.py - MySQL database
database/db.py
Other components
- Visitor
Connections 41
- Visitor → Flask app: opens site
README.md - Flask app → Chat routes: registers
app.py - Flask app → Tour routes: registers
app.py - Flask app → Auth routes: registers
app.py - Flask app → Admin routes: registers
app.py - Chat routes → Chatbot engine: asks
routes/chat_routes.py - Chat routes → Chat sessions: manages sessions
routes/chat_routes.py - Chat routes → Chat history: reads and updates
routes/chat_routes.py - Chat routes → Continual learning: triggers learning
routes/chat_routes.py - Chatbot engine → Text preprocessing: normalizes text
ai/chatbot.py - Chatbot engine → Intent training: loads model
ai/chatbot.py - Chatbot engine → Tour catalog: loads tour data
ai/chatbot.py - Chatbot engine → QA knowledge: loads QA data
- Chatbot engine → Weather lookup: requests weather
ai/chatbot.py - Chatbot engine → Directed web search: searches web
ai/chatbot.py - Weather lookup → Weather APIs: queries
README.md - Directed web search → Web sources: searches
README.md - Tour routes → Tour catalog: retrieves tours
routes/tour_routes.py - Tour routes → Bookings: creates bookings
routes/tour_routes.py - Tour routes → Reviews: creates and reads reviews
routes/tour_routes.py - Tour routes → Favorites: toggles favorites
routes/tour_routes.py - Auth routes → User accounts: authenticates users
routes/auth_routes.py - Auth routes → Bookings: retrieves bookings
routes/auth_routes.py - Auth routes → Favorites: retrieves favorites
routes/auth_routes.py - Admin routes → Continual learning: manages learning
routes/admin_routes.py - Admin routes → Chatbot engine: reloads knowledge
routes/admin_routes.py - Admin routes → Tour catalog: manages tours
routes/admin_routes.py - Admin routes → QA knowledge: manages QA
routes/admin_routes.py - Continual learning → Chat history: scans history
ai/self_learning.py - Continual learning → QA knowledge: adds learned QA
ai/self_learning.py - QA harvesting → Chatbot engine: harvests answers
README.md - QA harvesting → QA knowledge: stores harvested QA
ai/qa_generator.py - QA harvesting → Intent training: triggers retraining
README.md - Tour catalog → MySQL database: reads and writes
models/tour.py - Bookings → MySQL database: reads and writes
models/booking.py - Reviews → MySQL database: reads and writes
models/review.py - User accounts → MySQL database: reads and writes
models/user.py - Favorites → MySQL database: reads and writes
models/favorite.py - Chat history → MySQL database: reads and writes
models/chat_history.py - Chat sessions → MySQL database: reads and writes
models/chat_session.py - QA knowledge → MySQL database: reads and writes
models/qa_data.py