diff --git a/static/script.js b/static/script.js index 72221c7..8b68b5e 100644 --- a/static/script.js +++ b/static/script.js @@ -8,10 +8,8 @@ const sendButton = document.getElementById("sendButton"); const session_uuid = self.crypto.randomUUID(); sendButton.addEventListener("click", () => { - sendMessage(); -} -); - + sendMessage(); +}); promptInput.addEventListener("input", () => { if (promptInput.value.split("\n").length == 1) { @@ -22,7 +20,7 @@ promptInput.addEventListener("input", () => { } }); -promptInput.addEventListener("keypress", () => { +promptInput.addEventListener("keydown", () => { handleKeyPress(event); }); @@ -107,6 +105,10 @@ function hideTypingIndicator() { } function handleKeyPress(event) { + if (event.isComposing || event.keyCode === 229) { + return; + } + if (event.key == "Enter" && !event.shiftKey) { event.preventDefault(); sendMessage();