Skip to content

[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent #9675

Description

@Rain-0x01-39

问题描述

对话数据如下

[
  ...,
  {
    "role": "assistant",
    "content": [
      {
        "type": "think",
        "think": "用户说\"那你倒是view一下啊\"——用户让我用view_image工具实际查看这张图片,而不是只做curl分析。我之前说图片带C2PA元数据,用户让我用view_image实际看这张图。\n\n用户让我view一下——用view_image工具查看那个URL。让我调用view_image。\n\nview_image工具:下载并查看外部图片引用。参数image_url。\n\n我调用view_image查看 https://image.astrdark.cyou/file/ *** .png\n\n让我用view_image查看这张图。平淡专业,调用工具。",
        "encrypted": "{\"type\": \"openai_responses_reasoning\", \"items\": [{\"id\": \"707e27a3-af80-4b7f-b87f-cee1e8badf73\", \"summary\": [], \"type\": \"reasoning\", \"content\": [{\"text\": \"用户说\\\"那你倒是view一下啊\\\"——用户让我用view_image工具实际查看这张图片,而不是只做curl分析。我之前说图片带C2PA元数据,用户让我用view_image实际看这张图。\\n\\n用户让我view一下——用view_image工具查看那个URL。让我调用view_image。\\n\\nview_image工具:下载并查看外部图片引用。参数image_url。\\n\\n我调用view_image查看 https://image.astrdark.cyou/file/ *** .png\\n\\n让我用view_image查看这张图。平淡专业,调用工具。\", \"type\": \"reasoning_text\"}], \"status\": \"completed\"}]}"
      },
      {
        "type": "text",
        "text": "行,我直接 view 一下这张图。"
      }
    ],
    "tool_calls": [
      {
        "type": "function",
        "id": "call_00_iOi1lkd666doqO4rkRHq6585",
        "function": {
          "name": "view_image",
          "arguments": "{\"image_url\": \"https://image.astrdark.cyou/file/ *** .png\"}"
        }
      }
    ]
  },
  {
    "role": "tool",
    "content": "Image returned and cached at path='/AstrBot/data/temp/tool_images/call_00_iOi1lkd666doqO4rkRHq6585_0.png'. Review the image below. Use send_message_to_user to send it to the user if satisfied, with type='image' and path='/AstrBot/data/temp/tool_images/call_00_iOi1lkd666doqO4rkRHq6585_0.png'.",
    "tool_call_id": "call_00_iOi1lkd666doqO4rkRHq6585"
  },
  ...
]

后面既没有图片base64数据,也没有图片转述文本。模型实际上“什么也看不到”。预期应调用已配置的默认图片转述模型。

工具 view_image 来自 astrbot_plugin_astrbook,我看过源代码,认为问题是AstrBot Core所致。

上传文件后引导 Agent 使用 astrbot_file_read_tool 读图也会遇到同样的问题,同样排除了插件的问题。

如何复现?

  1. 在配置设置默认对话模型和默认图片转述模型,其中默认对话模型不支持图片
  2. 调用一个工具,该工具返回 ImageContent
return CallToolResult(
    content=[
        ImageContent(
            type="image", data=base64_data, mimeType=mime_type
        )
    ]
)

AstrBot 版本

v4.27.3

操作系统

Linux

部署方式

Docker

使用的消息平台适配器

OneBot v11

错误日志

[2026-08-14 10:57:38.870] [Core] [DBUG] [aiocqhttp.aiocqhttp_platform_adapter:129]: [aiocqhttp] RawMessage <Event, {'self_id':  *_* , 'user_id':  *_* , 'time': 1786676258, 'message_id': -1348729143, 'message_seq': 131223, 'message_type': 'group', 'sender': {'user_id':  *_* , 'nickname': '雨零一', 'card': 'A###雨家烤鱼 批 (Rain-0x01)', 'role': 'admin', 'level': '68', 'title': ''}, 'raw_message': '[CQ:at,qq= *_* ,name=&#91;BOT&#93;紫] 我正在写&#91;Bug&#93; 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent\n\n配合一下,你view https://image.astrdark.cyou/file/1784981942779_media_image_de166d9787a74602848a708137a80e61.jpg 我要抓DEBUG等级的日志', 'font': 14, 'sub_type': 'normal', 'message': [{'type': 'at', 'data': {'qq': ' *_* ', 'name': '[BOT]紫'}}, {'type': 'text', 'data': {'text': ' 我正在写[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent\n\n配合一下,你view https://image.astrdark.cyou/file/1784981942779_media_image_de166d9787a74602848a708137a80e61.jpg 我要抓DEBUG等级的日志'}}], 'message_format': 'array', 'post_type': 'message', 'group_id': 976177610, 'group_name': '困猫'}>
[2026-08-14 10:57:39.193] [Core] [DBUG] [waking_check.stage:165]: enabled_plugins_name: ['*']
[2026-08-14 10:57:39.196] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - handle_session_control_agent
[2026-08-14 10:57:39.196] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_blacklist_tools - on_all_message
[2026-08-14 10:57:39.196] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - handle_empty_mention
[2026-08-14 10:57:39.196] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - persist_group_message
[2026-08-14 10:57:39.197] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_group_context_flow - record_group_message
[2026-08-14 10:57:39.425] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_omnidraw - on_message_preset
[2026-08-14 10:57:39.425] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_genshinimpact - on_message
[2026-08-14 10:57:39.425] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_zssm_explain - keyword_zssm
[2026-08-14 10:57:39.426] [astrbot_zssm_explain] [DBUG] [astrbot_zssm_explain.main:1252]: zssm_explain: no trigger match: 我正在写[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent

配合一下,你view https://image.astrdark.cyou/file/1784981942779_media_image_de166d9787a74602848a708137a80e61.jpg 我要抓DEBUG等级的日志
[2026-08-14 10:57:39.426] [astrbot_zssm_explain] [DBUG] [astrbot_zssm_explain.main:1252]: zssm_explain: no trigger match: 我正在写[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent

配合一下,你view https://image.astrdark.cyou/file/1784981942779_media_image_de166d9787a74602848a708137a80e61.jpg 我要抓DEBUG等级的日志
[2026-08-14 10:57:39.426] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_reread - reread_handle
[2026-08-14 10:57:39.427] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_qzone_ultra - qzone_capture_aiocqhttp_client
[2026-08-14 10:57:39.427] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_sl - on_message
[2026-08-14 10:57:39.427] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_poke_to_llm - on_poke
[2026-08-14 10:57:39.427] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_media_parser - auto_parse
[2026-08-14 10:57:39.430] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - on_message
[2026-08-14 10:57:39.431] [Core] [DBUG] [agent_sub_stages.internal:193]: ready to request llm provider
[2026-08-14 10:57:39.432] [Core] [DBUG] [agent_sub_stages.internal:221]: acquired session lock for llm request
[2026-08-14 10:57:39.434] [astrbot_plugin_livingmemory] [DBUG] [managers.conversation_manager:131]: [add_message_from_event] [ylz_ob:GroupMessage:976177610] 原始sender对象: user_id= *_* , nickname=A###雨家烤鱼 批 (Rain-0x01)
[2026-08-14 10:57:39.434] [astrbot_plugin_livingmemory] [DBUG] [managers.conversation_manager:150]: [add_message_from_event] [ylz_ob:GroupMessage:976177610] 最终发送者信息: sender_id= *_* , sender_name='A###雨家烤鱼 批 (Rain-0x01)', role=user, is_group=True, group_id=ylz_ob:GroupMessage:976177610
[2026-08-14 10:57:39.445] [astrbot_plugin_livingmemory] [DBUG] [storage.conversation_store:485]: [ConversationStore] 添加消息: session=ylz_ob:GroupMessage:976177610, role=user
[2026-08-14 10:57:39.445] [astrbot_plugin_livingmemory] [DBUG] [managers.conversation_manager:228]: [ConversationManager] 添加消息: session=ylz_ob:GroupMessage:976177610, role=user, sender= *_* 
[2026-08-14 10:57:39.464] [astrbot_plugin_livingmemory] [DBUG] [managers.conversation_manager:236]: [DEBUG-AddMessage] [ylz_ob:GroupMessage:976177610] 添加消息后,当前总消息数: 973
[2026-08-14 10:57:40.415] [Core] [DBUG] [tools.knowledge_base_tools:77]: [知识库] 使用全局配置,知识库数量: 0
[2026-08-14 10:57:40.417] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMRequestEvent) -> astrbot_plugin_group_context_flow - inject_group_flow_delta
[2026-08-14 10:57:40.423] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMRequestEvent) -> astrbot_plugin_astrbook - remind_astrbook_tool_reply
[2026-08-14 10:57:40.424] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMRequestEvent) -> astrbot_plugin_livingmemory - handle_memory_recall
[2026-08-14 10:57:40.424] [astrbot_plugin_livingmemory] [DBUG] [event_handler_modules.memory_recall:96]: [DEBUG-Recall] 获取到 unified_msg_origin: ylz_ob:GroupMessage:976177610
[2026-08-14 10:57:40.424] [astrbot_plugin_livingmemory] [DBUG] [utils.__init__:155]: [ylz_ob:GroupMessage:976177610] 开始执行操作: 记忆召回
[2026-08-14 10:57:40.425] [astrbot_plugin_livingmemory] [DBUG] [event_handler_modules.memory_recall:429]: [ylz_ob:GroupMessage:976177610] 已归一化 1 条纯文本历史 content parts
[2026-08-14 10:57:40.425] [astrbot_plugin_livingmemory] [INFO] [event_handler_modules.memory_recall:120]: [ylz_ob:GroupMessage:976177610] 已归一化 1 条纯文本历史消息
[2026-08-14 10:57:40.429] [astrbot_plugin_livingmemory] [DBUG] [event_handler_modules.group_capture:97]: [ylz_ob:GroupMessage:976177610] 捕获群聊消息: sender=A###雨家烤鱼 批 (Rain-0x01)( *_* ), content=[At: *_* ] 我正在写[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具...
[2026-08-14 10:57:40.479] [astrbot_plugin_livingmemory] [DBUG] [utils.__init__:211]: [get_persona_id] [ylz_ob:GroupMessage:976177610] 会话=0f82b18e-7318-47ae-8d3f-354d5136796b, 会话人格=未设置
[2026-08-14 10:57:40.480] [astrbot_plugin_livingmemory] [DBUG] [utils.__init__:228]: [get_persona_id] [ylz_ob:GroupMessage:976177610] 使用默认人格: ylz_v3
[2026-08-14 10:57:40.480] [astrbot_plugin_livingmemory] [INFO]
[utils.__init__:229]: [get_persona_id] [ylz_ob:GroupMessage:976177610] 最终使用人格: ylz_v3
[2026-08-14 10:57:40.483] [astrbot_plugin_livingmemory] [INFO] [event_handler_modules.memory_recall:227]: [ylz_ob:GroupMessage:976177610] 上下文扩展查询: 4条历史消息 + 当前消息,按时间跳过=0条
[2026-08-14 10:57:40.484] [astrbot_plugin_livingmemory] [INFO] [event_handler_modules.memory_recall:236]: [ylz_ob:GroupMessage:976177610] 开始记忆召回,查询='[At: *_* ] 我正在写[Bug] 默认对话模型不支持图片模态输入时不能正确处理工具返回的ImageContent

配合一下,你view ht...'
[2026-08-14 10:57:42.209] [astrbot_plugin_livingmemory] [DBUG] [utils.__init__:163]: [ylz_ob:GroupMessage:976177610] 操作成功完成: 记忆召回 (耗时 1.784s)
[2026-08-14 10:57:42.210] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMRequestEvent) -> astrbot_plugin_Favour_Ultra - inject_favour_prompt
[2026-08-14 10:57:42.880] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMRequestEvent) -> astrbot - decorate_llm_req
[2026-08-14 10:57:42.894] [Core] [DBUG] [runners.base:64]: Agent state transition: AgentState.IDLE -> AgentState.RUNNING
[2026-08-14 10:57:42.895] [Core] [DBUG] [runners.tool_loop_agent_runner:676]: [BefCompact] messages -> [436] system,user,assistant,user,...,user,user,assistant,user
[2026-08-14 10:57:42.896] [Core] [DBUG] [runners.tool_loop_agent_runner:676]: [AftCompact] messages -> [436] system,user,assistant,user,...,user,user,assistant,user
[2026-08-14 10:57:42.900] [Core] [DBUG] [provider.modalities:150]: context modality fix applied: fixed_image_blocks=2, fixed_audio_blocks=0, fixed_tool_messages=0, removed_tool_calls=0
[2026-08-14 10:57:53.284] [Core] [INFO] [runners.tool_loop_agent_runner:1096]: Agent 使用工具: ['view_image']
[2026-08-14 10:57:53.285] [Core] [INFO] [runners.tool_loop_agent_runner:1152]: 使用工具:view_image,参数:{'image_url': 'https://image.astrdark.cyou/file/1784981942779_media_image_de166d9787a74602848a708137a80e61.jpg'}
[2026-08-14 10:57:54.269] [Core] [DBUG] [waking_check.stage:165]: enabled_plugins_name: ['*']
[2026-08-14 10:57:54.270] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - handle_session_control_agent
[2026-08-14 10:57:54.270] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_blacklist_tools - on_all_message
[2026-08-14 10:57:54.271] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - handle_empty_mention
[2026-08-14 10:57:54.271] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - persist_group_message
[2026-08-14 10:57:54.271] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_group_context_flow - record_group_message
[2026-08-14 10:57:54.369] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_omnidraw - on_message_preset
[2026-08-14 10:57:54.370] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_genshinimpact - on_message
[2026-08-14 10:57:54.370] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_zssm_explain - keyword_zssm
[2026-08-14 10:57:54.371] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_reread - reread_handle
[2026-08-14 10:57:54.371] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_qzone_ultra - qzone_capture_aiocqhttp_client
[2026-08-14 10:57:54.371] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_sl - on_message
[2026-08-14 10:57:54.371] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_poke_to_llm - on_poke
[2026-08-14 10:57:54.371] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot_plugin_media_parser - auto_parse
[2026-08-14 10:57:54.373] [Core] [DBUG] [method.star_request:46]: plugin -> astrbot - on_message
[2026-08-14 10:57:54.373] [Core] [DBUG] [pipeline.scheduler:97]: pipeline execution completed.
[2026-08-14 10:57:57.144] [astrbot_zssm_explain] [DBUG] [astrbot_zssm_explain.main:1252]: zssm_explain: no trigger match: 何意味?
[2026-08-14 10:57:57.145] [astrbot_zssm_explain] [DBUG] [astrbot_zssm_explain.main:1252]: zssm_explain: no trigger match: @ ( *_* ) 何意味?
[2026-08-14 10:57:57.608] [Core] [DBUG] [agent.tool_image_cache:97]: Saved tool image to: /AstrBot/data/temp/tool_images/call_00_Vbiyw6egJtQJVgyDTKvQ6974_0.jpg
[2026-08-14 10:57:57.610] [Core] [DBUG] [pipeline.context_utils:98]: hook(OnLLMToolRespondEvent) -> astrbot_plugin_astrbook - mark_active_astrbook_send_as_tool_reply
[2026-08-14 10:57:57.611] [Core] [INFO] [runners.tool_loop_agent_runner:1349]: Tool `view_image` Result: Image returned and cached at path='/AstrBot/data/temp/tool_images/call_00_Vbiyw6egJtQJVgyDTKvQ6974_0.jpg'. Review the image below. Use send_message_to_user to send it to the user if satisfied, with type='image' and path='/AstrBot/data/temp/tool_images/call_00_Vbiyw6egJtQJVgyDTKvQ6974_0.jpg'.
[2026-08-14 10:57:57.611] [Core] [DBUG] [runners.tool_loop_agent_runner:676]: [BefCompact] messages -> [438] system,user,assistant,user,...,assistant,user,assistant,tool
[2026-08-14 10:57:57.613] [Core] [DBUG] [runners.tool_loop_agent_runner:676]: [AftCompact] messages -> [438] system,user,assistant,user,...,assistant,user,assistant,tool
[2026-08-14 10:57:57.617] [Core] [DBUG] [provider.modalities:150]: context modality fix applied: fixed_image_blocks=2, fixed_audio_blocks=0, fixed_tool_messages=0, removed_tool_calls=0

辅助信息

No response

检查清单

  • 我已在 Issue 列表中搜索过相关问题仍无法解决,或该问题从未被报告过。
  • 我已尝试过禁用所有插件,排除了可能是因插件导致的问题。
  • 我报告的问题与 AstrBot 本体相关,而非在报告某一插件的问题。
  • 我已阅读并同意本项目的贡献者行为准则
  • (可选)我愿意提交 PR 以帮助修复该问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions