Fix assistant message display with content fallback

• Add content fallback for compatibility
• Update comment for clarity
• Prevent empty assistant messages
This commit is contained in:
yangdx 2025-09-08 23:35:31 +08:00
parent ff6c061aa9
commit 3912b7d281

View file

@ -50,10 +50,10 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { //
// The content to display is now non-ambiguous.
const finalThinkingContent = thinkingContent
// For user messages, displayContent will be undefined, so we fall back to content.
// For assistant messages, we prefer displayContent and don't fallback to avoid content leakage during thinking
// For assistant messages, we prefer displayContent but fallback to content for backward compatibility
const finalDisplayContent = message.role === 'user'
? message.content
: displayContent || ''
: displayContent || message.content || ''
// Load KaTeX dynamically
useEffect(() => {