How maxi2771/luchat works
Project Type and Purpose
• This is a single‐page, full-stack web application built with Streamlit (Python) that provides an interactive chatbot interface.
• It uses the Groq language‐model API (external service) to power conversational AI (Ludmi) and supports features like model selection, history display, and conversation reset.
File Structure
• .streamlit/config.toml: holds Groq API token (secrets management).
• index.py: main application logic and UI definition (Streamlit “frontend” and “backend” live in one file).
• requirements.txt: lists dependencies (streamlit, groq).
• README.md: project description, setup steps, technologies.
Readme Insights
• Streamlit serves both UI and server logic; there is no separate front‐end codebase (React/Angular).
• The app communicates over HTTP(S) to Groq’s API endpoint for generating chat completions.
• Users interact via a browser; the server runs locally or in the cloud.
Main Components and Relationships
a. User Browser (Client)
b. Streamlit App Server (index.py)
• UI Layer: input widgets, buttons, chat history display
• Business Logic Layer: processes user input, handles model selection, resets state
c. Groq External API
d. Configuration Store (.streamlit secrets)
e. (Optional) Static Assets Host (img folder)
Interactions:
1. User types a message in the browser.
2. Streamlit captures input in index.py.
3. Business logic constructs an API call (with groq_api token).
4. Streamlit (server) sends HTTP request to Groq endpoint.
5. Groq returns LLM-generated response.
6. Streamlit updates chat history and renders response in the browser.
Architectural Patterns and Design Principles
• Single‐page server‐driven UI (Streamlit).
• Clear separation of concerns within index.py: UI definitions vs. API interaction and state management.
• Externalizing secrets/configuration (12-factor app).
• External API integration for LLM functionality.
• Browser UI
• Streamlit Server (split into UI module and Logic module)
• Groq API Service
• Config/Secrets store
• Static Assets
• Browser → Streamlit UI
• UI → Logic (model selection, chat history)
• Logic → Groq API (HTTP request)
• Groq API → Logic (response)
• Logic → UI (render)
• Blue: User‐facing components (Browser UI)
• Green: In‐process server components (Streamlit UI + Logic)
• Orange: External services (Groq API)
• Grey: Configuration and assets