From 301d400ccedd47b329f8cc6758676a24a5e48f4b Mon Sep 17 00:00:00 2001 From: wizardchen Date: Fri, 21 Nov 2025 14:32:28 +0800 Subject: [PATCH] refactor: Remove validation for 'enabled' field in agent configuration - Eliminated the check for the 'enabled' field in the ValidateConfig method of agentService. - Updated comments in session service to reflect the removal of the 'enabled' field from AgentConfig. - Streamlined agent configuration handling for improved clarity and maintainability. --- internal/application/service/agent_service.go | 4 ---- internal/application/service/session.go | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/application/service/agent_service.go b/internal/application/service/agent_service.go index 9d6314ff..ac5c0815 100644 --- a/internal/application/service/agent_service.go +++ b/internal/application/service/agent_service.go @@ -244,10 +244,6 @@ func (s *agentService) ValidateConfig(config *types.AgentConfig) error { return fmt.Errorf("config cannot be nil") } - if !config.Enabled { - return fmt.Errorf("agent is not enabled") - } - if config.MaxIterations <= 0 { config.MaxIterations = 5 // Default } diff --git a/internal/application/service/session.go b/internal/application/service/session.go index 302ad453..98e23ecf 100644 --- a/internal/application/service/session.go +++ b/internal/application/service/session.go @@ -880,9 +880,8 @@ func (s *sessionService) AgentQA(ctx context.Context, session *types.Session, qu // Create runtime AgentConfig by merging session and tenant configs // Tenant config provides the runtime parameters (MaxIterations, Temperature, Tools, Models) - // Session config provides Enabled and KnowledgeBases + // Session config provides KnowledgeBases agentConfig := &types.AgentConfig{ - Enabled: session.AgentConfig.AgentModeEnabled, MaxIterations: tenantInfo.AgentConfig.MaxIterations, ReflectionEnabled: tenantInfo.AgentConfig.ReflectionEnabled, AllowedTools: tenantInfo.AgentConfig.AllowedTools,