fix(frontend): hide history reliably in welcome mode
This commit is contained in:
parent
ce02c40b87
commit
a914c1dc19
|
|
@ -135,10 +135,16 @@ export default function ChatPage() {
|
||||||
setHistoryCutoff(null);
|
setHistoryCutoff(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (historyCutoff === null && !thread.isThreadLoading) {
|
if (hasSubmitted) return;
|
||||||
setHistoryCutoff(thread.messages.length);
|
// Welcome 态下、未提交前,把当前已有消息都当作“历史”切掉。
|
||||||
}
|
// 这样即使历史消息是后续异步补齐,也不会重新露出。
|
||||||
|
setHistoryCutoff((prev) => {
|
||||||
|
const next = thread.messages.length;
|
||||||
|
if (prev === null) return next;
|
||||||
|
return next > prev ? next : prev;
|
||||||
|
});
|
||||||
}, [
|
}, [
|
||||||
|
hasSubmitted,
|
||||||
historyCutoff,
|
historyCutoff,
|
||||||
shouldRenderHistory,
|
shouldRenderHistory,
|
||||||
thread.isThreadLoading,
|
thread.isThreadLoading,
|
||||||
|
|
@ -331,8 +337,10 @@ export default function ChatPage() {
|
||||||
threadId={threadId}
|
threadId={threadId}
|
||||||
thread={thread}
|
thread={thread}
|
||||||
messagesOverride={
|
messagesOverride={
|
||||||
shouldRenderHistory || historyCutoff === null
|
shouldRenderHistory
|
||||||
? undefined
|
? undefined
|
||||||
|
: historyCutoff === null
|
||||||
|
? []
|
||||||
: thread.messages.slice(historyCutoff)
|
: thread.messages.slice(historyCutoff)
|
||||||
}
|
}
|
||||||
paddingBottom={todoListCollapsed ? 160 : 280}
|
paddingBottom={todoListCollapsed ? 160 : 280}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue