Merge pull request #3916 from BerriAI/litellm_submit_chat_on_enter

fix  - submit chat on enter
This commit is contained in:
Ishaan Jaff 2024-05-29 21:09:33 -07:00 • committed by GitHub
commit 373ad49a7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,6 +149,12 @@ const ChatUI: React.FC<ChatUIProps> = ({
});
};
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
handleSendMessage();
}
};
const handleSendMessage = async () => {
if (inputMessage.trim() === "") return;
@ -260,6 +266,7 @@ const ChatUI: React.FC<ChatUIProps> = ({
type="text"
value={inputMessage}
onChange={(e) => setInputMessage(e.target.value)}
onKeyDown={handleKeyDown} // Add this line
placeholder="Type your message..."
/>
<Button