Skip to content
Merged
17 changes: 8 additions & 9 deletions web-app/src/containers/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ const ChatInput = ({
)}
<TextareaAutosize
ref={textareaRef}
disabled={Boolean(streamingContent)}
minRows={2}
rows={1}
maxRows={10}
Expand All @@ -625,15 +624,15 @@ const ChatInput = ({
// e.keyCode 229 is for IME input with Safari
const isComposing =
e.nativeEvent.isComposing || e.keyCode === 229
if (
e.key === 'Enter' &&
!e.shiftKey &&
prompt.trim() &&
!isComposing
) {
if (e.key === 'Enter' && !e.shiftKey && !isComposing) {
e.preventDefault()
// Submit the message when Enter is pressed without Shift
handleSendMessage(prompt)
// Submit prompt when the following conditions are met:
// - Enter is pressed without Shift
// - The streaming content has finished
// - Prompt is not empty
if (!streamingContent && prompt.trim()) {
handleSendMesage(prompt)
}
// When Shift+Enter is pressed, a new line is added (default behavior)
}
}}
Expand Down
Loading