MCPcopy Create free account
hub / github.com/53AI/53AIHub / executeWorkflowDirect

Function executeWorkflowDirect

api/controller/relay/relay_workflow.go:223–247  ·  view source on GitHub ↗

executeWorkflowDirect 直接执行工作流,简化参数传递

(c *gin.Context, workflowRequest *WorkflowRunRequest, agent *model.Agent, channel *model.Channel, modelName string)

Source from the content-addressed store, hash-verified

221
222// executeWorkflowDirect 直接执行工作流,简化参数传递
223func executeWorkflowDirect(c *gin.Context, workflowRequest *WorkflowRunRequest, agent *model.Agent, channel *model.Channel, modelName string) (*custom.WorkflowResponseData, error) {
224 // 根据渠道类型选择对应的工作流适配器
225 if channel.Type == channeltype.Coze || channel.Type == model.ChannelApiTypeCozeStudio {
226 return executeCozeWorkflow(c, workflowRequest, agent, channel, modelName)
227 }
228
229 if channel.Type == model.ChannelApiDify {
230 return executeDifyWorkflowByMode(c, workflowRequest, agent, channel, modelName)
231 }
232
233 if channel.Type == channeltype.FastGPT || channel.Type == model.ChannelApiTypeFastGpt {
234 // 这个 fastgpt 是因为 适配器的默认给 0 了,所以这里要手动设置一下,实际上数据库里面不会存 1007
235 return executeFastGPTWorkflow(c, workflowRequest, agent, channel, modelName)
236 }
237
238 if channel.Type == model.ChannelApi53AI {
239 return executeAI53Workflow(c, workflowRequest, agent, channel, modelName)
240 }
241
242 if channel.Type == model.ChannelApiTypeN8n {
243 return executeN8nWorkflow(c, workflowRequest, agent, channel, modelName)
244 }
245
246 return nil, fmt.Errorf("不支持的渠道类型: %d", channel.Type)
247}
248
249// handleWorkflowError 处理工作流HTTP错误响应
250func handleWorkflowError(resp *http.Response, workflowType string) error {

Callers 1

executeWorkflowFunction · 0.85

Calls 6

executeCozeWorkflowFunction · 0.85
executeFastGPTWorkflowFunction · 0.85
executeAI53WorkflowFunction · 0.85
executeN8nWorkflowFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected