refactor: remove agent ID references from AI workflow handling and related components

This commit is contained in:
mlogclub
2026-07-25 15:32:55 +08:00
parent 7b86fd1f09
commit 1663db7f24
14 changed files with 13 additions and 302 deletions
@@ -22,7 +22,6 @@ func AIWorkflowAnyList(ctx *gin.Context) {
cnd := params.NewPagedSqlCnd(ctx,
params.QueryFilter{ParamName: "status"},
params.QueryFilter{ParamName: "name", Op: params.Like},
params.QueryFilter{ParamName: "agentId"},
).Desc("id")
list, paging := services.AIWorkflowService.FindPageByCnd(cnd)
httpx.WriteJSON(ctx, &web.PageResult{Results: builders.BuildAIWorkflowList(list), Page: paging})
@@ -160,62 +159,6 @@ func AIWorkflowPostPublish(ctx *gin.Context) {
httpx.WriteJSON(ctx, builders.BuildAIWorkflowVersion(item))
}
func AIWorkflowGetByAgent(ctx *gin.Context) {
agentID, ok := httpx.GetPathInt64(ctx, "id")
if !ok {
return
}
operator, err := services.AuthService.RequirePermission(ctx, constants.PermissionAIAgentView)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
item, err := services.AIWorkflowService.GetOrCreateAgentWorkflow(agentID, operator)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
httpx.WriteJSON(ctx, builders.BuildAIWorkflow(item))
}
func AIWorkflowPostSaveAgent(ctx *gin.Context) {
operator, err := services.AuthService.RequirePermission(ctx, constants.PermissionAIAgentUpdate)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
req := request.SaveAIWorkflowRequest{}
if err := params.ReadJSON(ctx, &req); err != nil {
httpx.WriteJSON(ctx, err)
return
}
item, err := services.AIWorkflowService.SaveAgentWorkflow(req, operator)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
httpx.WriteJSON(ctx, builders.BuildAIWorkflow(item))
}
func AIWorkflowPostPublishAgent(ctx *gin.Context) {
operator, err := services.AuthService.RequirePermission(ctx, constants.PermissionAIAgentUpdate)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
req := request.PublishAIWorkflowRequest{}
if err := params.ReadJSON(ctx, &req); err != nil {
httpx.WriteJSON(ctx, err)
return
}
item, err := services.AIWorkflowService.PublishAgentWorkflow(req, operator)
if err != nil {
httpx.WriteJSON(ctx, err)
return
}
httpx.WriteJSON(ctx, builders.BuildAIWorkflowVersion(item))
}
func AIWorkflowAnyVersionList(ctx *gin.Context) {
if _, err := services.AuthService.RequirePermission(ctx, constants.PermissionAIAgentView); err != nil {
httpx.WriteJSON(ctx, err)