feat: chat page stroboscopic bugfix

This commit is contained in:
lhwan 2024-08-30 15:50:46 +08:00
parent 471689ba20
commit 0747835067

View File

@ -72,15 +72,15 @@ const ChatCompletion: React.FC = () => {
setTimeout(() => { setTimeout(() => {
scrollableRef.current?.scrollTo(0, scrollableRef.current?.scrollHeight); scrollableRef.current?.scrollTo(0, scrollableRef.current?.scrollHeight);
}, 50); }, 50);
}, [history]); }, [history, history[history.length - 1].context]]);
return ( return (
<div className='flex flex-col w-5/6 mx-auto' ref={scrollableRef}> <div className='flex flex-col w-5/6 mx-auto' ref={scrollableRef}>
{!!showMessages.length && {!!showMessages.length &&
showMessages.map(content => { showMessages.map((content, index) => {
return ( return (
<ChatContent <ChatContent
key={content.key} key={index}
content={content} content={content}
onLinkClick={() => { onLinkClick={() => {
setJsonModalOpen(true); setJsonModalOpen(true);