diff --git a/src/components/ChatDrawer/ChatDrawer.vue b/src/components/ChatDrawer/ChatDrawer.vue index 557245dee..d65804816 100644 --- a/src/components/ChatDrawer/ChatDrawer.vue +++ b/src/components/ChatDrawer/ChatDrawer.vue @@ -65,12 +65,14 @@ async function onAddChat() { } async function hideChat() { - const confirm = await confirmModal.value.showModal( - i18n.global.t("modal.confirmHideChat"), - ); + const confirm = store.state.general.isSkipDeleteChatConfirm || + await confirmModal.value.showModal( + i18n.global.t("modal.confirmHideChat"), + ); + if (confirm) { await Chats.update(store.state.currentChatIndex, { hide: true }); - selectLatestVisibleChat(); + await selectLatestVisibleChat(); } } diff --git a/src/components/ChatDrawer/ChatDrawerItem.vue b/src/components/ChatDrawer/ChatDrawerItem.vue index 380500849..2408f3c0f 100644 --- a/src/components/ChatDrawer/ChatDrawerItem.vue +++ b/src/components/ChatDrawer/ChatDrawerItem.vue @@ -25,6 +25,9 @@ size="x-small" icon="mdi-delete-outline" @click="confirmHideChat" + @shortkey="confirmHideChat" + v-shortkey="SHORTCUT_DELETE_CHAT.key" + :id="SHORTCUT_DELETE_CHAT.elementId" style="margin: 0; background-color: transparent" > import { ref } from "vue"; +import { SHORTCUT_DELETE_CHAT } from "@/components/ShortcutGuide/shortcut.const"; const emit = defineEmits([ "hideChat", diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index b639dd431..8be44f50f 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -218,6 +218,11 @@ const settings = [ name: "isShowMenuBar", label: $t("settings.showMenuBar"), }, + { + type: Type.Checkbox, + name: "isSkipDeleteChatConfirm", + label: $t("settings.skipDeleteChatConfirm"), + }, ]; watch( diff --git a/src/components/ShortcutGuide/shortcut.const.js b/src/components/ShortcutGuide/shortcut.const.js index 7bb84fd0f..0129cd8a9 100644 --- a/src/components/ShortcutGuide/shortcut.const.js +++ b/src/components/ShortcutGuide/shortcut.const.js @@ -93,6 +93,15 @@ export const SHORTCUT_PROMPT_MANAGEMENT = { flexDirection: "column", }; +export const SHORTCUT_DELETE_CHAT = { + elementId: "delete-chat-btn", + key: [modifier, "backspace"], + offset: { + top: 40, + }, + flexDirection: "column", +}; + export const SHORTCUT_APP_BAR = { elementId: "app-bar", key: [modifier, "f11"], @@ -112,6 +121,7 @@ export const SHORTCUT_LIST = [ SHORTCUT_PROMPT_TEXTAREA, SHORTCUT_CHAT_DRAWER, SHORTCUT_NEW_CHAT, + SHORTCUT_DELETE_CHAT, SHORTCUT_PROMPT_MANAGEMENT, SHORTCUT_PROMPT_PRE_NEXT, SHORTCUT_APP_BAR, diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index b2483a03e..a03c3b325 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -15,7 +15,8 @@ "light": "Light", "dark": "Dark", "bots": "AI Bots", - "showMenuBar": "Show Menu Bar" + "showMenuBar": "Show Menu Bar", + "skipDeleteChatConfirm": "Delete chat without confirm" }, "common": { "apiKey": "API Key" diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index e7f3ddf1b..b5edf4c6d 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -16,7 +16,8 @@ "dark": "深色", "bots": "AI 模型", "api": "API", - "showMenuBar": "显示菜单栏" + "showMenuBar": "显示菜单栏", + "skipDeleteChatConfirm": "删除聊天时无需确认" }, "common": { "apiKey": "API 密钥" diff --git a/src/store/index.js b/src/store/index.js index c48e1b5b1..b28fb477d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -150,6 +150,7 @@ export default createStore({ general: { isShowMenuBar: true, isShowAppBar: true, + isSkipDeleteChatConfirm: false, }, }, mutations: {