Skip to content

[Feature] 图片输入应提供可访问的文件路径,当前 agent 无法定位图片导致附件上传失败 #1129

Done

Description

@Apcan

问题描述

在 BaoCode 会话中,用户上传/粘贴图片后,agent 能「看到」图片内容(视觉理解正常),但无法获知图片对应的本地文件路径。当用户希望 agent 把这张图片用于后续操作(如上传附件到某系统、作为接口参数、提交到任务单等)时,agent 只能靠内容去猜测图片保存在哪里——通常从 %TEMP%、Downloads、桌面、.claude 等目录一张张扫描、逐张打开比对;即便找到,也可能只是「同画面但字节不同」的另一份副本,而不是用户上传的那份精确文件。这导致附件上传等操作不可靠,甚至完全失败。

复现步骤

  1. 在 BaoCode 会话中上传一张本地图片(例如从钉钉/微信复制的截图,或直接粘贴剪贴板图片)。
  2. 要求 agent「把这张图片上传到 XX」或「用这张图片作为附件提交」。
  3. agent 反馈:收到的只是图片数据流,没有文件名和路径;只能扫描临时目录寻找候选图片。
  4. agent 扫描 %TEMP%\DingtalkPic\ 等目录,找到的候选图片可能像素相同但 PNG 编码/字节与上传的不一致(哈希不同),无法确认哪份是用户上传的原图。

实际行为 / 期望行为

  • 实际:会话消息里的 image block 只有 {type:'image', source:{type:'base64', media_type, data}},source 不含 filename / path / URL / 附件 ID。agent 无法精准拿到图片地址,只能盲扫磁盘;即使找到候选也无法保证是同一份文件。
  • 期望:在传给 agent 的 image block 中增加图片的本地绝对路径字段(如 source.path 或 source.filename),让 agent 可以直接 Read / 上传该文件,无需扫描磁盘猜测。

环境

  • BaoCode(Claude Code 内核),Windows 11
  • 图片来源:剪贴板粘贴 / 钉钉聊天截图复制

Activity

  1. added
    accepted
    on Nov 19, 2026
  2. leookun commented on Nov 24, 2026

    @leookun
    Collaborator

    Done in #1288: every image you attach is now also saved as a file (under BaoCode's data folder, pastes/images/), and the agent is told its path along with the message ([Image #N]: <path>), so it can read, upload or attach that exact file. The file is the image as the model received it. Not available yet for remote (SSH) projects. Ships with the next release.

  3. Apcan commented on Nov 24, 2026

    @Apcan
    Author
  4. added a commit that references this issue on Nov 24, 2026
    313a640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions