fix(provider): deduplicate streaming tool_call_ids for parallel calls

This commit is contained in:
chengyongru
2026-05-21 12:28:24 +08:00
committed by Xubin Ren
parent 886e7e43d5
commit 77ec55bf8e
2 changed files with 13 additions and 2 deletions
+4 -2
View File
@@ -367,12 +367,14 @@ class StreamingFileEditTracker:
def apply_final_call_ids(self, final_tool_calls: list[Any]) -> None:
"""Keep final start/end events keyed to any earlier streamed placeholder."""
used_canonicals: set[str] = set()
for tool_call in final_tool_calls:
canonical = self.canonical_call_id_for(tool_call)
if canonical:
if canonical and canonical not in used_canonicals:
try:
tool_call.id = canonical
except Exception:
used_canonicals.add(canonical)
except (AttributeError, TypeError):
pass
def canonical_call_id_for(self, tool_call: Any) -> str | None: