mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
Merge pull request #3916 from BerriAI/litellm_submit_chat_on_enter
fix - submit chat on enter
This commit is contained in:
commit
373ad49a7d
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
Reference in a new issue