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
Reuse the loaded AI config when restarting the service
rcourtmana6b773a85f1c
diff --git a/internal/api/ai_handler.go b/internal/api/ai_handler.goindex c08bd79c15..e469afaabd 100644--- a/internal/api/ai_handler.go+++ b/internal/api/ai_handler.go@@ -728,6 +728,12 @@ func (h *AIHandler) clearApprovalStore() {func (h *AIHandler) Start(ctx context.Context, monitor *monitoring.Monitor) error {log.Info().Msg("AIHandler.Start called")aiCfg := h.loadAIConfig(ctx)+ return h.startWithConfig(ctx, monitor, aiCfg)+}++// startWithConfig starts the AI service with an already-loaded config so callers+// such as Restart do not re-read (and risk racing) the config a second time.+func (h *AIHandler) startWithConfig(ctx context.Context, monitor *monitoring.Monitor, aiCfg *config.AIConfig) error {if aiCfg == nil {log.Info().Msg("AI config is nil, AI is disabled")return nil@@ -825,7 +831,7 @@ func (h *AIHandler) Restart(ctx context.Context) error {m, _ = mtm.GetMonitor("default")}- return h.Start(ctx, m)+ return h.startWithConfig(ctx, m, newCfg)}if !svc.IsRunning() {@@ -841,8 +847,8 @@ func (h *AIHandler) Restart(ctx context.Context) error {m, _ = mtm.GetMonitor("default")}- // Reuse start logic- return h.Start(ctx, m)+ // Reuse start logic with the already-loaded config (avoid a second load)+ return h.startWithConfig(ctx, m, newCfg)}if err := svc.Restart(ctx, newCfg); err != nil {