From 921d670f53f300df54efd8e281b863cb8059e01a Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 22 Dec 2022 22:09:54 +0800 Subject: [PATCH] feat: the slash command is triggered by the enter key --- src-tauri/src/assets/cmd.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src-tauri/src/assets/cmd.js b/src-tauri/src/assets/cmd.js index 71c8cfe..186a85e 100644 --- a/src-tauri/src/assets/cmd.js +++ b/src-tauri/src/assets/cmd.js @@ -86,15 +86,11 @@ async function cmdTip() { return; } - if (event.keyCode === 32) { + if (event.keyCode === 13 && window.__CHAT_MODEL_CMD__) { searchInput.value = window.__CHAT_MODEL_CMD__; modelDom.innerHTML = ''; delete window.__CHAT_MODEL_CMD__; } - if (event.keyCode === 13) { - modelDom.innerHTML = ''; - delete window.__CHAT_MODEL_CMD__; - } }); searchInput.addEventListener('input', (event) => {