Compare commits

...

2 Commits

Author SHA1 Message Date
hobokenchicken e56a284415 docs: update TODO.md with Ollama provider completion
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled
- Mark Ollama as completed provider implementation
- Add Ollama-specific feature checklist
- Update provider list in completed tasks
2026-04-06 14:46:32 -04:00
hobokenchicken cbc9eeb453 fix(server): add Ollama model detection and registry support
- Add Ollama to allowed providers in model list endpoint
- Add model pattern detection for Ollama models (glm-, qwen, gemma, llama, mistral, codellama)
- This fixes 500 errors when using Ollama models via /v1/chat/completions
2026-04-06 14:45:57 -04:00
2 changed files with 10 additions and 1 deletions
+7 -1
View File
@@ -5,7 +5,7 @@
- [x] Database schema & migrations (hardcoded in `db.go`) - [x] Database schema & migrations (hardcoded in `db.go`)
- [x] Configuration loader (Viper) - [x] Configuration loader (Viper)
- [x] Auth Middleware (scoped to `/v1`) - [x] Auth Middleware (scoped to `/v1`)
- [x] Basic Provider implementations (OpenAI, Gemini, DeepSeek, Grok) - [x] Basic Provider implementations (OpenAI, Gemini, DeepSeek, Grok, Ollama)
- [x] Streaming Support (SSE & Gemini custom streaming) - [x] Streaming Support (SSE & Gemini custom streaming)
- [x] Archive Rust files to `rust` branch - [x] Archive Rust files to `rust` branch
- [x] Clean root and set Go version as `main` - [x] Clean root and set Go version as `main`
@@ -47,6 +47,12 @@
- [x] Multimodal support - [x] Multimodal support
- [x] Accurate usage parsing (via OpenAI helper) - [x] Accurate usage parsing (via OpenAI helper)
### Ollama Provider
- [x] OpenAI-compatible API integration
- [x] Streaming support
- [x] Model pattern detection for routing
- [x] Zero cost calculation (local/free models)
## Infrastructure & Middleware ## Infrastructure & Middleware
- [ ] Implement Rate Limiting (`golang.org/x/time/rate`) - [ ] Implement Rate Limiting (`golang.org/x/time/rate`)
- [ ] Implement Circuit Breaker (`github.com/sony/gobreaker`) - [ ] Implement Circuit Breaker (`github.com/sony/gobreaker`)
+3
View File
@@ -252,6 +252,7 @@ func (s *Server) handleListModels(c *gin.Context) {
"deepseek": true, "deepseek": true,
"moonshot": true, "moonshot": true,
"xai": true, // Models from models.dev use 'xai' ID for Grok "xai": true, // Models from models.dev use 'xai' ID for Grok
"ollama": true,
} }
if s.registry != nil { if s.registry != nil {
@@ -294,6 +295,8 @@ func (s *Server) handleChatCompletions(c *gin.Context) {
providerName = "moonshot" providerName = "moonshot"
} else if strings.Contains(req.Model, "grok") { } else if strings.Contains(req.Model, "grok") {
providerName = "grok" providerName = "grok"
} else if strings.Contains(req.Model, "glm-") || strings.Contains(req.Model, "qwen") || strings.Contains(req.Model, "gemma") || strings.Contains(req.Model, "llama") || strings.Contains(req.Model, "mistral") || strings.Contains(req.Model, "codellama") {
providerName = "ollama"
} }
provider, ok := s.providers[providerName] provider, ok := s.providers[providerName]