diff --git a/ui/components/Chat.tsx b/ui/components/Chat.tsx index 81aa32f..0cf125b 100644 --- a/ui/components/Chat.tsx +++ b/ui/components/Chat.tsx @@ -48,11 +48,17 @@ const Chat = ({ }); useEffect(() => { - messageEnd.current?.scrollIntoView({ behavior: 'smooth' }); + const scroll = () => { + messageEnd.current?.scrollIntoView({ behavior: 'smooth' }); + }; if (messages.length === 1) { document.title = `${messages[0].content.substring(0, 30)} - Perplexica`; } + + if (messages[messages.length - 1]?.role == 'user') { + scroll(); + } }, [messages]); return (