C₂₂H₂₅NO₆
4b097011cf
fix(core): Fix image delivery to the model by treating empty modalities as unconfigured (#8451)
* fix(core): 将空 list modalities 视为未配置,修复图片无法传递到模型的问题
migra_helper 将未配置的 modalities 迁移为空 list [],而新增的
_provider_supports_modality()、_assemble_request_context_for_provider()、
_should_fix_modalities_for_provider()、_func_tool_for_provider() 四个函数
对 [] 和 None 的处理不一致,导致所有未在 WebUI 手动配置 modalities 的
provider 无法传递图片、引用图片被跳过、工具被错误清除。
修改策略:将 [] 与 None 统一视为未配置状态,保持向后兼容。
仅在 modalities 为非空 list 时才启用过滤和修复逻辑。
- _provider_supports_modality: [] 返回 True,默认支持
- _assemble_request_context_for_provider: [] 不过滤图片
- _should_fix_modalities_for_provider: [] 不触发历史上下文修复
- _func_tool_for_provider: [] 不清除工具
复现脚本已确认 Bug 不再复现,82 个相关单元测试全部通过。
* fix(core): 补充修复 tool loop 中 cached images 的 modalities 判断
上一笔 commit 遗漏了 tool_loop_agent_runner.py 第 917 行对
cached images 的 modalities 检查,当 modalities=[] 时,tool call
返回的图片不会被追加到消息中,导致模型看不到 tool 结果中的图片。
修复方式与主修复一致:not modalities or image in modalities
复现脚本和 82 个单元测试全部通过。
* test: 补充 fake_save_image mock 缺少的 mime_type 字段
修复 modalities=[] 导致 cached images 分支变为可达后,暴露
了 test_tool_result_includes_all_calltoolresult_content 中
fake_save_image mock 不完整的问题:返回的 SimpleNamespace
缺少 mime_type 属性,而实际 tool_image_cache.save_image()
始终包含该字段。
---------
Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com>
2026-06-02 08:53:59 +08:00
..
2026-05-30 17:16:36 +08:00
2026-05-04 20:15:21 +08:00
2026-04-19 14:18:16 +08:00
2026-06-02 08:40:55 +08:00
2026-02-23 23:35:15 +08:00
2026-05-30 13:44:45 +08:00
2026-05-12 23:46:57 +08:00
2026-04-08 11:35:59 +08:00
2026-03-14 23:41:28 +08:00
2026-05-14 01:13:46 +08:00
2026-05-21 21:37:10 +08:00
2026-02-19 01:26:04 +08:00
2026-05-03 16:37:36 +08:00
2026-05-03 16:37:36 +08:00
2026-04-11 17:01:54 +08:00
2026-05-03 22:11:24 +08:00
2026-04-13 12:47:27 +09:00
2026-06-01 16:40:29 +08:00
2026-04-13 12:47:27 +09:00
2026-04-13 12:47:27 +09:00
2026-05-15 18:43:21 +08:00
2026-05-12 23:57:16 +08:00
2026-05-20 14:38:16 +08:00
2026-03-29 00:03:05 +08:00
2026-03-28 21:31:52 +09:00
2026-05-12 23:46:57 +08:00
2026-05-15 13:00:26 +08:00
2026-04-11 17:01:54 +08:00
2026-03-11 23:58:28 +09:00
2026-05-14 09:00:16 +08:00
2026-04-06 18:27:28 +08:00
2026-05-27 21:36:22 +08:00
2026-02-11 17:14:47 +08:00
2026-04-11 17:01:54 +08:00
2026-05-30 17:26:36 +08:00
2026-04-10 17:08:10 +09:00
2026-04-28 21:10:19 +09:00
2026-05-30 18:45:33 +08:00
2026-05-13 14:38:11 +08:00
2026-02-12 23:42:29 +09:00
2026-03-07 21:42:56 +09:00
2025-11-03 02:43:00 +08:00
2026-04-29 10:26:20 +08:00
2026-03-22 14:23:21 +08:00
2026-05-03 16:37:36 +08:00
2026-03-01 00:06:04 +08:00
2026-03-23 09:33:37 +08:00
2026-04-12 13:42:51 +08:00
2026-02-12 01:04:48 +08:00
2026-06-02 08:53:59 +08:00
2026-05-07 09:41:45 +09:00
2026-05-15 13:00:26 +08:00
2026-03-21 20:44:36 +08:00