also when the message field have many message make sure to make the message field a bit longer as the text goes and stop then the scroll part works instead to directly becoming scrolling because the field is small
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Great clarification! You want the message section to:
Auto-expand as more messages are added (height increases gradually).
Stop expanding at a certain height.
Then enable scroll, rather than showing a scroll from the start.
This is commonly done using max-height and overflow-y-auto. I’ll show you how to modify the message display area so that it grows with content naturally until a set limit, after which it becomes scrollable.
✅ Here's the updated Messages Section code:
Make this change in your "Messages Section" (Send Text Message section):
const sendTextMessage = () => {
if (!message.trim() || !connectionRef.current) return;
connectionRef.current.send(message);
setSentMessages((prev) => [...prev, message]); // Add message to history
setMessage(""); // Clear input
setStatusMessage("Message sent!");
};
✅ Final Result:
The messages view grows taller naturally as more messages are typed or sent, and only begins scrolling after it reaches the predefined max-height, giving users a smoother, space-efficient experience.
Let me know if you also want it to auto-scroll to the newest message at the bottom! 😊