Skip to content

Commit

Permalink
Merge pull request elizaOS#2274 from lincheoll/2272--fix-ime-multiple…
Browse files Browse the repository at this point in the history
…-messages

Fix: IME causes multiple messages on Enter (Fixes elizaOS#2272)
  • Loading branch information
tcm390 authored Jan 14, 2025
2 parents 58e9f7c + 8f49482 commit 432fbca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ export default function Page({ agentId }: { agentId: UUID }) {

const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
if (e.nativeEvent.isComposing) return;
handleSendMessage(e as unknown as React.FormEvent<HTMLFormElement>);
}
};


const handleSendMessage = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (!input) return;
Expand Down

0 comments on commit 432fbca

Please sign in to comment.