PFE Master · Hotel AI Chatbot
Conversational assistant for
Holiday Beach Djerba ★★★★
A full-stack AI chatbot embedded in the hotel's web interface. Handles reservations, services, and guest inquiries using Google Gemini Flash — with a smart fallback system when the AI is unavailable.
Layer 01 — Frontend
React + Vite chatbot widget
Floating chat button that expands into a full conversation UI. Manages message state, scroll behavior, and quick reply buttons. Communicates with the Flask API via Axios POST requests.
React 18 · Vite · Axios
Layer 02 — Backend
Flask REST API + Brain class
Flask exposes two endpoints: POST /api/chat for conversation and GET /api/health for status. The Brain class decides whether to call Gemini AI or use the smart keyword-based fallback, and reads hotel reservation counts from MySQL.
Flask · Flask-CORS · Python
Layer 03 — AI
Google Gemini Flash
Hotel-specific prompt feeds each user message to Gemini with the hotel's identity context. Responds in 1–2 natural sentences. API key loaded from .env. If Gemini fails, the smart fallback handles common intents (booking, hours, contact) without any downtime.
Gemini Flash · dotenv
Layer 04 — Database
MySQL — hotel_reservations
MySQL database stores hotel reservations. The Brain class queries reservation counts to enrich booking responses. Connection managed securely via environment variables.
MySQL connector · Python
Layer 05 — Resilience
Smart fallback system
If Gemini is unavailable or the API key is missing, the chatbot switches to a keyword-matching fallback — detecting greetings, booking intent, and contact requests — ensuring zero downtime for hotel guests.
Fallback · keyword matching
Delivery
Full-stack production-ready
React frontend served via Vite, Flask backend running on port 5000 with CORS enabled for web embedding. Easily deployable on any hotel website as an embeddable widget.
delivered