Fix: If there is an error message on the chat page, the subsequent message references will not display correctly. #12252 (#12283)

### What problem does this PR solve?

Fix: If there is an error message on the chat page, the subsequent
message references will not display correctly. #12252

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-12-29 12:58:12 +08:00
committed by GitHub
parent 37e4485415
commit a24fc8291b
2 changed files with 5 additions and 2 deletions

View File

@ -213,7 +213,7 @@ const MarkdownContent = ({
return (
<HoverCard key={i}>
<HoverCardTrigger>
<span className="text-text-secondary bg-bg-card rounded-2xl px-1 mx-1">
<span className="text-text-secondary bg-bg-card rounded-2xl px-1 mx-1 text-nowrap">
Fig. {chunkIndex + 1}
</span>
</HoverCardTrigger>

View File

@ -32,7 +32,10 @@ export const buildMessageItemReference = (
message: IMessage,
) => {
const assistantMessages = conversation.message
?.filter((x) => x.role === MessageType.Assistant)
?.filter(
(x) =>
x.role === MessageType.Assistant && !x.content.startsWith('**ERROR**:'), // Exclude error messages
)
.slice(1);
const referenceIndex = assistantMessages.findIndex(
(x) => x.id === message.id,