This file provides guidance to WARP (warp.dev) when working with code in this repository.
OllamaMax is a web-based chat interface for interacting with Ollama LLM models. It's a Go backend with vanilla JavaScript/HTML/CSS frontend that provides:
- ChatGPT-inspired dark theme UI with VSCode-style syntax highlighting
- WebSocket real-time chat and HTTP REST API endpoints
- Dynamic model switching and automatic model pulling
- Markdown rendering with code block support
Tech Stack: Go (with gorilla/mux, gorilla/websocket, langchaingo), vanilla JavaScript, HTML, CSS. No web frameworks or Node.js.
- main.go: Monolithic server with all HTTP handlers, WebSocket logic, and LLM integration via langchaingo
- intermal/* (note: typo in dir name): Placeholder packages (currently empty stubs for future modularization)
api/: Future REST API handlersauth/: Future authentication middlewareconfig/: Future configuration managementdb/: Future database integrationollama/: Future Ollama client abstraction
- static/index.html: Main chat UI with model selector dropdown
- static/script.js: WebSocket client, markdown rendering (marked.js), syntax highlighting (highlight.js)
- static/styles.css: Dark theme styling
- Client connects via WebSocket (
/api/chat/ws) on page load - User selects model from dropdown and sends message
- Server validates model availability via
ollama listCLI - If model missing, offers to pull it via
resources/run_ollama.sh - Query processed through langchaingo → Ollama → response streamed back
- Frontend renders markdown with syntax highlighting
Build and run the server:
go run main.goServer starts on http://localhost:8888
Install dependencies:
go mod download
go mod tidyCheck for Ollama service:
ollama listPull a model manually:
ollama pull llama3.1:8bRun model interactively (CLI):
ollama run llama3.1:8bUse the provided shell scripts:
# Interactive menu for model selection
./resources/run_ollama.sh
# Automated install scripts for different use cases
./ollama_install_basic.sh # For average users/laptops
./ollama_install_general_purpose.sh # General purpose models
./ollam-linuxmac-optimized.sh # Linux/Mac optimizedView available API endpoints:
GET /→ Serve index.htmlGET /api→ API statusGET /api/models→ List available models (fromAVAILABLE_MODELSarray)GET /api/models/installed-models→ List installed Ollama modelsPOST /api/chat→ HTTP chat endpointGET /api/chat/ws→ WebSocket chat endpointPOST /api/models/pull→ Pull new modelGET /api/health→ Check if Ollama service is running
AVAILABLE_MODELSarray in main.go defines the model dropdown list- Default model:
ollama3:8b(set inDEFAULT_MODELconst) currentModelglobal variable tracks active model- Models auto-added to
AVAILABLE_MODELSif detected viaollama listbut not in predefined list
WebSocket/HTTP message format:
{
"message": "user query",
"model_name": "llama3.1:8b"
}Response format:
{
"response": "LLM response text",
"action": "pull:model-name" // Optional, triggers model pull prompt
}See TODO.md for planned work:
- Update README.md with new model categorization
- Redesign UI to match Grok-style interface (reference:
resources/images/Grok-Super-UI.png)- Replace "SuperGrok" with "OllamaMax"
- Use Ollama logo instead of Grok logo
- Go: Standard Go formatting (
gofmtapplied automatically) - JavaScript: ES6+ syntax, no transpilation
- No linting/formatting tools configured (no Makefile, no CI/CD)
- Uses
langchaingolibrary (github.com/tmc/langchaingo) for LLM calls - System template in
SystemTemplateconst instructs model to use markdown formatting - Temperature set to 0.7 for balanced creativity
- 60-second timeout on LLM calls
- Server port hardcoded to
8888inmain.go(constPORT) - WebSocket URL:
ws://localhost:8888/api/chat/ws - API URL:
http://localhost:8888/api/chat
Per TODO.md and install scripts, prioritize these model groupings:
- Coding & Software Engineering: qwen3-coder, deepseek-r1, glm-4.6, deepseek-v3.1
- Vision-Language & Multimodal: qwen3-vl
- General Chat & Reasoning: gpt-oss, qwen3, llama3.1
- Lightweight / Edge & Embeddings: gemma3, nomic-embed-text
When writing or modifying shell scripts in this repo (install/run scripts), follow these principles from user rules:
- Use POSIX-compatible Bash patterns
- Prefer built-ins over external commands
- Set
set -euo pipefailfor robustness - Quote all variables:
"$var" - Use functions for modularity
- Parallel execution for model downloads: use background jobs (
&) withwaitand job limits