mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-22 11:25:15 +00:00
core: fix crash when message attachments array is undefined
Prevents runtime errors by ensuring undefined attachments are converted to an empty array before spreading into the message parts. This fixes scenarios where tool responses without attachments would cause the session processor to fail.
This commit is contained in:
parent
b46b09450a
commit
f5abbfabbf
1 changed files with 2 additions and 2 deletions
|
|
@ -386,12 +386,12 @@ export const layer: Layer.Layer<
|
|||
type: "text",
|
||||
text: value.output.output,
|
||||
},
|
||||
...value.output.attachments?.map((item: MessageV2.FilePart) => ({
|
||||
...(value.output.attachments?.map((item: MessageV2.FilePart) => ({
|
||||
type: "file",
|
||||
uri: item.url,
|
||||
mime: item.mime,
|
||||
name: item.filename,
|
||||
})),
|
||||
})) ?? []),
|
||||
],
|
||||
provider: {
|
||||
executed: toolCall?.part.metadata?.providerExecuted === true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue