Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
refactor: extract duplicate callback
Gabriel Stein21585e208816
diff --git a/src/components/UnifiedModelPicker.tsx b/src/components/UnifiedModelPicker.tsxindex 9eee2e2a4..14fc6c13b 100644--- a/src/components/UnifiedModelPicker.tsx+++ b/src/components/UnifiedModelPicker.tsx@@ -209,7 +209,9 @@ export default function UnifiedModelPicker({...m,id: m.model,name: m.model.charAt(0).toUpperCase() + m.model.slice(1),- size: m.size_mb ? `${m.size_mb}MB` : `~${modelSizes[m.model as keyof typeof modelSizes] || "?"}MB`,+ size: m.size_mb+ ? `${m.size_mb}MB`+ : `~${modelSizes[m.model as keyof typeof modelSizes] || "?"}MB`,description:{tiny: "Fastest, lower quality",diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex ad2962140..f0fd73ede 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -105,11 +105,11 @@ class WindowManager {this.mainWindow.loadURL(appUrl);}- async initializeHotkey() {+ createHotkeyCallback() {let lastToggleTime = 0;- const DEBOUNCE_MS = 150;+ const DEBOUNCE_MS = 150;- const callback = () => {+ return () => {const now = Date.now();if (now - lastToggleTime < DEBOUNCE_MS) {return;@@ -121,28 +121,14 @@ class WindowManager {}this.mainWindow.webContents.send("toggle-dictation");};+ }- await this.hotkeyManager.initializeHotkey(this.mainWindow, callback);+ async initializeHotkey() {+ await this.hotkeyManager.initializeHotkey(this.mainWindow, this.createHotkeyCallback());}async updateHotkey(hotkey) {- let lastToggleTime = 0;- const DEBOUNCE_MS = 150;-- const callback = () => {- const now = Date.now();- if (now - lastToggleTime < DEBOUNCE_MS) {- return;- }- lastToggleTime = now;-- if (!this.mainWindow.isVisible()) {- this.mainWindow.show();- }- this.mainWindow.webContents.send("toggle-dictation");- };-- return await this.hotkeyManager.updateHotkey(hotkey, callback);+ return await this.hotkeyManager.updateHotkey(hotkey, this.createHotkeyCallback());}async startWindowDrag() {