Merge branch 'codex/0702-optimization'

This commit is contained in:
john
2026-07-02 18:40:41 +08:00
2 changed files with 4 additions and 25 deletions
+2 -19
View File
@@ -129,7 +129,6 @@ export function ChatPanel({
const [pendingImages, setPendingImages] = useState<PendingChatImage[]>([]);
const [uploadingImage, setUploadingImage] = useState(false);
const [imageError, setImageError] = useState<string | null>(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) && (
<div className="chat-history-loader" role="status">
{historyLoadingMore
? `正在加载更早消息… 已加载 ${messages.length}${historyTotal > 0 ? ` / ${historyTotal}` : ''}`
: historyHasMore
? `向上滚动加载更早消息${historyTotal > 0 ? ` · 已加载 ${messages.length} / ${historyTotal}` : ''}`
: `历史消息已全部加载${historyTotal > 0 ? ` · ${messages.length} / ${historyTotal}` : ''}`}
: `向上滚动加载更早消息${historyTotal > 0 ? ` · 已加载 ${messages.length} / ${historyTotal}` : ''}`}
</div>
)}
<MessageList
+2 -6
View File
@@ -377,12 +377,8 @@ export function useTKMindChat(
setMemoryLoading(true);
try {
const result = await bootstrapProjectMemory(sessionId, appConfig.memoryQuery, force);
if (force) {
setNotice(
result.summary
? `项目记忆已刷新(${result.source}`
: '未找到可用的项目记忆,当前会话仍可正常使用',
);
if (force && !result.summary) {
setNotice('未找到可用的项目记忆,当前会话仍可正常使用');
}
return result;
} catch (err) {