This website requires JavaScript.
Explore
Help
Register
Sign In
zhuchaowe
/
qwen_agent
Watch
1
Star
0
Fork
0
You've already forked qwen_agent
Code
Issues
Pull Requests
Actions
Packages
Projects
Releases
Wiki
Activity
240
Commits
3
Branches
0
Tags
61
MiB
b8e00d403c
Commit Graph
2 Commits
Author
SHA1
Message
Date
朱潮
b8e00d403c
修复完成。主要改动: 1. 新增 _clean_content_blocks 方法:专门处理 content 字段的清理 - 当 content 是列表格式时,过滤掉 type: 'tool_use' 的块(如果 id 不在 valid_tool_call_ids 中) - 返回清理后的 content 和是否有文本内容的标志 2. 更新 _cleanup_tool_use_messages 方法: - 调用 _clean_content_blocks 来清理 content - 使用清理后的 cleaned_content 创建新的 AIMessage 问题根源:之前的代码只清空了 tool_calls=[],但没有从 content 列表中移除 type: 'tool_use' 的块。Anthropic API 会检查这两个地方,导致报错。
2025-12-23 19:11:27 +08:00
朱潮
61c6b69aa5
add agent/tool_use_cleanup_middleware.py
2025-12-23 12:04:26 +08:00