scroll to bottom at message sent

This commit is contained in:
2025-01-08 22:49:52 +08:00
parent f0db9e6b03
commit ba64aec5b0

View File

@@ -347,6 +347,10 @@ export default function ChatBOX() {
// when user click the "send" button or ctrl+Enter in the textarea // when user click the "send" button or ctrl+Enter in the textarea
const send = async (msg = "", call_complete = true) => { const send = async (msg = "", call_complete = true) => {
if (messagesEndRef.current) {
messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
}
const inputMsg = msg.trim(); const inputMsg = msg.trim();
if (!inputMsg && images.length === 0) { if (!inputMsg && images.length === 0) {
console.log("empty message"); console.log("empty message");