Skip to content

Commit c392e50

Browse files
mmngaysmmngangxson
authored
server (webui): Fix Premature Submission During IME Conversion (#11971)
* fix skip ime composing * fix npm rebuild * fix warn --------- Co-authored-by: momonga <115213907+mmnga@users.noreply.github.com> Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
1 parent c5d91a7 commit c392e50

File tree

3 files changed

+2
-1
lines changed

3 files changed

+2
-1
lines changed

examples/server/public/index.html.gz

37 Bytes
Binary file not shown.

examples/server/webui/src/components/ChatScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ export default function ChatScreen() {
228228
value={inputMsg}
229229
onChange={(e) => setInputMsg(e.target.value)}
230230
onKeyDown={(e) => {
231+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
231232
if (e.key === 'Enter' && e.shiftKey) return;
232233
if (e.key === 'Enter' && !e.shiftKey) {
233234
e.preventDefault();

examples/server/webui/src/utils/llama-vscode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const useVSCodeContext = (
4040

4141
window.addEventListener('message', handleMessage);
4242
return () => window.removeEventListener('message', handleMessage);
43-
}, []);
43+
}, [inputRef, setInputMsg]);
4444

4545
// Add a keydown listener that sends the "escapePressed" message to the parent window
4646
useEffect(() => {

0 commit comments

Comments
 (0)