Merge message parts props

This commit is contained in:
Shantur Rathore
2025-12-01 23:20:44 +00:00
parent 6d5836ce1f
commit 5384ff8e80
2 changed files with 9 additions and 9 deletions

View File

@@ -10,8 +10,7 @@ interface MessageItemProps {
instanceId: string
sessionId: string
isQueued?: boolean
combinedParts: ClientPart[]
orderedParts: ClientPart[]
parts: ClientPart[]
onRevert?: (messageId: string) => void
onFork?: (messageId?: string) => void
showAgentMeta?: boolean
@@ -36,10 +35,11 @@ interface MessageItemProps {
filename?: string
}
const combinedParts = () => props.combinedParts
const messageParts = () => props.parts
const fileAttachments = () =>
props.orderedParts.filter((part): part is FilePart => part?.type === "file" && typeof (part as FilePart).url === "string")
messageParts().filter((part): part is FilePart => part?.type === "file" && typeof (part as FilePart).url === "string")
const getAttachmentName = (part: FilePart) => {
if (part.filename && part.filename.trim().length > 0) {
@@ -129,7 +129,7 @@ interface MessageItemProps {
return true
}
return combinedParts().some((part) => partHasRenderableText(part))
return messageParts().some((part) => partHasRenderableText(part))
}
const isGenerating = () => {
@@ -237,7 +237,7 @@ interface MessageItemProps {
</div>
</Show>
<For each={combinedParts()}>
<For each={messageParts()}>
{(part) => (
<MessagePart
part={part}

View File

@@ -903,12 +903,12 @@ function MessageBlock(props: MessageBlockProps) {
<MessageItem
record={(item as ContentDisplayItem).record}
messageInfo={(item as ContentDisplayItem).messageInfo}
combinedParts={(item as ContentDisplayItem).parts}
orderedParts={(item as ContentDisplayItem).parts}
parts={(item as ContentDisplayItem).parts}
instanceId={props.instanceId}
sessionId={props.sessionId}
isQueued={(item as ContentDisplayItem).isQueued}
showAgentMeta={(item as ContentDisplayItem).showAgentMeta}
onRevert={props.onRevert}
onFork={props.onFork}
onContentRendered={props.onContentRendered}