Add files via upload

This commit is contained in:
公明
2026-07-10 16:48:49 +08:00
committed by GitHub
parent 0ff8c58fbd
commit 542d1d2411
19 changed files with 922 additions and 114 deletions
@@ -0,0 +1,37 @@
package multiagent
import (
"testing"
"github.com/cloudwego/eino/schema"
)
func TestEmitToolCallsUsesUniqueFallbackIDsAcrossBatches(t *testing.T) {
index := 0
msg := &schema.Message{ToolCalls: []schema.ToolCall{{
Index: &index,
Function: schema.FunctionCall{
Name: "http-framework-test",
Arguments: `{}`,
},
}}}
var ids []string
progress := func(eventType, _ string, raw interface{}) {
if eventType != "tool_call" {
return
}
data, _ := raw.(map[string]interface{})
if id, _ := data["toolCallId"].(string); id != "" {
ids = append(ids, id)
}
}
for i := 0; i < 2; i++ {
emitToolCallsFromMessage(msg, "agent", "agent", "conversation", "deep", progress, nil, make(map[string]int), nil)
}
if len(ids) != 2 {
t.Fatalf("fallback IDs = %v, want two IDs", ids)
}
if ids[0] == ids[1] {
t.Fatalf("fallback ID was reused across batches: %q", ids[0])
}
}