ensure seen call ids only after valid function_call is emitted

This commit is contained in:
DBT
2026-02-24 10:08:22 +00:00
parent 77cf21ce01
commit 8988002c5a

View File

@@ -233,9 +233,6 @@ func toResponsesInputItemsWithState(msg Message, seenCalls map[string]struct{})
if callID == "" {
continue
}
if seenCalls != nil {
seenCalls[callID] = struct{}{}
}
name := strings.TrimSpace(tc.Name)
argsRaw := ""
if tc.Function != nil {
@@ -255,6 +252,9 @@ func toResponsesInputItemsWithState(msg Message, seenCalls map[string]struct{})
argsRaw = string(argsJSON)
}
}
if seenCalls != nil {
seenCalls[callID] = struct{}{}
}
items = append(items, map[string]interface{}{
"type": "function_call",
"call_id": callID,