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
fix(ai): serialize linkedVmId/linkedContainerId and harden mention status (#1252)
rcourtman1170da6a57b0
diff --git a/frontend-modern/src/components/AI/Chat/MentionAutocomplete.tsx b/frontend-modern/src/components/AI/Chat/MentionAutocomplete.tsxindex ad9db32aca..c09a58c396 100644--- a/frontend-modern/src/components/AI/Chat/MentionAutocomplete.tsx+++ b/frontend-modern/src/components/AI/Chat/MentionAutocomplete.tsx@@ -110,7 +110,7 @@ export function MentionAutocomplete(props: MentionAutocompleteProps) {// Get status colorconst getStatusColor = (status?: string) => {- switch (status?.toLowerCase()) {+ switch (status?.trim().toLowerCase()) {case 'running':case 'online':case 'healthy':diff --git a/frontend-modern/src/components/AI/Chat/mentionResources.ts b/frontend-modern/src/components/AI/Chat/mentionResources.tsindex 1a0ef1ae7a..f1bfd7dbbb 100644--- a/frontend-modern/src/components/AI/Chat/mentionResources.ts+++ b/frontend-modern/src/components/AI/Chat/mentionResources.ts@@ -253,7 +253,7 @@ export function buildMentionResources(state: MentionStateSubset): MentionResourcid: `host:${host.id}`,name: hostName,type: 'host',- status: host.status,+ status: host.status || 'online',},aliases,);diff --git a/internal/models/converters.go b/internal/models/converters.goindex 49ba792e00..974d3c26a2 100644--- a/internal/models/converters.go+++ b/internal/models/converters.go@@ -462,28 +462,30 @@ func (r RemovedKubernetesCluster) ToFrontend() RemovedKubernetesClusterFrontend// ToFrontend converts a Host to HostFrontend.func (h Host) ToFrontend() HostFrontend {host := HostFrontend{- ID: h.ID,- Hostname: h.Hostname,- DisplayName: h.DisplayName,- Platform: h.Platform,- OSName: h.OSName,- OSVersion: h.OSVersion,- KernelVersion: h.KernelVersion,- Architecture: h.Architecture,- CPUCount: h.CPUCount,- CPUUsage: h.CPUUsage,- Status: h.Status,- UptimeSeconds: h.UptimeSeconds,- IntervalSeconds: h.IntervalSeconds,- AgentVersion: h.AgentVersion,- TokenID: h.TokenID,- TokenName: h.TokenName,- TokenHint: h.TokenHint,- Tags: append([]string(nil), h.Tags...),- LastSeen: h.LastSeen.Unix() * 1000,- CommandsEnabled: h.CommandsEnabled,- IsLegacy: h.IsLegacy,- LinkedNodeId: h.LinkedNodeID,+ ID: h.ID,+ Hostname: h.Hostname,+ DisplayName: h.DisplayName,+ Platform: h.Platform,+ OSName: h.OSName,+ OSVersion: h.OSVersion,+ KernelVersion: h.KernelVersion,+ Architecture: h.Architecture,+ CPUCount: h.CPUCount,+ CPUUsage: h.CPUUsage,+ Status: h.Status,+ UptimeSeconds: h.UptimeSeconds,+ IntervalSeconds: h.IntervalSeconds,+ AgentVersion: h.AgentVersion,+ TokenID: h.TokenID,+ TokenName: h.TokenName,+ TokenHint: h.TokenHint,+ Tags: append([]string(nil), h.Tags...),+ LastSeen: h.LastSeen.Unix() * 1000,+ CommandsEnabled: h.CommandsEnabled,+ IsLegacy: h.IsLegacy,+ LinkedNodeId: h.LinkedNodeID,+ LinkedVmId: h.LinkedVMID,+ LinkedContainerId: h.LinkedContainerID,}// Fall back to Hostname if DisplayName is emptydiff --git a/internal/models/converters_test.go b/internal/models/converters_test.goindex c9d52833c0..a4c7a9e6d7 100644--- a/internal/models/converters_test.go+++ b/internal/models/converters_test.go@@ -1080,9 +1080,11 @@ func TestHostToFrontend(t *testing.T) {Sensors: HostSensorSummary{TemperatureCelsius: map[string]float64{"cpu": 55.0},},- CommandsEnabled: true,- IsLegacy: false,- LinkedNodeID: "node-abc",+ CommandsEnabled: true,+ IsLegacy: false,+ LinkedNodeID: "node-abc",+ LinkedVMID: "vm-xyz",+ LinkedContainerID: "ct-456",}frontend := host.ToFrontend()@@ -1135,6 +1137,12 @@ func TestHostToFrontend(t *testing.T) {if frontend.LinkedNodeId != host.LinkedNodeID {t.Errorf("LinkedNodeId = %q, want %q", frontend.LinkedNodeId, host.LinkedNodeID)}+ if frontend.LinkedVmId != host.LinkedVMID {+ t.Errorf("LinkedVmId = %q, want %q", frontend.LinkedVmId, host.LinkedVMID)+ }+ if frontend.LinkedContainerId != host.LinkedContainerID {+ t.Errorf("LinkedContainerId = %q, want %q", frontend.LinkedContainerId, host.LinkedContainerID)+ }if frontend.TokenLastUsedAt == nil || *frontend.TokenLastUsedAt != tokenLastUsed.Unix()*1000 {t.Errorf("TokenLastUsedAt = %v, want %d", frontend.TokenLastUsedAt, tokenLastUsed.Unix()*1000)}diff --git a/internal/models/models_frontend.go b/internal/models/models_frontend.goindex 162185a032..87536eb069 100644--- a/internal/models/models_frontend.go+++ b/internal/models/models_frontend.go@@ -438,9 +438,11 @@ type HostFrontend struct {TokenHint string `json:"tokenHint,omitempty"`TokenLastUsedAt *int64 `json:"tokenLastUsedAt,omitempty"`Tags []string `json:"tags,omitempty"`- CommandsEnabled bool `json:"commandsEnabled,omitempty"` // Whether AI command execution is enabled- IsLegacy bool `json:"isLegacy,omitempty"` // True if using legacy agent protocol- LinkedNodeId string `json:"linkedNodeId,omitempty"` // ID of linked PVE node (if running on a node)+ CommandsEnabled bool `json:"commandsEnabled,omitempty"` // Whether AI command execution is enabled+ IsLegacy bool `json:"isLegacy,omitempty"` // True if using legacy agent protocol+ LinkedNodeId string `json:"linkedNodeId,omitempty"` // ID of linked PVE node (if running on a node)+ LinkedVmId string `json:"linkedVmId,omitempty"` // ID of linked VM (if running inside a VM)+ LinkedContainerId string `json:"linkedContainerId,omitempty"` // ID of linked container (if running inside a container)}// HostSensorSummaryFrontend mirrors HostSensorSummary with primitives for the frontend.