From ff2790ee7f9a011af91b6eeaa3c76341512ac9b6 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 24 Mar 2025 14:43:39 +0900 Subject: [PATCH] Fix hotkey --- src/ts/hotkey.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ts/hotkey.ts b/src/ts/hotkey.ts index a24b7c42..3b26eaa1 100644 --- a/src/ts/hotkey.ts +++ b/src/ts/hotkey.ts @@ -9,7 +9,7 @@ import { doingChat, previewBody, sendChat } from "./process/index.svelte" import { getRequestLog } from "./globalApi.svelte" export function initHotkey(){ - document.addEventListener('keydown', (ev) => { + document.addEventListener('keydown', async (ev) => { if( !ev.ctrlKey && !ev.altKey && @@ -154,7 +154,9 @@ export function initHotkey(){ return false } alertWait("Loading...") - sendChat(-1, { + ev.preventDefault() + ev.stopPropagation() + await sendChat(-1, { previewPrompt: true }) @@ -163,7 +165,7 @@ export function initHotkey(){ md += '```json\n' + JSON.stringify(JSON.parse(previewBody), null, 2).replaceAll('```', '\\`\\`\\`') + '\n```\n' doingChat.set(false) alertMd(md) - break + return } case 'toggleLog':{ alertMd(getRequestLog())