Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(ai): normalize Ollama base URL to prevent 405 errors

rcourtman8687d692428b
diff --git a/internal/ai/providers/ollama.go b/internal/ai/providers/ollama.go
index 645486df2b..f758680d21 100644
--- a/internal/ai/providers/ollama.go
+++ b/internal/ai/providers/ollama.go
@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
+ "strings"
"time"
)
@@ -22,6 +23,11 @@ func NewOllamaClient(model, baseURL string) *OllamaClient {
if baseURL == "" {
baseURL = "http://localhost:11434"
}
+ // Normalize the URL: strip trailing slashes and /api suffix
+ // Users sometimes enter http://host:11434/ or http://host:11434/api
+ baseURL = strings.TrimSuffix(baseURL, "/")
+ baseURL = strings.TrimSuffix(baseURL, "/api")
+ baseURL = strings.TrimSuffix(baseURL, "/") // In case it was /api/
return &OllamaClient{
model: model,
baseURL: baseURL,