fix(frontend): hide history reliably in welcome mode

This commit is contained in:
肖应宇 2026-04-09 13:12:08 +08:00
parent 883dd58275
commit 0a619f6603
1 changed files with 13 additions and 5 deletions

View File

@ -135,10 +135,16 @@ export default function ChatPage() {
setHistoryCutoff(null);
return;
}
if (historyCutoff === null && !thread.isThreadLoading) {
setHistoryCutoff(thread.messages.length);
}
if (hasSubmitted) return;
// Welcome 态下、未提交前,把当前已有消息都当作“历史”切掉。
// 这样即使历史消息是后续异步补齐,也不会重新露出。
setHistoryCutoff((prev) => {
const next = thread.messages.length;
if (prev === null) return next;
return next > prev ? next : prev;
});
}, [
hasSubmitted,
historyCutoff,
shouldRenderHistory,
thread.isThreadLoading,
@ -331,9 +337,11 @@ export default function ChatPage() {
threadId={threadId}
thread={thread}
messagesOverride={
shouldRenderHistory || historyCutoff === null
shouldRenderHistory
? undefined
: thread.messages.slice(historyCutoff)
: historyCutoff === null
? []
: thread.messages.slice(historyCutoff)
}
paddingBottom={todoListCollapsed ? 160 : 280}
showScrollToBottomButton={!showWelcomeStyle}