feat: dictation toggle

This commit is contained in:
Timothy Jaeryang Baek committed 2026-02-23 02:54:53 -06:00
1 parent 1792f668f2
commit 895c805e62
3 files changed
+31

No files matched your search

@@ -824,6 +824,19 @@
shiftKey = true; 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') { if (e.key === 'Escape') {
console.log('Escape'); console.log('Escape');
dragged = false; dragged = false;
@@ -368,7 +368,17 @@
let maxVisibleItems = 300; let maxVisibleItems = 300;
$: maxVisibleItems = Math.floor(containerWidth / 5); // 2px width + 0.5px gap $: maxVisibleItems = Math.floor(containerWidth / 5); // 2px width + 0.5px gap
const handleKeyDown = (e) => {
if (e.key === 'Escape') {
e.preventDefault();
stopRecording();
onCancel();
}
};
onMount(() => { onMount(() => {
window.addEventListener('keydown', handleKeyDown);
// listen to width changes // listen to width changes
resizeObserver = new ResizeObserver(() => { resizeObserver = new ResizeObserver(() => {
VISUALIZER_BUFFER_LENGTH = Math.floor(window.innerWidth / 4); VISUALIZER_BUFFER_LENGTH = Math.floor(window.innerWidth / 4);
@@ -385,6 +395,7 @@
}); });
onDestroy(() => { onDestroy(() => {
window.removeEventListener('keydown', handleKeyDown);
// remove resize observer // remove resize observer
resizeObserver.disconnect(); resizeObserver.disconnect();
}); });
@@ -547,6 +558,7 @@
</div> </div>
{:else} {:else}
<button <button
id="confirm-recording-button"
type="button" type="button"
class="p-1.5 bg-indigo-500 text-white dark:bg-indigo-500 dark:text-blue-950 rounded-full" class="p-1.5 bg-indigo-500 text-white dark:bg-indigo-500 dark:text-blue-950 rounded-full"
on:click={async () => { on:click={async () => {
+6
View File
@@ -17,6 +17,7 @@ export enum Shortcut {
NEW_TEMPORARY_CHAT = 'newTemporaryChat', NEW_TEMPORARY_CHAT = 'newTemporaryChat',
DELETE_CHAT = 'deleteChat', DELETE_CHAT = 'deleteChat',
OPEN_MODEL_SELECTOR = 'openModelSelector', OPEN_MODEL_SELECTOR = 'openModelSelector',
TOGGLE_DICTATION = 'toggleDictation',
//Global //Global
SEARCH = 'search', SEARCH = 'search',
@@ -64,6 +65,11 @@ export const shortcuts: ShortcutRegistry = {
keys: ['mod', 'shift', 'M'], keys: ['mod', 'shift', 'M'],
category: 'Chat' category: 'Chat'
}, },
[Shortcut.TOGGLE_DICTATION]: {
name: 'Toggle Dictation',
keys: ['mod', 'shift', 'L'],
category: 'Chat'
},
//Global //Global
[Shortcut.SEARCH]: { [Shortcut.SEARCH]: {