This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-27 01:03:10 -04:00
1 parent b40b6fd698
commit de681aa543
3 files changed
+56 -1

No files matched your search

@@ -168,10 +168,13 @@
<!-- {$i18n.t('Delete Chat')} --> <!-- {$i18n.t('Delete Chat')} -->
<!-- {$i18n.t('Open Model Selector')} --> <!-- {$i18n.t('Open Model Selector')} -->
<!-- {$i18n.t('Toggle Dictation')} --> <!-- {$i18n.t('Toggle Dictation')} -->
<!-- {$i18n.t('Navigate to Previous Chat')} -->
<!-- {$i18n.t('Navigate to Next Chat')} -->
<!-- {$i18n.t('Search')} --> <!-- {$i18n.t('Search')} -->
<!-- {$i18n.t('Open Settings')} --> <!-- {$i18n.t('Open Settings')} -->
<!-- {$i18n.t('Show Shortcuts')} --> <!-- {$i18n.t('Show Shortcuts')} -->
<!-- {$i18n.t('Toggle Sidebar')} --> <!-- {$i18n.t('Toggle Sidebar')} -->
<!-- {$i18n.t('Toggle Controls')} -->
<!-- {$i18n.t('Close Modal')} --> <!-- {$i18n.t('Close Modal')} -->
<!-- {$i18n.t('Focus Chat Input')} --> <!-- {$i18n.t('Focus Chat Input')} -->
<!-- {$i18n.t('Accept Autocomplete Generation\nJump to Prompt Variable')} --> <!-- {$i18n.t('Accept Autocomplete Generation\nJump to Prompt Variable')} -->
+27
View File
@@ -23,12 +23,15 @@ export enum Shortcut {
DELETE_CHAT = 'deleteChat', DELETE_CHAT = 'deleteChat',
OPEN_MODEL_SELECTOR = 'openModelSelector', OPEN_MODEL_SELECTOR = 'openModelSelector',
TOGGLE_DICTATION = 'toggleDictation', TOGGLE_DICTATION = 'toggleDictation',
NAVIGATE_CHAT_UP = 'navigateChatUp',
NAVIGATE_CHAT_DOWN = 'navigateChatDown',
//Global //Global
SEARCH = 'search', SEARCH = 'search',
OPEN_SETTINGS = 'openSettings', OPEN_SETTINGS = 'openSettings',
SHOW_SHORTCUTS = 'showShortcuts', SHOW_SHORTCUTS = 'showShortcuts',
TOGGLE_SIDEBAR = 'toggleSidebar', TOGGLE_SIDEBAR = 'toggleSidebar',
TOGGLE_CONTROLS = 'toggleControls',
CLOSE_MODAL = 'closeModal', CLOSE_MODAL = 'closeModal',
//Input //Input
@@ -57,10 +60,13 @@ export const CONFIGURABLE_SHORTCUTS = [
Shortcut.DELETE_CHAT, Shortcut.DELETE_CHAT,
Shortcut.OPEN_MODEL_SELECTOR, Shortcut.OPEN_MODEL_SELECTOR,
Shortcut.TOGGLE_DICTATION, Shortcut.TOGGLE_DICTATION,
Shortcut.NAVIGATE_CHAT_UP,
Shortcut.NAVIGATE_CHAT_DOWN,
Shortcut.SEARCH, Shortcut.SEARCH,
Shortcut.OPEN_SETTINGS, Shortcut.OPEN_SETTINGS,
Shortcut.SHOW_SHORTCUTS, Shortcut.SHOW_SHORTCUTS,
Shortcut.TOGGLE_SIDEBAR, Shortcut.TOGGLE_SIDEBAR,
Shortcut.TOGGLE_CONTROLS,
Shortcut.CLOSE_MODAL, Shortcut.CLOSE_MODAL,
Shortcut.FOCUS_INPUT, Shortcut.FOCUS_INPUT,
Shortcut.GENERATE_MESSAGE_PAIR, Shortcut.GENERATE_MESSAGE_PAIR,
@@ -78,10 +84,13 @@ export const DEFAULT_KEYBINDINGS: KeybindingsMap = {
[Shortcut.DELETE_CHAT]: 'Cmd+Shift+Backspace', [Shortcut.DELETE_CHAT]: 'Cmd+Shift+Backspace',
[Shortcut.OPEN_MODEL_SELECTOR]: 'Cmd+Shift+M', [Shortcut.OPEN_MODEL_SELECTOR]: 'Cmd+Shift+M',
[Shortcut.TOGGLE_DICTATION]: 'Cmd+Shift+L', [Shortcut.TOGGLE_DICTATION]: 'Cmd+Shift+L',
[Shortcut.NAVIGATE_CHAT_UP]: '',
[Shortcut.NAVIGATE_CHAT_DOWN]: '',
[Shortcut.SEARCH]: 'Cmd+K', [Shortcut.SEARCH]: 'Cmd+K',
[Shortcut.OPEN_SETTINGS]: 'Cmd+.', [Shortcut.OPEN_SETTINGS]: 'Cmd+.',
[Shortcut.SHOW_SHORTCUTS]: 'Cmd+/', [Shortcut.SHOW_SHORTCUTS]: 'Cmd+/',
[Shortcut.TOGGLE_SIDEBAR]: 'Cmd+Shift+S', [Shortcut.TOGGLE_SIDEBAR]: 'Cmd+Shift+S',
[Shortcut.TOGGLE_CONTROLS]: '',
[Shortcut.CLOSE_MODAL]: 'Escape', [Shortcut.CLOSE_MODAL]: 'Escape',
[Shortcut.FOCUS_INPUT]: 'Shift+Escape', [Shortcut.FOCUS_INPUT]: 'Shift+Escape',
[Shortcut.GENERATE_MESSAGE_PAIR]: 'Cmd+Shift+Enter', [Shortcut.GENERATE_MESSAGE_PAIR]: 'Cmd+Shift+Enter',
@@ -225,6 +234,18 @@ export const shortcuts: ShortcutRegistry = {
category: 'Chat', category: 'Chat',
configurable: true configurable: true
}, },
[Shortcut.NAVIGATE_CHAT_UP]: {
name: 'Navigate to Previous Chat',
keys: [],
category: 'Chat',
configurable: true
},
[Shortcut.NAVIGATE_CHAT_DOWN]: {
name: 'Navigate to Next Chat',
keys: [],
category: 'Chat',
configurable: true
},
//Global //Global
[Shortcut.SEARCH]: { [Shortcut.SEARCH]: {
@@ -251,6 +272,12 @@ export const shortcuts: ShortcutRegistry = {
category: 'Global', category: 'Global',
configurable: true configurable: true
}, },
[Shortcut.TOGGLE_CONTROLS]: {
name: 'Toggle Controls',
keys: [],
category: 'Global',
configurable: true
},
[Shortcut.CLOSE_MODAL]: { [Shortcut.CLOSE_MODAL]: {
name: 'Close Modal', name: 'Close Modal',
keys: ['Escape'], keys: ['Escape'],
+26 -1
View File
@@ -38,7 +38,9 @@
showSearch, showSearch,
showSidebar, showSidebar,
showControls, showControls,
mobile mobile,
chatId,
chats
} from '$lib/stores'; } from '$lib/stores';
import Sidebar from '$lib/components/layout/Sidebar.svelte'; import Sidebar from '$lib/components/layout/Sidebar.svelte';
@@ -232,6 +234,17 @@
await goto(`/auth?redirect=${encodeURIComponent(currentUrl)}`); await goto(`/auth?redirect=${encodeURIComponent(currentUrl)}`);
}; };
const navigateChat = async (direction: -1 | 1) => {
if (!$chats?.length) return;
const currentIndex = $chats.findIndex((chat) => chat.id === $chatId);
const nextChat = currentIndex === -1 ? $chats[0] : $chats[currentIndex + direction];
if (nextChat) {
await goto(`/c/${nextChat.id}`);
}
};
onMount(async () => { onMount(async () => {
if ($user === undefined || $user === null) { if ($user === undefined || $user === null) {
await gotoAuth(); await gotoAuth();
@@ -292,6 +305,18 @@
console.log('Shortcut triggered: TOGGLE_SIDEBAR'); console.log('Shortcut triggered: TOGGLE_SIDEBAR');
event.preventDefault(); event.preventDefault();
showSidebar.set(!$showSidebar); showSidebar.set(!$showSidebar);
} else if (shortcut === Shortcut.NAVIGATE_CHAT_UP) {
console.log('Shortcut triggered: NAVIGATE_CHAT_UP');
event.preventDefault();
await navigateChat(-1);
} else if (shortcut === Shortcut.NAVIGATE_CHAT_DOWN) {
console.log('Shortcut triggered: NAVIGATE_CHAT_DOWN');
event.preventDefault();
await navigateChat(1);
} else if (shortcut === Shortcut.TOGGLE_CONTROLS) {
console.log('Shortcut triggered: TOGGLE_CONTROLS');
event.preventDefault();
showControls.set(!$showControls);
} else if (shortcut === Shortcut.DELETE_CHAT) { } else if (shortcut === Shortcut.DELETE_CHAT) {
console.log('Shortcut triggered: DELETE_CHAT'); console.log('Shortcut triggered: DELETE_CHAT');
event.preventDefault(); event.preventDefault();