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

Method prepareInputMessage

pkg/workflow/engine.go:786–805  ·  view source on GitHub ↗

prepareInputMessage 准备输入消息

(execution *WorkflowExecution, node *NodeDef)

Source from the content-addressed store, hash-verified

784
785// prepareInputMessage 准备输入消息
786func (e *Engine) prepareInputMessage(execution *WorkflowExecution, node *NodeDef) (string, error) {
787 if node.Agent != nil && node.Agent.Inputs != nil {
788 // 使用输入映射构建消息
789 var parts []string
790 for key, varPath := range node.Agent.Inputs {
791 if value, exists := execution.Context.Variables[varPath]; exists {
792 parts = append(parts, fmt.Sprintf("%s: %v", key, value))
793 }
794 }
795 return strings.Join(parts, "\n"), nil
796 }
797
798 // 使用工作流输入作为消息
799 if len(execution.Context.Inputs) > 0 {
800 data, _ := json.Marshal(execution.Context.Inputs)
801 return string(data), nil
802 }
803
804 return "", nil
805}
806
807// processAgentEvent 处理Agent事件
808func (e *Engine) processAgentEvent(event *session.Event, outputs map[string]any) map[string]any {

Callers 1

executeTaskNodeMethod · 0.95

Calls 1

JoinMethod · 0.45

Tested by

no test coverage detected