mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix - submit chat on enter
This commit is contained in:
parent
6f063156be
commit
e6b68f35fd
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue