diff --git a/src/lib/shortcuts.ts b/src/lib/shortcuts.ts
index 9879b8110d..677d1bf1ac 100644
--- a/src/lib/shortcuts.ts
+++ b/src/lib/shortcuts.ts
@@ -40,7 +40,13 @@ export enum Shortcut {
REGENERATE_RESPONSE = 'regenerateResponse',
COPY_LAST_CODE_BLOCK = 'copyLastCodeBlock',
COPY_LAST_RESPONSE = 'copyLastResponse',
- STOP_GENERATING = 'stopGenerating'
+ STOP_GENERATING = 'stopGenerating',
+ EDIT_LAST_MESSAGE = 'editLastMessage',
+
+ //Playground
+ PLAYGROUND_SUBMIT = 'playgroundSubmit',
+ PLAYGROUND_ADD_MESSAGE = 'playgroundAddMessage',
+ PLAYGROUND_TOGGLE_ROLE = 'playgroundToggleRole'
}
export const shortcuts: ShortcutRegistry = {
@@ -164,5 +170,27 @@ export const shortcuts: ShortcutRegistry = {
name: 'Copy Last Code Block',
keys: ['mod', 'shift', ';'],
category: 'Message'
+ },
+ [Shortcut.EDIT_LAST_MESSAGE]: {
+ name: 'Edit Last User Message',
+ keys: ['mod', 'E'],
+ category: 'Message'
+ },
+
+ //Playground
+ [Shortcut.PLAYGROUND_SUBMIT]: {
+ name: 'Run',
+ keys: ['mod', 'Enter'],
+ category: 'Playground'
+ },
+ [Shortcut.PLAYGROUND_ADD_MESSAGE]: {
+ name: 'Add Message',
+ keys: ['mod', 'shift', 'A'],
+ category: 'Playground'
+ },
+ [Shortcut.PLAYGROUND_TOGGLE_ROLE]: {
+ name: 'Toggle Role',
+ keys: ['mod', 'shift', 'X'],
+ category: 'Playground'
}
};
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index 772ae6fe2d..c8a81ecbf9 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -311,6 +311,10 @@
console.log('Shortcut triggered: REGENERATE_RESPONSE');
event.preventDefault();
[...document.getElementsByClassName('regenerate-response-button')]?.at(-1)?.click();
+ } else if (isShortcutMatch(event, shortcuts[Shortcut.EDIT_LAST_MESSAGE])) {
+ console.log('Shortcut triggered: EDIT_LAST_MESSAGE');
+ event.preventDefault();
+ [...document.getElementsByClassName('edit-user-message-button')]?.at(-1)?.click();
}
});
};