refactor: Remove 'enabled' field from AgentConfig and related components
- Removed the 'enabled' field from the AgentConfig interface and its usage in AgentSettings and tenant handler. - Updated related validation logic to ensure consistency without the 'enabled' parameter. - Streamlined agent configuration handling for improved clarity and maintainability.
This commit is contained in:
@@ -24,7 +24,6 @@ export interface PlaceholderDefinition {
|
||||
}
|
||||
|
||||
export interface AgentConfig {
|
||||
enabled: boolean
|
||||
max_iterations: number
|
||||
reflection_enabled: boolean
|
||||
allowed_tools: string[]
|
||||
|
||||
@@ -821,7 +821,6 @@ const isAgentReady = computed(() => {
|
||||
})
|
||||
|
||||
const buildAgentConfigPayload = (overrides: Partial<AgentConfig> = {}): AgentConfig => ({
|
||||
enabled: isAgentReady.value,
|
||||
max_iterations: localMaxIterations.value,
|
||||
reflection_enabled: false,
|
||||
allowed_tools: localAllowedTools.value,
|
||||
|
||||
@@ -233,7 +233,6 @@ func (h *TenantHandler) ListTenants(c *gin.Context) {
|
||||
|
||||
// AgentConfigRequest represents the request body for updating agent configuration
|
||||
type AgentConfigRequest struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
MaxIterations int `json:"max_iterations"`
|
||||
ReflectionEnabled bool `json:"reflection_enabled"`
|
||||
AllowedTools []string `json:"allowed_tools"`
|
||||
@@ -311,7 +310,6 @@ func (h *TenantHandler) GetTenantAgentConfig(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"enabled": tenant.AgentConfig.Enabled,
|
||||
"max_iterations": tenant.AgentConfig.MaxIterations,
|
||||
"reflection_enabled": tenant.AgentConfig.ReflectionEnabled,
|
||||
"allowed_tools": tenant.AgentConfig.AllowedTools,
|
||||
@@ -338,19 +336,13 @@ func (h *TenantHandler) updateTenantAgentConfigInternal(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Validate configuration
|
||||
if req.Enabled {
|
||||
if req.MaxIterations <= 0 || req.MaxIterations > 30 {
|
||||
c.Error(errors.NewAgentInvalidMaxIterationsError())
|
||||
return
|
||||
}
|
||||
if req.Temperature < 0 || req.Temperature > 2 {
|
||||
c.Error(errors.NewAgentInvalidTemperatureError())
|
||||
return
|
||||
}
|
||||
if len(req.AllowedTools) == 0 {
|
||||
c.Error(errors.NewAgentMissingAllowedToolsError())
|
||||
return
|
||||
}
|
||||
if req.MaxIterations <= 0 || req.MaxIterations > 30 {
|
||||
c.Error(errors.NewAgentInvalidMaxIterationsError())
|
||||
return
|
||||
}
|
||||
if req.Temperature < 0 || req.Temperature > 2 {
|
||||
c.Error(errors.NewAgentInvalidTemperatureError())
|
||||
return
|
||||
}
|
||||
|
||||
// Get existing tenant
|
||||
@@ -365,7 +357,6 @@ func (h *TenantHandler) updateTenantAgentConfigInternal(c *gin.Context) {
|
||||
}
|
||||
|
||||
tenant.AgentConfig = &types.AgentConfig{
|
||||
Enabled: req.Enabled,
|
||||
MaxIterations: req.MaxIterations,
|
||||
ReflectionEnabled: req.ReflectionEnabled,
|
||||
AllowedTools: req.AllowedTools,
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
// AgentConfig represents the full agent configuration (used at tenant level and runtime)
|
||||
// This includes all configuration parameters for agent execution
|
||||
type AgentConfig struct {
|
||||
Enabled bool `json:"enabled"` // Whether agent mode is enabled
|
||||
MaxIterations int `json:"max_iterations"` // Maximum number of ReAct iterations
|
||||
ReflectionEnabled bool `json:"reflection_enabled"` // Whether to enable reflection
|
||||
AllowedTools []string `json:"allowed_tools"` // List of allowed tool names
|
||||
|
||||
Reference in New Issue
Block a user