Merge message parts props
This commit is contained in:
@@ -10,8 +10,7 @@ interface MessageItemProps {
|
|||||||
instanceId: string
|
instanceId: string
|
||||||
sessionId: string
|
sessionId: string
|
||||||
isQueued?: boolean
|
isQueued?: boolean
|
||||||
combinedParts: ClientPart[]
|
parts: ClientPart[]
|
||||||
orderedParts: ClientPart[]
|
|
||||||
onRevert?: (messageId: string) => void
|
onRevert?: (messageId: string) => void
|
||||||
onFork?: (messageId?: string) => void
|
onFork?: (messageId?: string) => void
|
||||||
showAgentMeta?: boolean
|
showAgentMeta?: boolean
|
||||||
@@ -36,10 +35,11 @@ interface MessageItemProps {
|
|||||||
filename?: string
|
filename?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const combinedParts = () => props.combinedParts
|
const messageParts = () => props.parts
|
||||||
|
|
||||||
const fileAttachments = () =>
|
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) => {
|
const getAttachmentName = (part: FilePart) => {
|
||||||
if (part.filename && part.filename.trim().length > 0) {
|
if (part.filename && part.filename.trim().length > 0) {
|
||||||
@@ -129,7 +129,7 @@ interface MessageItemProps {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return combinedParts().some((part) => partHasRenderableText(part))
|
return messageParts().some((part) => partHasRenderableText(part))
|
||||||
}
|
}
|
||||||
|
|
||||||
const isGenerating = () => {
|
const isGenerating = () => {
|
||||||
@@ -237,7 +237,7 @@ interface MessageItemProps {
|
|||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<For each={combinedParts()}>
|
<For each={messageParts()}>
|
||||||
{(part) => (
|
{(part) => (
|
||||||
<MessagePart
|
<MessagePart
|
||||||
part={part}
|
part={part}
|
||||||
|
|||||||
@@ -903,12 +903,12 @@ function MessageBlock(props: MessageBlockProps) {
|
|||||||
<MessageItem
|
<MessageItem
|
||||||
record={(item as ContentDisplayItem).record}
|
record={(item as ContentDisplayItem).record}
|
||||||
messageInfo={(item as ContentDisplayItem).messageInfo}
|
messageInfo={(item as ContentDisplayItem).messageInfo}
|
||||||
combinedParts={(item as ContentDisplayItem).parts}
|
parts={(item as ContentDisplayItem).parts}
|
||||||
orderedParts={(item as ContentDisplayItem).parts}
|
|
||||||
instanceId={props.instanceId}
|
instanceId={props.instanceId}
|
||||||
sessionId={props.sessionId}
|
sessionId={props.sessionId}
|
||||||
isQueued={(item as ContentDisplayItem).isQueued}
|
isQueued={(item as ContentDisplayItem).isQueued}
|
||||||
showAgentMeta={(item as ContentDisplayItem).showAgentMeta}
|
showAgentMeta={(item as ContentDisplayItem).showAgentMeta}
|
||||||
|
|
||||||
onRevert={props.onRevert}
|
onRevert={props.onRevert}
|
||||||
onFork={props.onFork}
|
onFork={props.onFork}
|
||||||
onContentRendered={props.onContentRendered}
|
onContentRendered={props.onContentRendered}
|
||||||
|
|||||||
Reference in New Issue
Block a user