Refactor AIAgent runtime handling and remove unused fields

This commit is contained in:
mlogclub
2026-06-23 08:37:52 +08:00
parent e4cab3e12d
commit 560843686b
13 changed files with 65 additions and 76 deletions
-21
View File
@@ -229,7 +229,6 @@ func (s *aIAgentService) buildAIAgentModel(id int64, req request.CreateAIAgentRe
SkillIDs: utils.JoinInt64s(skillIDs),
AllowedMCPTools: directToolsJSON,
AllowedGraphTools: graphToolsJSON,
RuntimeMode: enums.AIAgentRuntimeModeBuiltinGraph,
WorkflowVersionID: 0,
}, nil
}
@@ -357,26 +356,6 @@ func (s *aIAgentService) normalizeGraphTools(input []string) ([]string, error) {
return ret, nil
}
func (s *aIAgentService) normalizeRuntimeMode(input enums.AIAgentRuntimeMode, workflowVersionID int64) (enums.AIAgentRuntimeMode, int64, error) {
if input == 0 {
input = enums.AIAgentRuntimeModeBuiltinGraph
}
if !slices.Contains(enums.AIAgentRuntimeModeValues, input) {
return 0, 0, errorsx.InvalidParam("invalid ai agent runtime mode")
}
if input != enums.AIAgentRuntimeModeWorkflow {
return input, 0, nil
}
if workflowVersionID <= 0 {
return 0, 0, errorsx.InvalidParam("workflow version is required")
}
version := AIWorkflowService.GetVersion(workflowVersionID)
if version == nil || version.Status != enums.StatusOk {
return 0, 0, errorsx.InvalidParam("workflow version does not exist")
}
return input, workflowVersionID, nil
}
func (s *aIAgentService) UpdateSort(ids []int64) error {
return sqls.WithTransaction(func(ctx *sqls.TxContext) error {
for i, id := range ids {