mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
fix: Antigravity 跨格式转换链 tool call ID 完整传递
修复通过 Antigravity 适配器发送请求到 Claude 模型时 tool_use 块缺少必需 id 字段的问题。 根本原因:在跨格式转换链 (Gemini → Internal → Claude/Gemini) 中, functionCall 和 functionResponse 的 id 字段没有被正确传递。 修复内容: - internal.py: ToolResultBlock 增加 tool_name 字段,区分工具名称和 call id - gemini.py: 读取/输出 functionCall 和 functionResponse 时保留 id 字段 - gemini.py: 流式响应中正确传递 tool_id - envelope.py: 同时支持 camelCase/snake_case 两种命名风格
This commit is contained in:
@@ -161,8 +161,8 @@ def _inject_claude_tool_ids_request(inner_request: dict[str, Any], model: str) -
|
||||
if not isinstance(part, dict):
|
||||
continue
|
||||
|
||||
# 1. functionCall(Assistant 请求调用工具)
|
||||
fc = part.get("functionCall")
|
||||
# 1. functionCall(Assistant 请求调用工具)- 支持 camelCase 和 snake_case
|
||||
fc = part.get("functionCall") or part.get("function_call")
|
||||
if isinstance(fc, dict) and fc.get("id") is None:
|
||||
name = fc.get("name", "unknown")
|
||||
if not isinstance(name, str):
|
||||
@@ -171,8 +171,8 @@ def _inject_claude_tool_ids_request(inner_request: dict[str, Any], model: str) -
|
||||
fc["id"] = f"call_{name}_{count}"
|
||||
name_counters[name] = count + 1
|
||||
|
||||
# 2. functionResponse(User 回复工具结果)
|
||||
fr = part.get("functionResponse")
|
||||
# 2. functionResponse(User 回复工具结果)- 支持 camelCase 和 snake_case
|
||||
fr = part.get("functionResponse") or part.get("function_response")
|
||||
if isinstance(fr, dict) and fr.get("id") is None:
|
||||
name = fr.get("name", "unknown")
|
||||
if not isinstance(name, str):
|
||||
|
||||
Reference in New Issue
Block a user