fix(openai): strings.Builder for tool-arg accumulation (R7c)

This commit is contained in:
sausheong committed 2026-06-13 12:44:06 +08:00
1 parent 79a69e5dce
commit 385cd26e4b
2 files changed
+10 -9

No files matched your search

+5 -4
View File
@@ -75,11 +75,12 @@ func TestOpenAIChatStreamPartsBeatString(t *testing.T) {
}
func TestEmitToolCalls_OrderedByIndex(t *testing.T) {
toolCalls := map[int]*pendingTC{
2: {id: "c", name: "third", argsJSON: "{}"},
0: {id: "a", name: "first", argsJSON: "{}"},
1: {id: "b", name: "second", argsJSON: "{}"},
mk := func(id, name string) *pendingTC {
p := &pendingTC{id: id, name: name}
p.args.WriteString("{}")
return p
}
toolCalls := map[int]*pendingTC{2: mk("c", "third"), 0: mk("a", "first"), 1: mk("b", "second")}
ch := make(chan llm.ChatEvent, 10)
emitToolCalls(ch, toolCalls)
close(ch)