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: avoid redundant processing tracker
Gabriel Steina0c58ffdec6c
diff --git a/src/App.jsx b/src/App.jsxindex 6a510ec84..c8be8c7e4 100644--- a/src/App.jsx+++ b/src/App.jsx@@ -153,7 +153,6 @@ export default function App() {const micState = getMicState();- // Get microphone button properties based on stateconst getMicButtonProps = () => {const baseClasses ="rounded-full w-10 h-10 flex items-center justify-center relative overflow-hidden border-2 border-white/70 cursor-pointer";diff --git a/src/components/UnifiedModelPicker.tsx b/src/components/UnifiedModelPicker.tsxindex 5d8eeae83..9eee2e2a4 100644--- a/src/components/UnifiedModelPicker.tsx+++ b/src/components/UnifiedModelPicker.tsx@@ -196,11 +196,20 @@ export default function UnifiedModelPicker({if (modelType === "whisper") {const result = await window.electronAPI.listWhisperModels();if (result.success) {+ // Estimated sizes in MB for each model (used when actual size not available)+ const modelSizes: Record<string, number> = {+ tiny: 39,+ base: 74,+ small: 244,+ medium: 769,+ large: 1550,+ turbo: 809,+ };const whisperModels: Model[] = result.models.map((m: any) => ({...m,id: m.model,name: m.model.charAt(0).toUpperCase() + m.model.slice(1),- size: m.size_mb ? `${m.size_mb}MB` : "Unknown",+ 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/windowConfig.js b/src/helpers/windowConfig.jsindex 5ecce805a..162174b6f 100644--- a/src/helpers/windowConfig.js+++ b/src/helpers/windowConfig.js@@ -15,8 +15,7 @@ const MAIN_WINDOW_CONFIG = {frame: false,alwaysOnTop: true,resizable: false,- transparent: process.platform !== "win32",- ...(process.platform === "win32" ? { backgroundColor: "#1a1a1a" } : {}),+ transparent: true,show: false, // Start hidden, show after setupskipTaskbar: false, // Keep visible in Dock/taskbar so app stays discoverablefocusable: true,diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex c3cf5c5c8..ad2962140 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -106,7 +106,16 @@ class WindowManager {}async initializeHotkey() {+ 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();}@@ -117,7 +126,16 @@ class WindowManager {}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();}diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.jsindex 1d673c0b3..d0e470487 100644--- a/src/hooks/useAudioRecording.js+++ b/src/hooks/useAudioRecording.js@@ -9,10 +9,8 @@ export const useAudioRecording = (toast, options = {}) => {const { onToggle } = options;useEffect(() => {- // Initialize AudioManageraudioManagerRef.current = new AudioManager();- // Set up callbacksaudioManagerRef.current.setCallbacks({onStateChange: ({ isRecording, isProcessing }) => {setIsRecording(isRecording);@@ -29,13 +27,10 @@ export const useAudioRecording = (toast, options = {}) => {if (result.success) {setTranscript(result.text);- // Paste immediatelyawait audioManagerRef.current.safePaste(result.text);- // Save to database in parallelaudioManagerRef.current.saveTranscription(result.text);- // Show success notification if local fallback was usedif (result.source === "openai" && localStorage.getItem("useLocalWhisper") === "true") {toast({title: "Fallback Mode",@@ -48,16 +43,13 @@ export const useAudioRecording = (toast, options = {}) => {});// Set up hotkey listener- let recording = false;const handleToggle = () => {const currentState = audioManagerRef.current.getState();- if (!recording && !currentState.isRecording && !currentState.isProcessing) {+ if (!currentState.isRecording && !currentState.isProcessing) {audioManagerRef.current.startRecording();- recording = true;} else if (currentState.isRecording) {audioManagerRef.current.stopRecording();- recording = false;}};@@ -66,7 +58,6 @@ export const useAudioRecording = (toast, options = {}) => {onToggle?.();});- // Set up no-audio-detected listenerconst handleNoAudioDetected = () => {toast({title: "No Audio Detected",