feat: dictation toggle

This commit is contained in:
Timothy Jaeryang Baek
2026-02-23 02:54:53 -06:00
parent 1792f668f2
commit 895c805e62
3 changed files with 31 additions and 0 deletions

View File

@@ -824,6 +824,19 @@
shiftKey = true;
}
// Cmd/Ctrl+Shift+L to toggle dictation
if (e.key.toLowerCase() === 'l' && (e.metaKey || e.ctrlKey) && e.shiftKey) {
e.preventDefault();
if (recording) {
// Confirm and stop recording
document.getElementById('confirm-recording-button')?.click();
} else {
// Start recording (same logic as voice-input-button click)
document.getElementById('voice-input-button')?.click();
}
return;
}
if (e.key === 'Escape') {
console.log('Escape');
dragged = false;

View File

@@ -368,7 +368,17 @@
let maxVisibleItems = 300;
$: maxVisibleItems = Math.floor(containerWidth / 5); // 2px width + 0.5px gap
const handleKeyDown = (e) => {
if (e.key === 'Escape') {
e.preventDefault();
stopRecording();
onCancel();
}
};
onMount(() => {
window.addEventListener('keydown', handleKeyDown);
// listen to width changes
resizeObserver = new ResizeObserver(() => {
VISUALIZER_BUFFER_LENGTH = Math.floor(window.innerWidth / 4);
@@ -385,6 +395,7 @@
});
onDestroy(() => {
window.removeEventListener('keydown', handleKeyDown);
// remove resize observer
resizeObserver.disconnect();
});
@@ -547,6 +558,7 @@
</div>
{:else}
<button
id="confirm-recording-button"
type="button"
class="p-1.5 bg-indigo-500 text-white dark:bg-indigo-500 dark:text-blue-950 rounded-full"
on:click={async () => {

View File

@@ -17,6 +17,7 @@ export enum Shortcut {
NEW_TEMPORARY_CHAT = 'newTemporaryChat',
DELETE_CHAT = 'deleteChat',
OPEN_MODEL_SELECTOR = 'openModelSelector',
TOGGLE_DICTATION = 'toggleDictation',
//Global
SEARCH = 'search',
@@ -64,6 +65,11 @@ export const shortcuts: ShortcutRegistry = {
keys: ['mod', 'shift', 'M'],
category: 'Chat'
},
[Shortcut.TOGGLE_DICTATION]: {
name: 'Toggle Dictation',
keys: ['mod', 'shift', 'L'],
category: 'Chat'
},
//Global
[Shortcut.SEARCH]: {