A full-stack AI chat assistant that runs entirely on your own machine. A React frontend talks to a Django REST backend, which runs a LangGraph agent powered by a local LLM through Ollama.
| Layer | Technology |
|---|---|
| Frontend | React (Vite), axios, react-markdown |
| Backend | Python, Django, Django REST Framework |
| Agent | LangGraph + LangChain |
| LLM | Ollama (default model: llama3.1) |
| Tooling | uv (Python environments), Docker Compose |
- Multiple conversations with a sidebar (create, switch, delete)
- Conversation history sent to the agent on every message, so it keeps context
- Auto-generated conversation titles
- Markdown rendering for assistant replies
- Backend-offline indicator
- Switchable LLM provider (Ollama locally, Groq optionally) via environment variable
ChatBot/
├── Backend/
│ ├── config/ # Django project settings and URLs
│ ├── chat/ # Models, serializers, views, URLs
│ │ └── agent/ # LangGraph graph and runner
│ ├── Dockerfile
│ ├── manage.py
│ └── pyproject.toml
├── Frontend/
│ ├── src/
│ │ ├── api/ # axios client and endpoint functions
│ │ └── components/ # Sidebar, ChatWindow, MessageBubble, MessageInput
│ ├── Dockerfile
│ └── package.json
├── docker-compose.yml
└── README.md
recording2_squished.1.1.mp4
Requirements: Docker Desktop
git clone https://github.com/1rishu0/Chatbot
cd ChatBot
docker compose up --buildIn a second terminal, pull the model once (about 4-5 GB):
docker compose exec ollama ollama pull llama3.1Then open http://localhost:5173.
Useful commands:
docker compose up -d # run in the background
docker compose logs -f backend # follow backend logs
docker compose down # stop (data is kept)
docker compose down -v # stop and delete all data and modelsOllama in Docker runs on CPU by default, so replies can be slow. NVIDIA users can enable GPU passthrough in
docker-compose.yml; others can run Ollama natively and pointOLLAMA_BASE_URLathttp://host.docker.internal:11434.
Requirements: Python 3.12+, uv, Node.js 20+, Ollama
ollama pull llama3.1
ollama servecd Backend
cp .env.example .env # on Windows: copy .env.example .env
uv sync
uv run python manage.py migrate
uv run python manage.py runserverThe API is now at http://127.0.0.1:8000/api/.
cd Frontend
npm install
npm run devOpen http://localhost:5173.
Backend environment variables (see Backend/.env.example):
| Variable | Default | Description |
|---|---|---|
LLM_PROVIDER |
ollama |
ollama or groq |
OLLAMA_MODEL |
llama3.1 |
Model name pulled in Ollama |
OLLAMA_BASE_URL |
http://localhost:11434 |
Where the Ollama server is reachable |
GROQ_API_KEY |
none | Required only when using Groq |
GROQ_MODEL |
llama-3.1-8b-instant |
Groq model name |
Frontend environment variable:
| Variable | Default | Description |
|---|---|---|
VITE_API_BASE_URL |
http://127.0.0.1:8000/api |
Backend API base URL |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health/ |
Health check |
| GET | /api/conversations/ |
List conversations |
| POST | /api/conversations/ |
Create a conversation |
| GET | /api/conversations/{id}/ |
Get a conversation with messages |
| PATCH | /api/conversations/{id}/ |
Rename a conversation |
| DELETE | /api/conversations/{id}/ |
Delete a conversation |
| POST | /api/conversations/{id}/send_message/ |
Send a message, get the reply |
Example:
curl -X POST http://127.0.0.1:8000/api/conversations/<id>/send_message/ \
-H "Content-Type: application/json" \
-d '{"content": "What is LangGraph in one sentence?"}'- "Could not reach the local model": make sure Ollama is running and the model is pulled (
ollama list). - Frontend shows "Backend unreachable": check that Django is running and that
CORS_ALLOWED_ORIGINSincludeshttp://localhost:5173. - Slow replies: local models on CPU are slow; try a smaller model (for example
llama3.2:3b) and setOLLAMA_MODELaccordingly.
- Tools for the agent (calculator, web search, document lookup)
- Streaming replies
- User authentication