feat: add keyboard shortcut for opening the model selector (#21130)
This commit is contained in:
@@ -16,6 +16,7 @@ export enum Shortcut {
|
|||||||
NEW_CHAT = 'newChat',
|
NEW_CHAT = 'newChat',
|
||||||
NEW_TEMPORARY_CHAT = 'newTemporaryChat',
|
NEW_TEMPORARY_CHAT = 'newTemporaryChat',
|
||||||
DELETE_CHAT = 'deleteChat',
|
DELETE_CHAT = 'deleteChat',
|
||||||
|
OPEN_MODEL_SELECTOR = 'openModelSelector',
|
||||||
|
|
||||||
//Global
|
//Global
|
||||||
SEARCH = 'search',
|
SEARCH = 'search',
|
||||||
@@ -58,6 +59,11 @@ export const shortcuts: ShortcutRegistry = {
|
|||||||
keys: ['mod', 'shift', 'Backspace', 'Delete'],
|
keys: ['mod', 'shift', 'Backspace', 'Delete'],
|
||||||
category: 'Chat'
|
category: 'Chat'
|
||||||
},
|
},
|
||||||
|
[Shortcut.OPEN_MODEL_SELECTOR]: {
|
||||||
|
name: 'Open Model Selector',
|
||||||
|
keys: ['mod', 'shift', 'M'],
|
||||||
|
category: 'Chat'
|
||||||
|
},
|
||||||
|
|
||||||
//Global
|
//Global
|
||||||
[Shortcut.SEARCH]: {
|
[Shortcut.SEARCH]: {
|
||||||
|
|||||||
@@ -230,6 +230,10 @@
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
showSettings.set(false);
|
showSettings.set(false);
|
||||||
showShortcuts.set(false);
|
showShortcuts.set(false);
|
||||||
|
} else if (isShortcutMatch(event, shortcuts[Shortcut.OPEN_MODEL_SELECTOR])) {
|
||||||
|
console.log('Shortcut triggered: OPEN_MODEL_SELECTOR');
|
||||||
|
event.preventDefault();
|
||||||
|
document.getElementById('model-selector-0-button')?.click();
|
||||||
} else if (isShortcutMatch(event, shortcuts[Shortcut.NEW_TEMPORARY_CHAT])) {
|
} else if (isShortcutMatch(event, shortcuts[Shortcut.NEW_TEMPORARY_CHAT])) {
|
||||||
console.log('Shortcut triggered: NEW_TEMPORARY_CHAT');
|
console.log('Shortcut triggered: NEW_TEMPORARY_CHAT');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user