mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
5c79cf64a4
* fix(gemini-native): resolve functionResponse.name and thought_signature replay for synthesized tool call IDs Two related bugs in the Gemini Native format conversion layer: 1. **functionResponse.name resolution** (422 error): When Gemini's parallel function calls omit the id field, cc-switch synthesizes gemini_synth_* IDs. These are stored in the shadow store but can be lost in long sessions, causing subsequent tool_result blocks to fail. Fix: pre-scan all assistant messages in the request body to seed the tool_name_by_id map, and add a last-resort fallback that scans the current content array for matching tool_use blocks. 2. **thought_signature replay** (400 error): The Anthropic Messages format strips thoughtSignature from tool_use blocks, but Gemini requires it on every functionCall in multi-turn tool-use exchanges. Fix: build a thought_signature_by_id map from shadow turns and attach thoughtSignature when converting tool_use back to functionCall. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * style: run cargo fmt on transform_gemini.rs --------- Co-authored-by: Tiancrimson <tiancrimson@gmail.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Jason <farion1231@gmail.com>