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