fix: log detail panel not showing any message when total count greate… (#10119)

This commit is contained in:
Hash Brown
2024-10-31 16:02:20 +08:00
committed by GitHub
parent 0154a26e0b
commit 73f29484e7
4 changed files with 288 additions and 2 deletions

View File

@@ -134,6 +134,12 @@ function buildChatItemTree(allMessages: IChatItem[]): ChatItemInTree[] {
}
}
// If no messages have parentMessageId=null (indicating a root node),
// then we likely have a partial chat history. In this case,
// use the first available message as the root node.
if (rootNodes.length === 0 && allMessages.length > 0)
rootNodes.push(map[allMessages[0]!.id]!)
return rootNodes
}