Web Interface Guide¶
Quick Start¶
Launch the web interface with one command:
Then open your browser to: http://localhost:7000
Features¶
Modern Chat UI¶
- Clean, responsive design that works on desktop and mobile
- Real-time message updates
- Typing indicators while the AI is responding
- Auto-scrolling to latest messages
- Textarea auto-resize
Model Selector¶
- Dropdown in the header lists all models installed in Ollama
- Switch models per-message — no restart required
- Defaults to
qwen3:8bwhen available; falls back to the first installed model
Session Management¶
- Sidebar showing all your conversation sessions
- Click any session to load and continue that conversation
- Create new sessions with custom names
- See message count and last activity time for each session
Search Functionality¶
- Global search across all conversations
- Click the search icon in the header
- Search results show matching messages with context
- Click any result to jump to that session
Keyboard Shortcuts¶
- Enter: Send message
- Shift+Enter: New line in message
Architecture¶
Backend (Flask)¶
src/web_app.py- Main Flask application- RESTful API endpoints for all chat operations
- Session management with Flask sessions
- Integrates with
src/chatbot_agent.py
Frontend¶
templates/chat.html- Main HTML templatestatic/css/style.css- Modern CSS stylingstatic/js/chat.js- JavaScript for interactivity
API Endpoints¶
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main chat interface |
/api/models |
GET | List installed Ollama models |
/api/sessions |
GET | List all sessions |
/api/sessions |
POST | Create new session |
/api/sessions/<id> |
GET | Load specific session |
/api/chat |
POST | Send message and get response (accepts optional model field) |
/api/history |
GET | Get current session history |
/api/search |
POST | Search all messages |
/benchmarks |
GET | Benchmark Reports UI |
/api/benchmarks/runs |
GET | List all benchmark runs with summary stats |
/api/benchmarks/runs/<run_id> |
GET | Case-level results for a specific run |
Customization¶
Change Colors¶
Edit static/css/style.css and modify the CSS variables:
:root {
--primary-color: #667eea; /* Main theme color */
--secondary-color: #764ba2; /* Gradient color */
--bg-main: #f7fafc; /* Background */
/* ... more variables ... */
}
Change Port¶
Edit src/web_app.py line 200:
Add Authentication¶
Add Flask-Login or similar to protect the interface:
from flask_login import LoginManager, login_required
@app.route('/')
@login_required
def index():
return render_template('chat.html')
Enable HTTPS¶
Use a production WSGI server like Gunicorn with SSL:
Deployment¶
Local Network Access¶
The web server runs on 0.0.0.0:7000, making it accessible from other devices on your network.
Find your local IP:
Production Deployment¶
For production use, consider:
-
Gunicorn (Production WSGI server)
-
Nginx (Reverse proxy)
-
Docker (Containerization)
Environment Variables¶
Set FLASK_ENV=production for production deployments:
Troubleshooting¶
Port Already in Use¶
Change the port in src/web_app.py or kill the process using port 7000:
Ollama Not Responding¶
Make sure Ollama is running:
Database Locked¶
If you get database locked errors, make sure you're not running both the CLI and web interface simultaneously with the same database file. They use different databases by default:
- CLI: chatbot_memory.db
- Web: web_chatbot.db
Security Notes¶
⚠️ Important for production:
-
Change the secret key in
src/web_app.py: -
Add authentication if exposing to the internet
- Use HTTPS in production
- Set proper CORS policies if needed
- Implement rate limiting to prevent abuse
Browser Compatibility¶
Tested and working on: - ✅ Chrome/Edge (latest) - ✅ Firefox (latest) - ✅ Safari (latest) - ✅ Mobile browsers (iOS Safari, Chrome Android)
Requires JavaScript enabled.