Deadwalk
bfadc4e2e0
fix(anthropic): improve MCP tool message handling and error resilience
...
修复Anthropic协议中MCP工具消息处理问题,增强错误恢复能力:
- 改进MessageContent的JSON解析,支持原始JSON数据保留
- 移除对空内容的过滤,避免丢失MCP工具消息
- 增加详细调试日志,便于问题排查
- 优化错误响应处理,保留响应体信息
- 修复路由转发时可能的数据丢失问题
fix(anthropic): improve MCP tool message handling and error resilience
- Enhance MessageContent JSON parsing to preserve raw JSON data
- Remove empty content filtering to prevent MCP tool message loss
- Add detailed debug logging for troubleshooting
- Optimize error response handling with response body preservation
- Fix potential data loss during routing
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-30 08:29:38 +08:00
Deadwalk
7b9631408f
fix(anthropic): filter empty content messages to prevent API errors
...
- Add message content validation in getAndValidateAnthropicRequest
- Filter out messages with empty content to prevent 'all messages must have non-empty content' errors
- Support both text and non-text content validation (images, tool_use, tool_result)
- Add detailed logging for filtered messages
- Ensure at least one valid message remains after filtering
修复Anthropic协议空消息内容问题:
- 在getAndValidateAnthropicRequest中添加消息内容验证
- 过滤空内容消息以防止'all messages must have non-empty content'错误
- 支持文本和非文本内容验证(图片、工具调用、工具结果)
- 为被过滤的消息添加详细日志记录
- 确保过滤后至少保留一条有效消息
2025-09-29 16:51:55 +08:00
Deadwalk
48396d3f33
fix: 修复CodeReview发现的安全问题和代码质量问题 | fix security and code quality issues identified by CodeReview
...
- 修复JSON注入漏洞:使用json.Marshal()安全转义字符串内容
- 定义常量CHARS_PER_TOKEN替换硬编码的token估算数字4
- 处理UnmarshalJSON错误,避免静默失败并记录错误日志
- 定义常量替换硬编码的API端点路径,提高可维护性
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-28 16:41:48 +08:00
Deadwalk
e27612a620
refactor: 优化Anthropic协议日志输出 | optimize Anthropic protocol log output
...
- 清理不必要的调试日志,减少生产环境噪音
- 将详细日志从Infof降级为Debugf级别
- 保留关键错误日志和重要流程信息
- 优化日志结构,提高可读性和维护性
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-09-28 16:22:18 +08:00
Deadwalk
008ffe4662
feat: 支持Anthropic API协议 | support Anthropic API protocol
...
- 添加Anthropic适配器实现 | Add Anthropic adaptor implementation
- 支持Anthropic消息格式转换 | Support Anthropic message format conversion
- 添加Vertex AI Claude适配器支持 | Add Vertex AI Claude adapter support
- 更新Anthropic的中继模式定义 | Update relay mode definitions for Anthropic
- 添加Anthropic控制器和路由 | Add Anthropic controller and routing
🤖 Generated with [Claude Code](https://claude.ai/code )
Co-Authored-By: zgdmemail@gmail.com
2025-09-28 11:13:55 +08:00