proper fix for image attachments (#4562)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
shuv 2025-11-22 10:47:57 -08:00 committed by GitHub
parent 0dd5039668
commit bdcf864678
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 14 deletions

View file

@ -907,22 +907,32 @@ export namespace SessionPrompt {
extra: { bypassCwdCheck: true, ...info.model },
metadata: async () => {},
})
pieces.push(
{
id: Identifier.ascending("part"),
messageID: info.id,
sessionID: input.sessionID,
type: "text",
synthetic: true,
text: result.output,
},
{
pieces.push({
id: Identifier.ascending("part"),
messageID: info.id,
sessionID: input.sessionID,
type: "text",
synthetic: true,
text: result.output,
})
if (result.attachments?.length) {
pieces.push(
...result.attachments.map((attachment) => ({
...attachment,
synthetic: true,
filename: attachment.filename ?? part.filename,
messageID: info.id,
sessionID: input.sessionID,
})),
)
} else {
pieces.push({
...part,
id: part.id ?? Identifier.ascending("part"),
messageID: info.id,
sessionID: input.sessionID,
},
)
})
}
})
.catch((error) => {
log.error("failed to read file", { error })

View file

@ -24,4 +24,4 @@
"typescript": "catalog:",
"@typescript/native-preview": "catalog:"
}
}
}

View file

@ -26,4 +26,4 @@
"publishConfig": {
"directory": "dist"
}
}
}