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:
parent
ff6c061aa9
commit
3912b7d281
1 changed files with 2 additions and 2 deletions
|
|
@ -50,10 +50,10 @@ export const ChatMessage = ({ message }: { message: MessageWithError }) => { //
|
||||||
// The content to display is now non-ambiguous.
|
// The content to display is now non-ambiguous.
|
||||||
const finalThinkingContent = thinkingContent
|
const finalThinkingContent = thinkingContent
|
||||||
// For user messages, displayContent will be undefined, so we fall back to content.
|
// 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'
|
const finalDisplayContent = message.role === 'user'
|
||||||
? message.content
|
? message.content
|
||||||
: displayContent || ''
|
: displayContent || message.content || ''
|
||||||
|
|
||||||
// Load KaTeX dynamically
|
// Load KaTeX dynamically
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue