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
fix: broken ipc handler, standardize logging, improve react hook deps
Gabriel Stein53fa74662f85
diff --git a/src/components/LocalModelPicker.tsx b/src/components/LocalModelPicker.tsxindex 7799b95f7..c7f2552eb 100644--- a/src/components/LocalModelPicker.tsx+++ b/src/components/LocalModelPicker.tsx@@ -1,6 +1,6 @@import { useState, useEffect, useCallback, useMemo } from "react";import { Button } from "./ui/button";-import { RefreshCw, Download, Trash2, Check } from "lucide-react";+import { RefreshCw, Download, Trash2, Check, X } from "lucide-react";import { ProviderIcon } from "./ui/ProviderIcon";import { ProviderTabs } from "./ui/ProviderTabs";import { DownloadProgressBar } from "./ui/DownloadProgressBar";@@ -103,12 +103,19 @@ export default function LocalModelPicker({onDownloadComplete?.();}, [loadDownloadedModels, onDownloadComplete]);- const { downloadingModel, downloadProgress, downloadModel, deleteModel, isDownloadingModel } =- useModelDownload({- modelType,- onDownloadComplete: handleDownloadComplete,- onModelsCleared: loadDownloadedModels,- });+ const {+ downloadingModel,+ downloadProgress,+ downloadModel,+ deleteModel,+ isDownloadingModel,+ cancelDownload,+ isCancelling,+ } = useModelDownload({+ modelType,+ onDownloadComplete: handleDownloadComplete,+ onModelsCleared: loadDownloadedModels,+ });const handleDownload = useCallback((modelId: string) => {@@ -232,21 +239,25 @@ export default function LocalModelPicker({<span className="ml-1">Delete</span></Button></>+ ) : isDownloading ? (+ <Button+ onClick={cancelDownload}+ disabled={isCancelling}+ size="sm"+ variant="outline"+ className="text-red-600 border-red-300 hover:bg-red-50"+ >+ <X size={14} />+ <span className="ml-1">{isCancelling ? "..." : "Cancel"}</span>+ </Button>) : (<ButtononClick={() => handleDownload(model.id)}size="sm"- disabled={isDownloading}className={styles.buttons.download}>- {isDownloading ? (- `${Math.round(downloadProgress.percentage)}%`- ) : (- <>- <Download size={14} />- <span className="ml-1">Download</span>- </>- )}+ <Download size={14} />+ <span className="ml-1">Download</span></Button>)}</div>diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsxindex b984c1a7a..bab368f57 100644--- a/src/components/TranscriptionModelPicker.tsx+++ b/src/components/TranscriptionModelPicker.tsx@@ -77,6 +77,8 @@ export default function TranscriptionModelPicker({const [internalLocalProvider, setInternalLocalProvider] = useState(selectedLocalProvider);const hasLoadedRef = useRef(false);const isLoadingRef = useRef(false);+ const loadLocalModelsRef = useRef<(() => Promise<void>) | null>(null);+ const ensureValidCloudSelectionRef = useRef<(() => void) | null>(null);const { confirmDialog, showConfirmDialog, hideConfirmDialog } = useDialogs();const colorScheme: ColorScheme = variant === "settings" ? "purple" : "blue";@@ -129,19 +131,27 @@ export default function TranscriptionModelPicker({onCloudModelSelect,]);+ // Keep refs in sync to avoid stale closures in the mode-switching effect+ useEffect(() => {+ loadLocalModelsRef.current = loadLocalModels;+ }, [loadLocalModels]);++ useEffect(() => {+ ensureValidCloudSelectionRef.current = ensureValidCloudSelection;+ }, [ensureValidCloudSelection]);+// Only load models once on mount when in local mode, or when switching to local modeuseEffect(() => {if (useLocalWhisper) {if (!hasLoadedRef.current) {hasLoadedRef.current = true;- loadLocalModels();+ loadLocalModelsRef.current?.();}} else {hasLoadedRef.current = false; // Reset when switching to cloud- ensureValidCloudSelection();+ ensureValidCloudSelectionRef.current?.();}- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [useLocalWhisper]); // Intentionally exclude callbacks to prevent re-render loops+ }, [useLocalWhisper]);useEffect(() => {const handleModelsCleared = () => loadLocalModels();diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 24fc10bee..c52e32492 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -87,7 +87,7 @@ class IPCHandlers {}return { success: true };} catch (error) {- console.error("Failed to save settings:", error);+ debugLogger.error("Failed to save settings:", error);return { success: false, error: error.message };}});@@ -266,13 +266,13 @@ class IPCHandlers {// Model management handlersipcMain.handle("model-get-all", async () => {try {- console.log("[IPC] model-get-all called");+ debugLogger.debug("model-get-all called", undefined, "ipc");const modelManager = require("./modelManagerBridge").default;const models = await modelManager.getModelsWithStatus();- console.log("[IPC] Returning models:", models.length);+ debugLogger.debug("Returning models", { count: models.length }, "ipc");return models;} catch (error) {- console.error("[IPC] Error in model-get-all:", error);+ debugLogger.error("Error in model-get-all:", error);throw error;}});@@ -485,6 +485,7 @@ class IPCHandlers {ipcMain.handle("llama-cpp-uninstall", async () => {try {+ const llamaCppInstaller = require("./llamaCppInstaller").default;const result = await llamaCppInstaller.uninstall();return result;} catch (error) {