A simple web-based chatroom built with Flask, SQLite, and the Groq API (Llama 3.1).
- Flask backend with SQLite storage
- Groq API integration using the
openaiPython SDK - Vanilla JS & plain HTML frontend
- Real-time interaction with the bot without full page reloads
- Conversation history maintained for contextual LLM responses
- Simple CLI testing client via
requests
- Python 3.8+
- Groq API Key
-
Get a free Groq API Key
- Go to groq.com
- Sign up / Log in
- Go to the API Keys section
- The free tier does not require a credit card and provides generous usage limits on Llama 3.1!
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment
- Copy
.env.exampleto.env:cp .env.example .env
- Edit
.envand fill in your Groq API key:GROQ_API_KEY=gsk_your_api_key_here
- Copy
-
Start the Web Server
python web_server.py
The database (
chat.db) and its schema will be initialized automatically. The server will run on http://0.0.0.0:5000 in debug mode. -
Access the Web Interface
- Open your browser and navigate to http://localhost:5000
- Click "Join Chat" to start interacting!
-
Use the CLI Client (Optional)
- Start the server using the instructions above.
- Open a new terminal window / tab.
- Run the client script:
python client.py
- You can chat directly from the terminal!