Developer: Sabithulla
Domain-Chatbot is a fully local, domain-aware AI chatbot that changes its behavior based on the selected domain:
- 💬 Chat → Friendly, casual conversations
- 💻 Coding → Programming help with syntax highlighting
- 📚 Exam → Exam-oriented answers with structured points and formulas
The project runs 100% offline, uses Ollama for local LLMs, and supports real-time streaming, KaTeX math rendering, and code highlighting — all without any API keys.
Most chatbots treat every question the same.
Domain-Chatbot doesn’t.
- 💬 Chat mode → friendly, human-like conversation
- 💻 Coding mode → clean code + syntax highlighting
- 📘 Exam mode → structured answers + KaTeX formulas
All of this runs locally — no API keys, no internet dependency.
Explain black holes like I'm 10 years old
Write a Python program to check whether a number is palindrome
Derive Ohm’s law and explain with formula
- 🔁 Real-time streaming responses
- 🧠 Domain-based AI behavior
- 🧮 Automatic KaTeX rendering for formulas
- 🖍️ Syntax highlighting for code
- 💡 Centered suggestion prompts (one-time per domain)
- 🔒 Fully offline & privacy-friendly
- ⚡ Lightweight frontend (no frameworks)
| Domain | Behavior | Special Handling |
|---|---|---|
| Chat | Friendly & conversational | Natural responses |
| Coding | Developer-focused | Highlight.js for code |
| Exam | Exam-oriented | KaTeX for formulas |
Frontend (HTML + CSS + JavaScript)
↓
FastAPI Backend
↓
Ollama Local Models
The chatbot intelligently decides what should be rendered as math.
- Text inside
** **containing math symbols (= + - * / ^) → rendered using KaTeX - Text inside
** **without math symbols → rendered as bold text - Normal text remains unchanged
- R = V / I → KaTeX formula
- Resistance → Bold text
- Explanation: → Normal text
This avoids converting headings or explanations into formulas.
- Python 3.9+
- FastAPI
- Uvicorn
- Requests
- Ollama (Local LLM runtime)
- HTML
- CSS
- JavaScript
- KaTeX (Math rendering)
- Highlight.js (Code highlighting)
- qwen2.5:0.5b → Chat
- qwen2.5-coder:0.5b → Coding
- gemma:2b → Exam
Domain-Chatbot
├── backend
│ ├── main.py
│ ├── router.py
├── frontend
│ ├── index.html
├── assets
│ ├── chat.png
│ ├── coding.png
│ ├── exam.png
├── README.md
- Python 3.9 or above
- Ollama installed locally
- qwen2.5:0.5b
- qwen2.5-coder:0.5b
- gemma:2b
- fastapi
- uvicorn
- requests
- Start Ollama locally
- Run FastAPI backend
- Open
frontend/index.htmlin browser - Select a domain
- Use suggestion prompts or type your own query
- Watch responses stream live
Sabithulla
Built with curiosity, logic, and a focus on clean AI user experience.
If you found this project useful:
- ⭐ Star the repository
- 🍴 Fork it
- 🧠 Extend it with new domains
- Voice input and output
- Mobile-friendly UI
- More domains (Medical, Legal, Interview)
- Model selector in UI
This project can be released under the MIT License. You are free to use, modify, and distribute it.


