Hide empty assistant messages until content arrives

This commit is contained in:
Shantur Rathore
2025-10-30 14:47:51 +00:00
parent 7e25f20e74
commit fb85fcb3f3

View File

@@ -294,6 +294,13 @@ export default function MessageStream(props: MessageStreamProps) {
const version = message.version ?? 0 const version = message.version ?? 0
const isQueued = message.type === "user" && (lastAssistantIndex === -1 || index > lastAssistantIndex) const isQueued = message.type === "user" && (lastAssistantIndex === -1 || index > lastAssistantIndex)
const hasRenderableContent =
message.type !== "assistant" ||
combinedParts.length > 0 ||
Boolean(messageInfo?.error) ||
message.status === "error"
if (hasRenderableContent) {
const cacheEntry = messageItemCache.get(message.id) const cacheEntry = messageItemCache.get(message.id)
if ( if (
cacheEntry && cacheEntry &&
@@ -331,6 +338,7 @@ export default function MessageStream(props: MessageStreamProps) {
}) })
items.push(messageItem) items.push(messageItem)
} }
}
for (let toolIndex = 0; toolIndex < displayParts.tool.length; toolIndex++) { for (let toolIndex = 0; toolIndex < displayParts.tool.length; toolIndex++) {
const toolPart = displayParts.tool[toolIndex] const toolPart = displayParts.tool[toolIndex]