MCPcopy Create free account
hub / github.com/astercloud/aster / CreateWorkflowTool

Method CreateWorkflowTool

pkg/workflow/workflow_agent.go:57–84  ·  view source on GitHub ↗

CreateWorkflowTool 创建 workflow 执行工具

(
	session *WorkflowSession,
	executionInput *WorkflowInput,
	stream bool,
)

Source from the content-addressed store, hash-verified

55
56// CreateWorkflowTool 创建 workflow 执行工具
57func (wa *WorkflowAgent) CreateWorkflowTool(
58 session *WorkflowSession,
59 executionInput *WorkflowInput,
60 stream bool,
61) WorkflowToolFunc {
62 return func(ctx context.Context, query string) (any, error) {
63 if wa.workflow == nil {
64 return nil, errors.New("no workflow attached to agent")
65 }
66
67 workflowInput := &WorkflowInput{
68 Input: query,
69 AdditionalData: executionInput.AdditionalData,
70 Images: executionInput.Images,
71 Videos: executionInput.Videos,
72 Audio: executionInput.Audio,
73 Files: executionInput.Files,
74 SessionID: session.ID,
75 SessionState: session.State,
76 }
77
78 if stream {
79 return wa.executeStreamingWorkflow(ctx, workflowInput)
80 }
81
82 return wa.executeWorkflow(ctx, workflowInput)
83 }
84}
85
86// executeWorkflow 执行 workflow(非流式)
87func (wa *WorkflowAgent) executeWorkflow(ctx context.Context, input *WorkflowInput) (any, error) {

Callers

nothing calls this directly

Calls 2

executeWorkflowMethod · 0.95

Tested by

no test coverage detected