How prottoy-bhattacharyya/chat-web-app works
Project Type & Purpose
• This is a full-stack Python web application (likely Flask) providing real-time chat between users plus an AI assistant powered by the local meta_llama_AI.py module.
• It persists users, friend relationships, and chat history in a MySQL database.
• It serves HTML templates for UI and static assets (CSS, JS, images).
File-Structure Analysis
• Top-level “app.py” contains the Flask (or uv/uvicorn) application entry point and route/controller logic.
• “meta_llama_AI.py” encapsulates the AI assistant integration.
• “DBconfig.py” holds the MySQL connection logic.
• “templates/” holds Jinja2 HTML views (login, chat, profile, AI chat, etc.).
• “static/” holds CSS, JS, images for the frontend.
Key Components
a. Frontend (Web Clients)
• Browser instances on user devices
• Static assets: CSS (front_page.css, login.css), JS (showpass.js)
b. Web Server / API Layer
• app.py: HTTP routes for auth, chat pages, friend operations
• WebSocket or long-polling endpoint for “real-time” messaging (if used)
• AI-chat endpoint invoking meta_llama_AI.py
c. AI Assistant
• meta_llama_AI.py module
• (Optionally) underlying Llama weights or external AI process
d. Database
• MySQL server
• DBconfig.py managing connections
• Tables: users, friends, messages, AI_history
Relationships & Data Flows
• Browser → HTTP(S) → Flask app (app.py) → Templates/Static → Browser
• Browser ↔ WebSocket (or AJAX polling) ↔ Flask app → MySQL
• Flask app → AI module → AI response → Flask app → Browser
• Flask app → MySQL (via DBconfig.py) for CRUD on users/messages
Architectural Patterns & Principles
• MVC-style separation:
• Models: MySQL + DBconfig.py
• Views: Jinja2 templates under /templates
• Controllers: Route handlers in app.py
• Single-process monolith—can scale by separating AI engine or DB as microservices
• Configuration externalized in DBconfig.py and environment variables