Refactor AI Agent configuration and workflow handling
- Removed runtime mode handling from AIAgentConfigWorkbench and related components. - Updated tests to reflect changes in AI Agent policy copy and configuration. - Changed terminology from "workflow" to "revision" in various components and API responses. - Simplified agent binding logic in channel editing. - Cleaned up unused variables and types related to runtime modes. - Updated localization files for consistency with new terminology.
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"agent-desk/internal/ai/workflow/dsl"
|
||||
"agent-desk/internal/models"
|
||||
"agent-desk/internal/pkg/enums"
|
||||
"agent-desk/internal/pkg/errorsx"
|
||||
"agent-desk/internal/repositories"
|
||||
@@ -18,11 +17,11 @@ type resolvedWorkflow struct {
|
||||
VersionID int64
|
||||
}
|
||||
|
||||
func resolveAgentWorkflow(aiAgent models.AIAgent) (resolvedWorkflow, error) {
|
||||
if aiAgent.WorkflowVersionID <= 0 {
|
||||
return resolvedWorkflow{}, errorsx.InvalidParam("AI Agent workflow is not published; publish a workflow version before enabling automatic replies")
|
||||
func resolveWorkflowVersion(workflowVersionID int64) (resolvedWorkflow, error) {
|
||||
if workflowVersionID <= 0 {
|
||||
return resolvedWorkflow{}, errorsx.InvalidParam("workflow version is required")
|
||||
}
|
||||
version := repositories.AIWorkflowVersionRepository.Get(sqls.DB(), aiAgent.WorkflowVersionID)
|
||||
version := repositories.AIWorkflowVersionRepository.Get(sqls.DB(), workflowVersionID)
|
||||
if version == nil || version.Status != enums.StatusOk {
|
||||
return resolvedWorkflow{}, errorsx.InvalidParam("workflow version does not exist")
|
||||
}
|
||||
@@ -36,11 +35,3 @@ func resolveAgentWorkflow(aiAgent models.AIAgent) (resolvedWorkflow, error) {
|
||||
VersionID: version.ID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func prepareWorkflowAgent(aiAgent models.AIAgent) (models.AIAgent, resolvedWorkflow, error) {
|
||||
workflow, err := resolveAgentWorkflow(aiAgent)
|
||||
if err != nil {
|
||||
return aiAgent, resolvedWorkflow{}, err
|
||||
}
|
||||
return aiAgent, workflow, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user