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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Clean up Assistant provider error messages
rcourtman6ba21c7a2b46
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 6d0264915b..7a88952e5d 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -62,6 +62,14 @@ runtime cost control, and shared AI transport surfaces.the Ollama `keep_alive` request field. An empty configured value meansPulse omits `keep_alive` so the Ollama server default applies.3. Add or change Pulse Assistant request flow through `internal/api/ai_handler.go`, `frontend-modern/src/api/ai.ts`, and `frontend-modern/src/api/aiChat.ts`+ Assistant stream provider failures emitted through chat must be classified+ in `internal/ai/chat` before callback events reach the frontend. Endpoint+ configuration/URL errors, provider reachability/transport failures, auth,+ quota/billing, rate-limit, timeout, and cancellation states must render as+ operator-facing Settings or retry guidance. Raw Go transport strings,+ provider JSON bodies, request URLs, request methods, dashboard links, and+ key-management links must not be streamed or persisted as chat-visible+ assistant output.4. Add or change Patrol, alert-analysis, or remediation transport through `internal/api/ai_handlers.go`, `internal/api/ai_intelligence_handlers.go`, and `frontend-modern/src/api/patrol.ts`Provider preflight diagnostics returned from `internal/api/ai_handlers.go`must reuse the Patrol runtime failure classifier in `internal/ai/` anddiff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.goindex c2ea4808c1..db37e9bcd7 100644--- a/internal/ai/chat/agentic.go+++ b/internal/ai/chat/agentic.go@@ -115,6 +115,10 @@ func sanitizeProviderStreamErrorForUser(msg string) string {strings.Contains(lower, "timed out"),strings.Contains(lower, "deadline exceeded"):return "AI response timed out before completion. Please retry."+ case isProviderEndpointConfigurationError(lower):+ return "The AI provider endpoint is not configured correctly. Check the selected provider URL in Settings, then retry."+ case isProviderTransportError(lower):+ return "Pulse could not reach the AI provider endpoint. Check the selected provider URL and network connection, then retry."case strings.Contains(lower, "402"),strings.Contains(lower, "more credits"),strings.Contains(lower, "insufficient"),@@ -141,6 +145,28 @@ func sanitizeProviderStreamErrorForUser(msg string) string {return "AI response stream interrupted: " + cleaned}+func isProviderEndpointConfigurationError(lower string) bool {+ return strings.Contains(lower, `post ""`) ||+ strings.Contains(lower, `get ""`) ||+ strings.Contains(lower, "unsupported protocol scheme") ||+ strings.Contains(lower, "missing protocol scheme") ||+ strings.Contains(lower, "no host in request url") ||+ strings.Contains(lower, "invalid url") ||+ strings.Contains(lower, "failed to create request")+}++func isProviderTransportError(lower string) bool {+ return strings.Contains(lower, "connection refused") ||+ strings.Contains(lower, "connection reset") ||+ strings.Contains(lower, "dial tcp") ||+ strings.Contains(lower, "no such host") ||+ strings.Contains(lower, "network is unreachable") ||+ strings.Contains(lower, "proxyconnect") ||+ strings.Contains(lower, "tls handshake") ||+ strings.Contains(lower, "certificate") ||+ strings.Contains(lower, "x509")+}+// stripProviderErrorPayload removes any embedded JSON body or URL so raw// provider payloads and links never surface in the chat, keeping just the// leading human-readable summary (e.g. "API error (500)").diff --git a/internal/ai/chat/agentic_error_message_test.go b/internal/ai/chat/agentic_error_message_test.goindex e9977f8f6c..7d7ab89a47 100644--- a/internal/ai/chat/agentic_error_message_test.go+++ b/internal/ai/chat/agentic_error_message_test.go@@ -40,6 +40,24 @@ func TestSanitizeProviderStreamErrorForUser(t *testing.T) {in: "context deadline exceeded",wantContain: "timed out",},+ {+ name: "empty provider endpoint",+ in: `request failed: Post "": unsupported protocol scheme ""`,+ wantContain: "endpoint is not configured correctly",+ wantAbsent: []string{`post`, `request failed`, `unsupported protocol`, `""`},+ },+ {+ name: "malformed provider endpoint",+ in: `failed to create request: parse "://bad": missing protocol scheme`,+ wantContain: "endpoint is not configured correctly",+ wantAbsent: []string{`failed to create request`, `missing protocol`, `://bad`},+ },+ {+ name: "provider endpoint unreachable",+ in: `request failed: Post "https://api.example.invalid/v1/chat/completions": dial tcp: lookup api.example.invalid: no such host`,+ wantContain: "could not reach",+ wantAbsent: []string{`post`, `request failed`, `https://`, `dial tcp`, `no such host`},+ },{name: "canceled",in: "context canceled",diff --git a/internal/ai/chat/service.go b/internal/ai/chat/service.goindex 5515ab6775..d1d9ce4a4a 100644--- a/internal/ai/chat/service.go+++ b/internal/ai/chat/service.go@@ -2280,7 +2280,7 @@ func (s *Service) createProviderForModel(modelStr string) (providers.StreamingPrif s.cfg.DeepSeekAPIKey == "" {return nil, fmt.Errorf("DeepSeek API key not configured")}- return providers.NewOpenAIClient(s.cfg.DeepSeekAPIKey, modelName, "https://api.deepseek.com", timeout), nil+ return providers.NewOpenAIClient(s.cfg.DeepSeekAPIKey, modelName, s.cfg.GetBaseURLForProvider(config.AIProviderDeepSeek), timeout), nilcase "gemini":if s.cfg.GeminiAPIKey == "" {return nil, fmt.Errorf("Gemini API key not configured")diff --git a/internal/ai/providers/openai_test.go b/internal/ai/providers/openai_test.goindex 6c6d48cb81..f5daf5fdaa 100644--- a/internal/ai/providers/openai_test.go+++ b/internal/ai/providers/openai_test.go@@ -581,6 +581,11 @@ func TestOpenAIClient_Configuration(t *testing.T) {baseURL: "https://openrouter.ai/api/v1",expected: "https://openrouter.ai/api/v1/chat/completions",},+ {+ name: "DeepSeek Default Full URL",+ baseURL: "https://api.deepseek.com/chat/completions",+ expected: "https://api.deepseek.com/chat/completions",+ },{name: "Root URL",baseURL: "https://my-local-llm:8080",@@ -592,6 +597,7 @@ func TestOpenAIClient_Configuration(t *testing.T) {t.Run(tt.name, func(t *testing.T) {client := NewOpenAIClient("key", "model", tt.baseURL, 0)assert.NotNil(t, client)+ assert.Equal(t, tt.expected, client.baseURL)})}}