https://github.com/malgorath/chatbot
Jquery/Flask Socketio Broadcast Chat system
https://github.com/malgorath/chatbot
flask jquery python
Last synced: 2 months ago
JSON representation
Jquery/Flask Socketio Broadcast Chat system
- Host: GitHub
- URL: https://github.com/malgorath/chatbot
- Owner: malgorath
- Created: 2023-09-20T13:35:39.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-22T15:18:39.000Z (almost 3 years ago)
- Last Synced: 2025-09-03T13:44:07.891Z (10 months ago)
- Topics: flask, jquery, python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chatbot – Ollama-backed Web UI
A lightweight chat interface built with Python/Flask that connects to a locally-running Ollama server. Inspired by Open WebUI — models are configured via JSON files and selected from the sidebar at runtime.
## Features
- **Multi-model support** — add or swap models by dropping a `.cfg` file into `models/`, no code changes needed
- **Clean chat UI** — dark-themed interface with a sidebar model selector
- **Fully local** — all inference runs through your own Ollama server, nothing leaves your machine
- **Tested** — full pytest suite covering config loading, the Ollama client, and all API routes
## Tech Stack
| Layer | Technology |
|---|---|
| Backend | Python / Flask |
| LLM Integration | Ollama (`/api/chat`) |
| Frontend | HTML5, CSS3, JavaScript |
| Tests | pytest, pytest-cov |
## Requirements
- Python 3.10+
- [Ollama](https://ollama.ai) running locally with at least one model pulled
- `pip install -r requirements.txt`
## Setup
```bash
git clone https://github.com/malgorath/chatbot.git
cd chatbot
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
Edit `models/*.cfg` to point to your Ollama host and preferred model. The default config targets `http://192.168.1.3:11434` with `llama3.2:3b`.
## Running
```bash
python app.py
```
Open `http://localhost:5000` — select a model from the sidebar and start chatting.
## Tests
```bash
pytest
pytest --cov=. # with coverage
```
## Architecture
```
app.py # Flask routes (GET /, GET /api/models, POST /api/chat)
ollama_client.py # Ollama API wrapper with error handling
models_config.py # Parses models/*.cfg into typed ModelConfig objects
templates/chat.html # Chat UI template
static/css/chat.css # Styles
static/js/chat.js # Frontend behaviour
```
## License
MIT