Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,16 @@ export const Chat = ({ autoResume }: { autoResume: boolean }) => {

const handleScrollToBottom = () => scrollToBottom({ force: true });

const handleSubmitWithScroll = useCallback(
(e: React.FormEvent) => {
if (!isAtBottom) {
scrollToBottom({ force: true });
}
handleSubmit(e);
},
[isAtBottom, scrollToBottom, handleSubmit],
);

// Rate limit warning dismiss handler
const handleDismissRateLimitWarning = () => {
setRateLimitWarning(null);
Expand Down Expand Up @@ -871,7 +881,7 @@ export const Chat = ({ autoResume }: { autoResume: boolean }) => {
{!isMobile && (
<div className="w-full">
<ChatInput
onSubmit={handleSubmit}
onSubmit={handleSubmitWithScroll}
onStop={handleStop}
onSendNow={handleSendNow}
status={displayStatus}
Expand Down Expand Up @@ -905,7 +915,7 @@ export const Chat = ({ autoResume }: { autoResume: boolean }) => {
{(hasMessages || isExistingChat || isMobile) &&
!isChatNotFound && (
<ChatInput
onSubmit={handleSubmit}
onSubmit={handleSubmitWithScroll}
onStop={handleStop}
onSendNow={handleSendNow}
status={displayStatus}
Expand Down
Loading