]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server (webui): Fix Premature Submission During IME Conversion (#11971)
authormomonga <redacted>
Thu, 20 Feb 2025 18:43:22 +0000 (03:43 +0900)
committerGitHub <redacted>
Thu, 20 Feb 2025 18:43:22 +0000 (19:43 +0100)
* fix skip ime composing

* fix npm rebuild

* fix warn

---------

Co-authored-by: momonga <redacted>
Co-authored-by: Xuan Son Nguyen <redacted>
examples/server/public/index.html.gz
examples/server/webui/src/components/ChatScreen.tsx
examples/server/webui/src/utils/llama-vscode.ts

index 3acd603ab94de8800ebe6682cc8babdc2fbcf46b..e6a22a4e3770f7ffd9851c7991a6a514f7856061 100644 (file)
Binary files a/examples/server/public/index.html.gz and b/examples/server/public/index.html.gz differ
index 80012c3e4c3c56a002a9bc085d2c236b7599c6c1..d7a246cf6a986a265c70d292fb3dc66f15e29ad8 100644 (file)
@@ -228,6 +228,7 @@ export default function ChatScreen() {
             value={inputMsg}
             onChange={(e) => setInputMsg(e.target.value)}
             onKeyDown={(e) => {
+              if (e.nativeEvent.isComposing || e.keyCode === 229) return;
               if (e.key === 'Enter' && e.shiftKey) return;
               if (e.key === 'Enter' && !e.shiftKey) {
                 e.preventDefault();
index 6c23221c4731cc732e06ad90e3ad21f11d5e4df2..76cc553a2b38867af7b570dfc0c8ad855681863b 100644 (file)
@@ -40,7 +40,7 @@ export const useVSCodeContext = (
 
     window.addEventListener('message', handleMessage);
     return () => window.removeEventListener('message', handleMessage);
-  }, []);
+  }, [inputRef, setInputMsg]);
 
   // Add a keydown listener that sends the "escapePressed" message to the parent window
   useEffect(() => {