lmstudio-ai / lmstudio-bug-tracker

Bug tracking for the LM Studio desktop application
10 stars 3 forks source link

Pressing the Enter key in the case of an inputmethod causes the message to be sent #56

Open blackhu opened 4 months ago

blackhu commented 4 months ago

LM Studio version 0.2.27 For Mac OS: Macos 14.5

For the shortcut keys to send messages, refer to the following code

let isComposing = false;

document.addEventListener('compositionstart', () => {
  isComposing = true;
});

document.addEventListener('compositionend', () => {
  isComposing = false;
});

document.addEventListener('keydown', (event) => {
  if (isComposing) {
    return;
  }

  if (event.key === 'Enter') {
    console.log('Enter key pressed');
  }
});