From 913533246756c557e7e962afc8fbfd8f49f46139 Mon Sep 17 00:00:00 2001 From: john Date: Thu, 2 Jul 2026 18:39:59 +0800 Subject: [PATCH] fix: hide fully loaded history notice --- src/components/ChatPanel.tsx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/components/ChatPanel.tsx b/src/components/ChatPanel.tsx index f2ce29b..dfbf98a 100644 --- a/src/components/ChatPanel.tsx +++ b/src/components/ChatPanel.tsx @@ -129,7 +129,6 @@ export function ChatPanel({ const [pendingImages, setPendingImages] = useState([]); const [uploadingImage, setUploadingImage] = useState(false); const [imageError, setImageError] = useState(null); - const [showHistoryFullyLoadedNotice, setShowHistoryFullyLoadedNotice] = useState(false); const [voiceStopSignal, setVoiceStopSignal] = useState(0); const [randomPrompt] = useState( () => CHAT_PLACEHOLDER_PROMPTS[Math.floor(Math.random() * CHAT_PLACEHOLDER_PROMPTS.length)], @@ -197,22 +196,8 @@ export function ChatPanel({ initializedSessionRef.current = null; pendingOlderLoadRef.current = null; nearBottomRef.current = true; - setShowHistoryFullyLoadedNotice(false); }, [session?.id]); - useEffect(() => { - const isHomeWelcome = variant !== 'compact' && messages.length === 0; - if (isHomeWelcome || historyTotal <= 0 || historyHasMore || historyLoadingMore) { - setShowHistoryFullyLoadedNotice(false); - return; - } - setShowHistoryFullyLoadedNotice(true); - const timer = window.setTimeout(() => { - setShowHistoryFullyLoadedNotice(false); - }, 5000); - return () => window.clearTimeout(timer); - }, [historyHasMore, historyLoadingMore, historyTotal, messages.length, variant]); - useLayoutEffect(() => { const container = mainRef.current; if (!container) return; @@ -555,13 +540,11 @@ export function ChatPanel({ className={compact ? 'space-chat-panel-body' : `main${showHomeWelcome ? ' main-home' : ''}`} onScroll={handleMainScroll} > - {!showHomeWelcome && (historyLoadingMore || historyHasMore || showHistoryFullyLoadedNotice) && ( + {!showHomeWelcome && (historyLoadingMore || historyHasMore) && (
{historyLoadingMore ? `正在加载更早消息… 已加载 ${messages.length}${historyTotal > 0 ? ` / ${historyTotal}` : ''}` - : historyHasMore - ? `向上滚动加载更早消息${historyTotal > 0 ? ` · 已加载 ${messages.length} / ${historyTotal}` : ''}` - : `历史消息已全部加载${historyTotal > 0 ? ` · ${messages.length} / ${historyTotal}` : ''}`} + : `向上滚动加载更早消息${historyTotal > 0 ? ` · 已加载 ${messages.length} / ${historyTotal}` : ''}`}
)}