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: include VMID in AI context to prevent incorrect references
rcourtman78c3434061c4
diff --git a/internal/ai/context/builder.go b/internal/ai/context/builder.goindex 913cf5fc5e..8549834cb7 100644--- a/internal/ai/context/builder.go+++ b/internal/ai/context/builder.go@@ -112,6 +112,7 @@ func (b *Builder) BuildForInfrastructure(state models.StateSnapshot) *Infrastructrends := b.computeGuestTrends(vm.ID)resourceCtx := FormatGuestForContext(vm.ID, vm.Name, vm.Node, "vm", vm.Status,+ vm.VMID,vm.CPU, vm.Memory.Usage, vm.Disk.Usage,vm.Uptime, vm.LastBackup, trends,)@@ -137,6 +138,7 @@ func (b *Builder) BuildForInfrastructure(state models.StateSnapshot) *InfrastrucresourceCtx := FormatGuestForContext(ct.ID, ct.Name, ct.Node, containerType, ct.Status,+ ct.VMID,ct.CPU, ct.Memory.Usage, ct.Disk.Usage,ct.Uptime, ct.LastBackup, trends,)diff --git a/internal/ai/context/formatter.go b/internal/ai/context/formatter.goindex 18d189e0e4..4e91cd4866 100644--- a/internal/ai/context/formatter.go+++ b/internal/ai/context/formatter.go@@ -15,8 +15,11 @@ func FormatResourceContext(ctx ResourceContext) string {// Header with resource identitytypeLabel := formatResourceType(ctx.ResourceType)sb.WriteString(fmt.Sprintf("### %s: %s", typeLabel, ctx.ResourceName))+ if ctx.VMID > 0 {+ sb.WriteString(fmt.Sprintf(" (VMID %d)", ctx.VMID))+ }if ctx.Node != "" && ctx.ResourceType != "node" {- sb.WriteString(fmt.Sprintf(" (on %s)", ctx.Node))+ sb.WriteString(fmt.Sprintf(" on %s", ctx.Node))}sb.WriteString("\n")@@ -471,6 +474,7 @@ func FormatNodeForContext(node models.Node, trends map[string]Trend) ResourceCon// Note: cpu is 0-1 ratio from Proxmox API, memUsage and diskUsage are already 0-100 percentagesfunc FormatGuestForContext(id, name, node, guestType, status string,+ vmid int,cpu, memUsage, diskUsage float64,uptime int64,lastBackup time.Time,@@ -481,6 +485,7 @@ func FormatGuestForContext(ResourceType: guestType,ResourceName: name,Node: node,+ VMID: vmid,CurrentCPU: cpu * 100, // Convert from 0-1 to percentageCurrentMemory: memUsage, // Already 0-100 percentage from Memory.UsageCurrentDisk: diskUsage, // Already 0-100 percentage from Disk.Usagediff --git a/internal/ai/context/formatter_test.go b/internal/ai/context/formatter_test.goindex 67d35fdf05..2dc105af84 100644--- a/internal/ai/context/formatter_test.go+++ b/internal/ai/context/formatter_test.go@@ -385,6 +385,7 @@ func TestFormatGuestForContext(t *testing.T) {"pve-1","vm","running",+ 100, // VMID0.35, // CPU (0-1)65.0, // Memory (0-100)45.0, // Disk (0-100)diff --git a/internal/ai/context/types.go b/internal/ai/context/types.goindex 36ceef1a2c..d49e5b2ea4 100644--- a/internal/ai/context/types.go+++ b/internal/ai/context/types.go@@ -116,6 +116,7 @@ type ResourceContext struct {ResourceType string // "node", "vm", "container", "oci_container", "storage", "docker_host"ResourceName stringNode string // Parent node (for guests)+ VMID int // Proxmox VMID for VMs/containers (0 if not applicable)// Current state (point-in-time)CurrentCPU float64