瀏覽代碼

fix: add missing id/sessionID/messageID to MCP tool attachments (#14345)

NatChung 6 月之前
父節點
當前提交
d2d7a37bca
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      packages/opencode/src/session/prompt.ts

+ 6 - 1
packages/opencode/src/session/prompt.ts

@@ -906,7 +906,12 @@ export namespace SessionPrompt {
           title: "",
           metadata,
           output: truncated.content,
-          attachments,
+          attachments: attachments.map((attachment) => ({
+            ...attachment,
+            id: Identifier.ascending("part"),
+            sessionID: ctx.sessionID,
+            messageID: input.processor.message.id,
+          })),
           content: result.content, // directly return content to preserve ordering when outputting to model
         }
       }