fix(ai): force enabled state in demo mode

Ensures the AI settings endpoint reports enabled=true and configured=true
when running in demo mode (PULSE_MOCK_MODE=true), even if no provider is
configured. This unlocks the frontend UI to allow interaction with the
mock AI assistant.
This commit is contained in:
rcourtman
2025-12-23 18:39:34 +00:00
parent 8666961201
commit 10047b2192
2 changed files with 9 additions and 2 deletions
+4
View File
@@ -931,6 +931,10 @@ func (s *Service) LoadConfig() error {
// IsEnabled returns true if AI is enabled and configured
func (s *Service) IsEnabled() bool {
// In demo mode, AI is always considered enabled (using mock backend)
if IsDemoMode() {
return true
}
s.mu.RLock()
defer s.mu.RUnlock()
return s.cfg != nil && s.cfg.Enabled && s.provider != nil
+5 -2
View File
@@ -244,8 +244,11 @@ func (h *AISettingsHandler) HandleGetAISettings(w http.ResponseWriter, r *http.R
authMethod = string(config.AuthMethodAPIKey)
}
// Determine if running in demo mode
isDemo := strings.EqualFold(os.Getenv("PULSE_MOCK_MODE"), "true")
response := AISettingsResponse{
Enabled: settings.Enabled,
Enabled: settings.Enabled || isDemo,
Provider: settings.Provider,
APIKeySet: settings.APIKey != "",
Model: settings.GetModel(),
@@ -253,7 +256,7 @@ func (h *AISettingsHandler) HandleGetAISettings(w http.ResponseWriter, r *http.R
PatrolModel: settings.PatrolModel,
AutoFixModel: settings.AutoFixModel,
BaseURL: settings.BaseURL,
Configured: settings.IsConfigured(),
Configured: settings.IsConfigured() || isDemo,
AutonomousMode: settings.AutonomousMode,
CustomContext: settings.CustomContext,
AuthMethod: authMethod,