mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
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:
parent
0dd5039668
commit
bdcf864678
3 changed files with 24 additions and 14 deletions
|
|
@ -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 })
|
||||
|
|
|
|||
|
|
@ -24,4 +24,4 @@
|
|||
"typescript": "catalog:",
|
||||
"@typescript/native-preview": "catalog:"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,4 @@
|
|||
"publishConfig": {
|
||||
"directory": "dist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue