42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package executor
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"cs-agent/internal/pkg/toolx"
|
|
|
|
"github.com/cloudwego/eino/adk"
|
|
"github.com/cloudwego/eino/schema"
|
|
)
|
|
|
|
func TestConsumeAgentEventsUsesGraphToolTextAsReplyFallback(t *testing.T) {
|
|
summary := &RunResult{
|
|
Status: "started",
|
|
InvokedToolCodes: make([]string, 0),
|
|
}
|
|
events, gen := adk.NewAsyncIteratorPair[*adk.AgentEvent]()
|
|
gen.Send(&adk.AgentEvent{
|
|
Output: &adk.AgentOutput{
|
|
MessageOutput: &adk.MessageVariant{
|
|
Role: schema.Tool,
|
|
ToolName: toolx.GraphHandoffConversation.Name,
|
|
Message: &schema.Message{
|
|
Content: "已为你转接人工客服,请稍候。,请稍候。",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
gen.Close()
|
|
|
|
consumeAgentEvents(events, summary, nil, map[string]string{
|
|
toolx.GraphHandoffConversation.Name: toolx.GraphHandoffConversation.Code,
|
|
})
|
|
|
|
if summary.ReplyText != "已为你转接人工客服,请稍候。,请稍候。" {
|
|
t.Fatalf("unexpected reply text: %q", summary.ReplyText)
|
|
}
|
|
if summary.Status != "completed" {
|
|
t.Fatalf("unexpected summary status: %q", summary.Status)
|
|
}
|
|
}
|