-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
When the chat is loading (isGenerating=true), and you press Enter, the chat shows an interrupt prompt as intended. But when you press Enter again to interrupt, it does stop but it then causes onSubmit event two times.
The issue is inside message-input.tsx, in onKeyDown(), requestSubmit is called multiple times, first inside if statement and second outside.
const onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (submitOnEnter && event.key === "Enter" && !event.shiftKey) {
event.preventDefault()
if (isGenerating && stop && enableInterrupt) {
if (showInterruptPrompt) {
stop()
setShowInterruptPrompt(false)
event.currentTarget.form?.requestSubmit() // <---- this one
} else if (
props.value ||
(props.allowAttachments && props.files?.length)
) {
setShowInterruptPrompt(true)
return
}
}
event.currentTarget.form?.requestSubmit() // <---- or this one
}
onKeyDownProp?.(event)
}
The fix is perhaps to remove the requestSubmit call inside the if statement, so submission is triggered by default, I guess.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels