From 3912b7d28150f189be48d8fb22a691763ef2d2a9 Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 8 Sep 2025 23:35:31 +0800 Subject: [PATCH] Fix assistant message display with content fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add content fallback for compatibility • Update comment for clarity • Prevent empty assistant messages --- lightrag_webui/src/components/retrieval/ChatMessage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightrag_webui/src/components/retrieval/ChatMessage.tsx b/lightrag_webui/src/components/retrieval/ChatMessage.tsx index 13cb74ed..c83169d9 100644 --- a/lightrag_webui/src/components/retrieval/ChatMessage.tsx +++ b/lightrag_webui/src/components/retrieval/ChatMessage.tsx @@ -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(() => {