Skip to content

Self-hosted AI workspace.

Python

fix(ui): don't submit chat message on Enter during IME composition (#1091)

3ASiCd232b2c4b60d
diff --git a/static/app.js b/static/app.js
index 2764b9061..a848193ff 100644
--- a/static/app.js
+++ b/static/app.js
@@ -3160,7 +3160,7 @@ function initializeEventListeners() {
setTimeout(() => uiModule.autoResize(textarea), 1);
});
textarea.addEventListener('keydown', (e) => {
- if (e.key === 'Enter' && !e.shiftKey) {
+ if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) {
// If ghost autocomplete is active, accept the suggestion instead of submitting
if (window._ghostAutocomplete && window._ghostAutocomplete.isActive()) {
e.preventDefault();
@@ -3733,7 +3733,7 @@ function startOdysseusApp() {
// Enter to send (shift+enter for newline), or new chat when empty
if (messageInput) {
messageInput.addEventListener('keydown', (e) => {
- if (e.key === 'Enter' && !e.shiftKey) {
+ if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) {
e.preventDefault();
// Flush the debounced icon update so dataset.mode reflects the current
// text state. Without this, a fast type-and-Enter would still see the
diff --git a/static/js/chat.js b/static/js/chat.js
index cde0e6ee8..10f7e0547 100644
--- a/static/js/chat.js
+++ b/static/js/chat.js
@@ -3424,7 +3424,7 @@ import createResearchSynapse from './researchSynapse.js';
// Also submit on Enter (without shift)
editor.addEventListener('keydown', (e) => {
- if (e.key === 'Enter' && !e.shiftKey) {
+ if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) {
e.preventDefault();
saveBtn.click();
}