From e6bb005f11e36f3ca6c97c8db4a5064c5be3256e Mon Sep 17 00:00:00 2001 From: Zoe <62722391+juls0730@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:41:22 -0600 Subject: [PATCH] feat: add many keyboard shortcuts --- app/components/ChatInput.vue | 5 ++- app/components/ModelSelector.vue | 11 +++++- app/composables/useKeyboardShortcuts.ts | 5 --- app/pages/agent/[id]/topic/[topicId].vue | 47 ++++++++++++++++++++++++ bun.lock | 1 - 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/app/components/ChatInput.vue b/app/components/ChatInput.vue index c277a10..12cce1d 100644 --- a/app/components/ChatInput.vue +++ b/app/components/ChatInput.vue @@ -110,7 +110,10 @@ const handleWindowKeyDown = async (event: KeyboardEvent) => { if (event.defaultPrevented) return; if (event.ctrlKey || event.metaKey || event.altKey) return; - if (document.activeElement === document.body) { + const isInteractive = document.activeElement?.closest('input, textarea, button, a, select, [contenteditable="true"]'); + if (isInteractive) return; + + if (!isInteractive) { const isPrintable = event.key.length === 1; if (isPrintable) { diff --git a/app/components/ModelSelector.vue b/app/components/ModelSelector.vue index 3a92160..a003c8d 100644 --- a/app/components/ModelSelector.vue +++ b/app/components/ModelSelector.vue @@ -6,7 +6,8 @@ import type { ModelWithProvider, ProviderWithModels } from '~/composables/useMod import { sortByReleaseDate } from '~/utils/sort'; const { openDialog } = useDialog(); -const { allModels } = await useModels(); +const { allModels } = useModels(); +const { addShortcut } = useKeyboardShortcuts(); const props = defineProps<{ providers: ProviderWithModels[]; @@ -213,6 +214,14 @@ const handleSearchKeyDown = (event: KeyboardEvent) => { break; } }; + +const unbindShortcut = addShortcut(['ctrl', 'shift', 'm'], () => { + toggleDropdown(); +}); + +onUnmounted(() => { + unbindShortcut(); +})