How priyanshsaxena01/booking-bot works
Project Type and Purpose
• This is a full-stack Flask web application (“Cityscope – AI Powered Trip Planner Chatbot”) that combines:
• A frontend chat interface (HTML/CSS/JS)
• A Flask backend (app.py)
• An external LLM service (Together AI)
• A dynamic booking summary page
File Structure
• Top-level files:
• app.py – the Flask server entry point, defines routes and session logic
• requirements.txt – Python dependencies (Flask, together-python, python-dotenv, etc.)
• .devcontainer/ – Codespaces container config
• Frontend resources:
• static/style.css – styling for both chat and summary pages
• templates/chat.html – main chat UI with JS to POST messages
• templates/booking.html – trip summary page with pre-filled form fields via URL params
Key Architecture Insights from README
• Conversational flow powered by LLM via Together AI API
• Server-side session storage for state management
• AJAX calls from the chat page to backend endpoints
• Redirect to booking page with URL query parameters
Main Components & Their Relationships
a. Components
1. Client Browser
2. Chat UI (JS, HTML/CSS)
3. Flask App
4. Session Store (Flask built-in session)
5. Together AI LLM Service (external API)
6. Booking Summary Page (Jinja2 template)
b. Interactions
1. Browser loads /chat → Flask serves chat.html + style.css
2. User types message → JS sends POST /api/chat to Flask
3. Flask retrieves session state, forwards message to Together AI API
4. Together AI returns response JSON → Flask updates session state
5. Flask sends chatbot reply back to JS → UI updates chat window
6. When all booking data gathered → Flask builds redirect URL with query params
7. Browser navigates to /booking?... → Flask renders booking.html using Jinja2
c. Architectural Patterns
• MVC-style separation:
– View: HTML templates & static assets
– Controller: Flask routes & business logic
– Model (light): session data representing conversation state
• Client-server API calls (AJAX)
• External service integration for AI inference
d. Key Technologies
• Flask (HTTP routing, sessions)
• Jinja2 (templating)
• Vanilla JavaScript (fetch/AJAX)
• Together-python SDK for LLM
• CSS3 & Google Fonts (UI styling)