Vertex Claude 开关 + 工具调用修复 - #2741
Conversation
添加可配置开关以控制 Vertex 渠道中 Claude 模型请求的处理方式: - 开关关闭(默认):使用原生 Anthropic 端点和格式 - 开关开启:将 Claude 请求转换为 Gemini 格式并发送到 Google 端点 后端修改: - dto/channel_settings.go: 添加 VertexClaudeToGemini 字段 - relay/channel/vertex/adaptor.go: - Init 方法根据开关设置 RequestMode - ConvertClaudeRequest 方法在开关开启时调用 Gemini 转换 前端修改: - EditChannelModal.jsx: 添加开关 UI 控件和相关数据处理逻辑 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
修复 OpenAI 转 Claude 格式时,工具调用场景下可能出现的多个 content_block_start 事件和未正确关闭 content_block 的问题。 主要改动: 1. 添加工具使用状态跟踪 - 在 ClaudeConvertInfo 中新增 ToolUseStarted map 字段 - 记录每个 block index 的工具使用开始状态 2. 支持首块多工具调用处理 - 将单个工具调用处理改为循环处理多个工具调用 - 正确设置每个工具的 block index - 标记已开始的工具使用块 3. 避免重复发送 content_block_start - 在 delta 处理中检查 ToolUseStarted 状态 - 只在未开始时发送 content_block_start 事件 4. 正确处理工具调用的结束 - 新增 generateToolUseStopBlocks 函数 - 按索引顺序关闭所有未关闭的工具使用块 - 在 finish_reason、done 等多个位置根据消息类型正确调用 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. WalkthroughThis PR adds a feature flag Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.