[Frontend][Bugfix] Use default tool call IDs for Kimi K3 for conversation-level uniqueness (#50420)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Bugen Zhao
2026-07-31 10:02:17 +08:00
committed by GitHub
parent f1899b2ffd
commit ab98034d4c
5 changed files with 55 additions and 53 deletions
-10
View File
@@ -218,7 +218,6 @@ class KimiK3ToolParser(ToolParser):
"""
call_attrs = self._attrs(attrs)
tool_name = call_attrs.get("tool", "")
tool_index = call_attrs.get("index", "")
arguments: dict = {}
for arg_match in self._arg_re.finditer(body):
arg_attrs = self._attrs(arg_match["attrs"])
@@ -234,16 +233,7 @@ class KimiK3ToolParser(ToolParser):
arguments[key] = raw_value
if not tool_name:
return None
tool_call_id = tool_name
if tool_index:
try:
tool_call_id = f"{tool_name}:{int(tool_index) - 1}"
except ValueError:
tool_call_id = f"{tool_name}:{tool_index}"
# id uses the API-side zero-based call ordinal; XTML's message index
# stays one-based when rendering tool result messages.
return ToolCall(
id=tool_call_id,
type="function",
function=FunctionCall(
name=tool_name,