diff --git a/src/components/layouts/dashboard-layout.jsx b/src/components/layouts/dashboard-layout.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/ui/ChatWindow.jsx b/src/components/ui/ChatWindow.jsx index 649180f..9f35aba 100644 --- a/src/components/ui/ChatWindow.jsx +++ b/src/components/ui/ChatWindow.jsx @@ -1,5 +1,5 @@ import React from "react"; - +import { useRef } from "react"; function MessageBubble({ message }) { const isUser = message.role === "user"; return ( @@ -16,6 +16,15 @@ function MessageBubble({ message }) { } export default function ChatWindow({ messages }) { + const chatRef = useRef(null); + // Auto-scroll to bottom when new messages appear + useEffect(() => { + chatRef.current?.scrollTo({ + top: chatRef.current.scrollHeight, + behavior: "smooth", + }); + }, [messages]); + return (