Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

GPU UX overhaul, Windows stability, and cross-platform fixes (#320)

Gabriel Stein8ef38cb398ab
diff --git a/main.js b/main.js
index 1481d86c7..5b5723496 100644
--- a/main.js
+++ b/main.js
@@ -63,6 +63,10 @@ if (process.platform === "linux") {
app.commandLine.appendSwitch("disable-gpu-compositing");
}
+if (process.platform === "win32") {
+ app.commandLine.appendSwitch("disable-gpu-compositing");
+}
+
// Enable native Wayland support: Ozone platform for native rendering,
// and GlobalShortcutsPortal for global shortcuts via xdg-desktop-portal
if (process.platform === "linux" && process.env.XDG_SESSION_TYPE === "wayland") {
@@ -803,6 +807,9 @@ if (gotSingleInstanceLock) {
}
windowManager.controlPanelWindow.show();
windowManager.controlPanelWindow.focus();
+ if (windowManager.controlPanelWindow.webContents.isCrashed()) {
+ windowManager.loadControlPanel();
+ }
} else {
windowManager.createControlPanelWindow();
}
diff --git a/preload.js b/preload.js
index d52819c18..f278ef679 100644
--- a/preload.js
+++ b/preload.js
@@ -328,6 +328,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
// OpenWhispr Cloud API
cloudTranscribe: (audioBuffer, opts) => ipcRenderer.invoke("cloud-transcribe", audioBuffer, opts),
cloudReason: (text, opts) => ipcRenderer.invoke("cloud-reason", text, opts),
+ cloudStreamingUsage: (text, audioDurationSeconds, opts) =>
+ ipcRenderer.invoke("cloud-streaming-usage", text, audioDurationSeconds, opts),
cloudUsage: () => ipcRenderer.invoke("cloud-usage"),
cloudCheckout: (plan) => ipcRenderer.invoke("cloud-checkout", plan),
cloudBillingPortal: () => ipcRenderer.invoke("cloud-billing-portal"),
diff --git a/scripts/build-globe-listener.js b/scripts/build-globe-listener.js
index a354a4195..98700bd5d 100644
--- a/scripts/build-globe-listener.js
+++ b/scripts/build-globe-listener.js
@@ -32,6 +32,12 @@ const outputBinary = path.join(outputDir, "macos-globe-listener");
const hashFile = path.join(outputDir, `.macos-globe-listener.${targetArch}.hash`);
const moduleCacheDir = path.join(outputDir, ".swift-module-cache");
+// Mach-O CPU type constants for architecture verification
+const ARCH_CPU_TYPE = {
+ arm64: 0x0100000c, // CPU_TYPE_ARM64
+ x64: 0x01000007, // CPU_TYPE_X86_64
+};
+
function log(message) {
console.log(`[globe-listener] ${message}`);
}
@@ -42,6 +48,26 @@ function ensureDir(dirPath) {
}
}
+function verifyBinaryArch(binaryPath, expectedArch) {
+ try {
+ const fd = fs.openSync(binaryPath, "r");
+ const header = Buffer.alloc(8);
+ fs.readSync(fd, header, 0, 8, 0);
+ fs.closeSync(fd);
+
+ const magic = header.readUInt32LE(0);
+ if (magic !== 0xfeedfacf) {
+ // Not a 64-bit Mach-O
+ return false;
+ }
+ const cpuType = header.readInt32LE(4);
+ const expectedCpu = ARCH_CPU_TYPE[expectedArch];
+ return cpuType === expectedCpu;
+ } catch {
+ return false;
+ }
+}
+
if (!fs.existsSync(swiftSource)) {
console.error(`[globe-listener] Swift source not found at ${swiftSource}`);
process.exit(1);
@@ -52,14 +78,20 @@ ensureDir(moduleCacheDir);
let needsBuild = true;
if (fs.existsSync(outputBinary)) {
- try {
- const binaryStat = fs.statSync(outputBinary);
- const sourceStat = fs.statSync(swiftSource);
- if (binaryStat.mtimeMs >= sourceStat.mtimeMs) {
- needsBuild = false;
- }
- } catch {
+ // Verify existing binary matches the target architecture
+ if (!verifyBinaryArch(outputBinary, targetArch)) {
+ log(`Existing binary is wrong architecture (expected ${targetArch}), rebuild needed`);
needsBuild = true;
+ } else {
+ try {
+ const binaryStat = fs.statSync(outputBinary);
+ const sourceStat = fs.statSync(swiftSource);
+ if (binaryStat.mtimeMs >= sourceStat.mtimeMs) {
+ needsBuild = false;
+ }
+ } catch {
+ needsBuild = true;
+ }
}
}
@@ -76,8 +108,9 @@ if (!needsBuild && fs.existsSync(outputBinary)) {
needsBuild = true;
}
} else {
- // No hash file exists, save current hash for next time
- fs.writeFileSync(hashFile, currentHash);
+ // No hash file for this architecture — force rebuild to ensure correct arch
+ log(`No hash file for ${targetArch}, rebuild needed`);
+ needsBuild = true;
}
} catch (err) {
log(`Hash check failed: ${err.message}, forcing rebuild`);
@@ -128,6 +161,15 @@ try {
console.warn(`[globe-listener] Unable to set executable permissions: ${error.message}`);
}
+// Verify the compiled binary matches the target architecture
+if (!verifyBinaryArch(outputBinary, targetArch)) {
+ console.error(
+ `[globe-listener] FATAL: Compiled binary architecture does not match target (${targetArch}). ` +
+ `This can happen when cross-compiling without setting TARGET_ARCH env var.`
+ );
+ process.exit(1);
+}
+
// Save source hash after successful build
try {
const sourceContent = fs.readFileSync(swiftSource, "utf8");
diff --git a/scripts/build-macos-fast-paste.js b/scripts/build-macos-fast-paste.js
index 72cb9af34..82fb7c3de 100644
--- a/scripts/build-macos-fast-paste.js
+++ b/scripts/build-macos-fast-paste.js
@@ -32,6 +32,11 @@ const outputBinary = path.join(outputDir, "macos-fast-paste");
const hashFile = path.join(outputDir, `.macos-fast-paste.${targetArch}.hash`);
const moduleCacheDir = path.join(outputDir, ".swift-module-cache");
+const ARCH_CPU_TYPE = {
+ arm64: 0x0100000c, // CPU_TYPE_ARM64
+ x64: 0x01000007, // CPU_TYPE_X86_64
+};
+
function log(message) {
console.log(`[fast-paste] ${message}`);
}
@@ -42,6 +47,24 @@ function ensureDir(dirPath) {
}
}
+function verifyBinaryArch(binaryPath, expectedArch) {
+ try {
+ const fd = fs.openSync(binaryPath, "r");
+ const header = Buffer.alloc(8);
+ fs.readSync(fd, header, 0, 8, 0);
+ fs.closeSync(fd);
+
+ const magic = header.readUInt32LE(0);
+ if (magic !== 0xfeedfacf) {
+ return false;
+ }
+ const cpuType = header.readInt32LE(4);
+ return cpuType === ARCH_CPU_TYPE[expectedArch];
+ } catch {
+ return false;
+ }
+}
+
if (!fs.existsSync(swiftSource)) {
console.error(`[fast-paste] Swift source not found at ${swiftSource}`);
process.exit(1);
@@ -52,14 +75,19 @@ ensureDir(moduleCacheDir);
let needsBuild = true;
if (fs.existsSync(outputBinary)) {
- try {
- const binaryStat = fs.statSync(outputBinary);
- const sourceStat = fs.statSync(swiftSource);
- if (binaryStat.mtimeMs >= sourceStat.mtimeMs) {
- needsBuild = false;
- }
- } catch {
+ if (!verifyBinaryArch(outputBinary, targetArch)) {
+ log(`Existing binary is wrong architecture (expected ${targetArch}), rebuild needed`);
needsBuild = true;
+ } else {
+ try {
+ const binaryStat = fs.statSync(outputBinary);
+ const sourceStat = fs.statSync(swiftSource);
+ if (binaryStat.mtimeMs >= sourceStat.mtimeMs) {
+ needsBuild = false;
+ }
+ } catch {
+ needsBuild = true;
+ }
}
}
@@ -75,7 +103,8 @@ if (!needsBuild && fs.existsSync(outputBinary)) {
needsBuild = true;
}
} else {
- fs.writeFileSync(hashFile, currentHash);
+ log(`No hash file for ${targetArch}, rebuild needed`);
+ needsBuild = true;
}
} catch (err) {
log(`Hash check failed: ${err.message}, forcing rebuild`);
@@ -126,6 +155,14 @@ try {
console.warn(`[fast-paste] Unable to set executable permissions: ${error.message}`);
}
+if (!verifyBinaryArch(outputBinary, targetArch)) {
+ console.error(
+ `[fast-paste] FATAL: Compiled binary architecture does not match target (${targetArch}). ` +
+ `This can happen when cross-compiling without setting TARGET_ARCH env var.`
+ );
+ process.exit(1);
+}
+
try {
const sourceContent = fs.readFileSync(swiftSource, "utf8");
const hash = crypto.createHash("sha256").update(sourceContent).digest("hex");
diff --git a/src/App.jsx b/src/App.jsx
index bb266fd24..f67609df8 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -86,7 +86,6 @@ export default function App() {
// Floating icon auto-hide setting (read from store, synced via IPC)
const floatingIconAutoHide = useSettingsStore((s) => s.floatingIconAutoHide);
- const setFloatingIconAutoHide = useSettingsStore((s) => s.setFloatingIconAutoHide);
const prevAutoHideRef = useRef(floatingIconAutoHide);
const setWindowInteractivity = React.useCallback((shouldCapture) => {
@@ -169,10 +168,11 @@ export default function App() {
}
}, [isSignedIn, warmupStreaming]);
- // Listen for auto-hide setting changes relayed from the main process
+ // Sync auto-hide from main process — setState directly to avoid IPC echo
useEffect(() => {
const unsubscribe = window.electronAPI?.onFloatingIconAutoHideChanged?.((enabled) => {
- setFloatingIconAutoHide(enabled);
+ localStorage.setItem("floatingIconAutoHide", String(enabled));
+ useSettingsStore.setState({ floatingIconAutoHide: enabled });
});
return () => unsubscribe?.();
}, []);
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 7f25455e0..348337b8e 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -21,7 +21,6 @@ import WindowControls from "./WindowControls";
import { getCachedPlatform } from "../utils/platform";
import { setActiveNoteId, setActiveFolderId } from "../stores/noteStore";
import HistoryView from "./HistoryView";
-import type { CudaWhisperStatus } from "../types/electron";
const platform = getCachedPlatform();
@@ -45,13 +44,13 @@ export default function ControlPanel() {
);
const [showReferrals, setShowReferrals] = useState(false);
const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);
- const [vulkanBanner, setVulkanBanner] = useState<{ show: boolean; deviceName?: string }>({
- show: false,
- });
const [activeView, setActiveView] = useState<ControlPanelView>("home");
- const [cudaStatus, setCudaStatus] = useState<CudaWhisperStatus | null>(null);
+ const [gpuAccelAvailable, setGpuAccelAvailable] = useState<{ cuda: boolean; vulkan: boolean }>({
+ cuda: false,
+ vulkan: false,
+ });
const [gpuBannerDismissed, setGpuBannerDismissed] = useState(
- () => localStorage.getItem("gpuBannerDismissed") === "true"
+ () => localStorage.getItem("gpuBannerDismissedUnified") === "true"
);
const cloudMigrationProcessed = useRef(false);
const { hotkey } = useHotkey();
@@ -157,39 +156,28 @@ export default function ControlPanel() {
}, [authLoaded, isSignedIn, setUseLocalWhisper, setCloudTranscriptionMode]);
useEffect(() => {
- if (platform === "darwin" || !useReasoningModel) return;
- if (localStorage.getItem("llamaVulkanBannerDismissed") === "true") return;
-
- Promise.all([
- window.electronAPI?.detectVulkanGpu?.(),
- window.electronAPI?.getLlamaVulkanStatus?.(),
- ])
- .then(([gpu, vulkan]) => {
- if (gpu?.available && !vulkan?.downloaded) {
- setVulkanBanner({ show: true, deviceName: gpu.deviceName });
- }
- })
- .catch(() => {});
- }, [useReasoningModel]);
-
- const fetchCudaStatus = useCallback(() => {
if (platform === "darwin" || gpuBannerDismissed) return;
- if (!useLocalWhisper || localTranscriptionProvider !== "whisper") return;
- window.electronAPI
- ?.getCudaWhisperStatus?.()
- ?.then(setCudaStatus)
- .catch(() => {});
- }, [useLocalWhisper, localTranscriptionProvider, gpuBannerDismissed]);
-
- useEffect(() => {
- if (!showSettings) fetchCudaStatus();
- }, [showSettings, fetchCudaStatus]);
-
- const showGpuBanner =
- activeView === "home" &&
- !gpuBannerDismissed &&
- cudaStatus?.gpuInfo.hasNvidiaGpu === true &&
- cudaStatus.downloaded === false;
+ const detect = async () => {
+ const results = { cuda: false, vulkan: false };
+ if (useLocalWhisper && localTranscriptionProvider === "whisper") {
+ try {
+ const status = await window.electronAPI?.getCudaWhisperStatus?.();
+ if (status?.gpuInfo.hasNvidiaGpu && !status.downloaded) results.cuda = true;
+ } catch {}
+ }
+ if (useReasoningModel) {
+ try {
+ const [gpu, vulkan] = await Promise.all([
+ window.electronAPI?.detectVulkanGpu?.(),
+ window.electronAPI?.getLlamaVulkanStatus?.(),
+ ]);
+ if (gpu?.available && !vulkan?.downloaded) results.vulkan = true;
+ } catch {}
+ }
+ setGpuAccelAvailable(results);
+ };
+ detect();
+ }, [useLocalWhisper, localTranscriptionProvider, useReasoningModel, gpuBannerDismissed]);
const loadTranscriptions = async () => {
try {
@@ -450,84 +438,51 @@ export default function ControlPanel() {
</div>
</div>
)}
- {vulkanBanner.show && activeView === "home" && (
- <div className="mx-4 mt-3 p-3 rounded-lg bg-purple-500/10 border border-purple-500/20">
- <div className="flex items-start gap-2">
- <Zap className="w-4 h-4 text-purple-400 shrink-0 mt-0.5" />
- <div className="flex-1 min-w-0">
- <p className="text-sm text-foreground">
- {vulkanBanner.deviceName || "GPU"} detected — speed up local AI with Vulkan
- acceleration
- </p>
- <div className="flex items-center gap-3 mt-2">
- <button
- type="button"
- onClick={() => {
- setSettingsSection("reasoning");
- setShowSettings(true);
- }}
- className="text-xs font-medium text-purple-400 hover:text-purple-300 transition-colors"
- >
- Enable GPU
- </button>
- <button
- type="button"
- onClick={() => {
- localStorage.setItem("llamaVulkanBannerDismissed", "true");
- setVulkanBanner({ show: false });
- }}
- className="text-xs text-muted-foreground hover:text-foreground transition-colors"
- >
- Not now
- </button>
- </div>
- </div>
- </div>
- </div>
- )}
- {showGpuBanner && (
- <div className="max-w-3xl mx-auto w-full mb-3">
- <div className="rounded-lg border border-primary/20 dark:border-primary/15 bg-primary/5 p-3">
- <div className="flex items-start gap-3">
- <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/15 flex items-center justify-center">
- <Zap size={16} className="text-primary" />
- </div>
- <div className="flex-1 min-w-0">
- <p className="text-xs font-medium text-foreground mb-0.5">
- GPU acceleration available
- </p>
- <p className="text-xs text-muted-foreground mb-2">
- {cudaStatus?.gpuInfo.gpuName
- ? `Your ${cudaStatus.gpuInfo.gpuName} can speed up local transcription.`
- : "Your NVIDIA GPU can speed up local transcription."}
- </p>
- <div className="flex items-center gap-3">
- <Button
- variant="default"
- size="sm"
- className="h-7 text-xs"
- onClick={() => {
- setSettingsSection("transcription");
- setShowSettings(true);
- }}
- >
- Enable GPU
- </Button>
- <button
- onClick={() => {
- setGpuBannerDismissed(true);
- localStorage.setItem("gpuBannerDismissed", "true");
- }}
- className="text-xs text-muted-foreground hover:text-foreground transition-colors"
- >
- Not now
- </button>
+ {(gpuAccelAvailable.cuda || gpuAccelAvailable.vulkan) &&
+ activeView === "home" &&
+ !gpuBannerDismissed && (
+ <div className="max-w-3xl mx-auto w-full mb-3">
+ <div className="rounded-lg border border-primary/20 dark:border-primary/15 bg-primary/5 p-3">
+ <div className="flex items-start gap-3">
+ <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/15 flex items-center justify-center">
+ <Zap size={16} className="text-primary" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <p className="text-xs font-medium text-foreground mb-0.5">
+ {t("controlPanel.gpu.bannerTitle")}
+ </p>
+ <p className="text-xs text-muted-foreground mb-2">
+ {t("controlPanel.gpu.bannerDescription")}
+ </p>
+ <div className="flex items-center gap-3">
+ <Button
+ variant="default"
+ size="sm"
+ className="h-7 text-xs"
+ onClick={() => {
+ setSettingsSection(
+ gpuAccelAvailable.cuda ? "transcription" : "intelligence"
+ );
+ setShowSettings(true);
+ }}
+ >
+ {t("controlPanel.gpu.enableButton")}
+ </Button>
+ <button
+ onClick={() => {
+ setGpuBannerDismissed(true);
+ localStorage.setItem("gpuBannerDismissedUnified", "true");
+ }}
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors"
+ >
+ {t("controlPanel.gpu.dismissButton")}
+ </button>
+ </div>
</div>
</div>
</div>
</div>
- </div>
- )}
+ )}
{activeView === "home" && (
<HistoryView
history={history}
diff --git a/src/components/HistoryView.tsx b/src/components/HistoryView.tsx
index 2914bcd2f..c3dde76f6 100644
--- a/src/components/HistoryView.tsx
+++ b/src/components/HistoryView.tsx
@@ -126,7 +126,7 @@ export default function HistoryView({
variant="default"
size="sm"
className="h-7 text-xs"
- onClick={() => onOpenSettings("aiModels")}
+ onClick={() => onOpenSettings("intelligence")}
>
{t("controlPanel.aiCta.enable")}
</Button>
diff --git a/src/components/ReasoningModelSelector.tsx b/src/components/ReasoningModelSelector.tsx
index c648ae8c1..1ebeca5ec 100644
--- a/src/components/ReasoningModelSelector.tsx
+++ b/src/components/ReasoningModelSelector.tsx
@@ -8,7 +8,7 @@ import type {
} from "../types/electron";
import { Button } from "./ui/button";
import { Input } from "./ui/input";
-import { Cloud, Lock } from "lucide-react";
+import { Cloud, Lock, Zap } from "lucide-react";
import ApiKeyInput from "./ui/ApiKeyInput";
import ModelCardList from "./ui/ModelCardList";
import LocalModelPicker, { type LocalProvider } from "./LocalModelPicker";
@@ -32,30 +32,6 @@ type CloudModelOption = {
invertInDark?: boolean;
};
-const OWNED_BY_ICON_RULES: Array<{ match: RegExp; provider: string }> = [
- { match: /(openai|system|default|gpt|davinci)/, provider: "openai" },
- { match: /(azure)/, provider: "openai" },
- { match: /(anthropic|claude)/, provider: "anthropic" },
- { match: /(google|gemini)/, provider: "gemini" },
- { match: /(meta|llama)/, provider: "llama" },
- { match: /(mistral)/, provider: "mistral" },
- { match: /(qwen|ali|tongyi)/, provider: "qwen" },
- { match: /(openrouter|oss)/, provider: "openai-oss" },
-];
-
-const resolveOwnedByIcon = (ownedBy?: string): { icon?: string; invertInDark: boolean } => {
- if (!ownedBy) return { icon: undefined, invertInDark: false };
- const normalized = ownedBy.toLowerCase();
- const rule = OWNED_BY_ICON_RULES.find(({ match }) => match.test(normalized));
- if (rule) {
- return {
- icon: getProviderIcon(rule.provider),
- invertInDark: isMonochromeProvider(rule.provider),
- };
- }
- return { icon: undefined, invertInDark: false };
-};
-
interface ReasoningModelSelectorProps {
reasoningModel: string;
setReasoningModel: (model: string) => void;
@@ -76,12 +52,18 @@ interface ReasoningModelSelectorProps {
}
function GpuStatusBadge() {
+ const { t } = useTranslation();
const [serverStatus, setServerStatus] = useState<LlamaServerStatus | null>(null);
const [vulkanStatus, setVulkanStatus] = useState<LlamaVulkanStatus | null>(null);
const [gpuResult, setGpuResult] = useState<VulkanGpuResult | null>(null);
const [progress, setProgress] = useState<LlamaVulkanDownloadProgress | null>(null);
const [downloading, setDownloading] = useState(false);
const [error, setError] = useState<string | null>(null);
+ const [activating, setActivating] = useState(false);
+ const [activationFailed, setActivationFailed] = useState(false);
+ const [dismissed, setDismissed] = useState(
+ () => localStorage.getItem("llamaVulkanBannerDismissed") === "true"
+ );
const platform = getCachedPlatform();
useEffect(() => {
@@ -118,6 +100,20 @@ function GpuStatusBadge() {
return () => cleanup?.();
}, []);
+ useEffect(() => {
+ if (!activating) return;
+ if (serverStatus?.gpuAccelerated) {
+ setActivating(false);
+ setActivationFailed(false);
+ return;
+ }
+ const timeout = setTimeout(() => {
+ setActivating(false);
+ setActivationFailed(true);
+ }, 15000);
+ return () => clearTimeout(timeout);
+ }, [activating, serverStatus?.gpuAccelerated]);
+
const handleDownload = async () => {
setDownloading(true);
setError(null);
@@ -125,12 +121,14 @@ function GpuStatusBadge() {
const result = await window.electronAPI?.downloadLlamaVulkanBinary?.();
if (result?.success) {
setVulkanStatus((prev) => (prev ? { ...prev, downloaded: true } : prev));
- window.electronAPI?.llamaGpuReset?.();
+ await window.electronAPI?.llamaGpuReset?.();
+ setActivating(true);
+ setActivationFailed(false);
} else if (result && !result.cancelled) {
- setError(result.error || "Download failed");
+ setError(result.error || t("gpu.activationFailed"));
}
} catch (err) {
- setError(err instanceof Error ? err.message : "Download failed");
+ setError(err instanceof Error ? err.message : t("gpu.activationFailed"));
} finally {
setDownloading(false);
setProgress(null);
@@ -142,44 +140,46 @@ function GpuStatusBadge() {
setVulkanStatus((prev) => (prev ? { ...prev, downloaded: false } : prev));
};
+ const handleRetry = async () => {
+ setActivationFailed(false);
+ setActivating(true);
+ await window.electronAPI?.llamaGpuReset?.();
+ };
+
+ // State 1: macOS
if (platform === "darwin") {
if (!serverStatus?.running) return null;
return (
<div className="flex items-center gap-1.5 mt-2 px-1">
- <span
- className="inline-block w-1.5 h-1.5 rounded-full shrink-0"
- style={{ backgroundColor: "#22c55e" }}
- />
- <span className="text-xs text-muted-foreground">GPU Accelerated (Metal)</span>
+ <span className="inline-block w-1.5 h-1.5 rounded-full shrink-0 bg-success" />
+ <span className="text-xs text-muted-foreground">{t("gpu.active")}</span>
</div>
);
}
+ // State 3: Downloading
if (downloading && progress) {
- const roundedPercent = Math.round(progress.percentage);
return (
<div className="flex items-center gap-2 mt-2 px-1">
- <div className="flex-1 h-1.5 bg-muted rounded-full overflow-hidden">
+ <div className="flex-1 h-1 bg-muted rounded-full overflow-hidden">
<div
className="h-full bg-primary transition-all"
- style={{ width: `${Math.min(progress.percentage, 100)}%` }}
+ style={{ width: `${progress.percentage}%` }}
/>
</div>
- <div className="relative flex items-center justify-center h-5 min-w-5 px-1 shrink-0">
- <div className="absolute inset-0 rounded-md bg-primary/15" />
- <span className="relative text-xs font-bold text-primary tabular-nums">{roundedPercent}%</span>
- </div>
+ <span className="text-xs text-muted-foreground tabular-nums">{progress.percentage}%</span>
<button
type="button"
onClick={() => window.electronAPI?.cancelLlamaVulkanDownload?.()}
- className="text-xs text-muted-foreground underline decoration-muted-foreground/30 hover:decoration-muted-foreground/60 hover:text-foreground transition-colors"
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors"
>
- Cancel
+ {t("gpu.cancel")}
</button>
</div>
);
}
+ // State 3b: Error
if (error) {
return (
<div className="flex items-center gap-1.5 mt-2 px-1">
@@ -187,58 +187,101 @@ function GpuStatusBadge() {
<button
type="button"
onClick={() => setError(null)}
- className="text-xs text-muted-foreground underline decoration-muted-foreground/30 hover:decoration-muted-foreground/60 hover:text-foreground transition-colors ml-1"
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-1"
>
- Dismiss
+ {t("gpu.dismiss")}
</button>
</div>
);
}
+ // State 5: Activating
+ if (activating) {
+ return (
+ <div className="flex items-center gap-1.5 mt-2 px-1">
+ <span className="inline-block w-1.5 h-1.5 rounded-full shrink-0 bg-primary animate-pulse" />
+ <span className="text-xs text-muted-foreground">{t("gpu.activating")}</span>
+ </div>
+ );
+ }
+
+ // State 4: Downloaded + GPU active
if (vulkanStatus?.downloaded) {
const isGpu = serverStatus?.gpuAccelerated && serverStatus?.backend === "vulkan";
+
+ // State 6: Activation failed
+ if (!isGpu && activationFailed) {
+ return (
+ <div className="flex items-center gap-1.5 mt-2 px-1">
+ <span className="inline-block w-1.5 h-1.5 rounded-full shrink-0 bg-warning" />
+ <span className="text-xs text-muted-foreground">{t("gpu.activationFailed")}</span>
+ <button
+ type="button"
+ onClick={handleRetry}
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-1"
+ >
+ {t("gpu.retry")}
+ </button>
+ <button
+ type="button"
+ onClick={handleDelete}
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-auto"
+ >
+ {t("gpu.remove")}
+ </button>
+ </div>
+ );
+ }
+
+ // State 4: GPU active or just downloaded
return (
<div className="flex items-center gap-1.5 mt-2 px-1">
<span
- className="inline-block w-1.5 h-1.5 rounded-full shrink-0"
- style={{ backgroundColor: isGpu ? "#22c55e" : "#f59e0b" }}
+ className={`inline-block w-1.5 h-1.5 rounded-full shrink-0 ${isGpu ? "bg-success" : "bg-warning"}`}
/>
<span className="text-xs text-muted-foreground">
- {isGpu ? "GPU Accelerated (Vulkan)" : "CPU Only"}
+ {isGpu ? t("gpu.active") : t("gpu.activating")}
</span>
- {!isGpu && serverStatus?.running && (
- <button
- type="button"
- onClick={() => window.electronAPI?.llamaGpuReset?.()}
- className="text-xs text-muted-foreground underline decoration-muted-foreground/30 hover:decoration-muted-foreground/60 hover:text-foreground transition-colors ml-1"
- >
- Re-detect GPU
- </button>
- )}
<button
type="button"
onClick={handleDelete}
- className="text-xs text-muted-foreground underline decoration-muted-foreground/30 hover:decoration-muted-foreground/60 hover:text-foreground transition-colors ml-auto"
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors ml-auto"
>
- Remove
+ {t("gpu.remove")}
</button>
</div>
);
}
- if (gpuResult?.available) {
+ // State 7: GPU available, not downloaded — show banner
+ if (gpuResult?.available && !dismissed) {
return (
- <div className="flex items-center gap-1.5 mt-2 px-1">
- <span className="text-xs text-muted-foreground">
- {gpuResult.deviceName || "GPU"} detected
- </span>
- <button
- type="button"
- onClick={handleDownload}
- className="text-xs text-muted-foreground underline decoration-muted-foreground/30 hover:decoration-muted-foreground/60 hover:text-foreground transition-colors ml-1"
- >
- Download Vulkan (~40MB)
- </button>
+ <div className="mt-2 rounded-md border border-primary/20 bg-primary/5 p-2.5">
+ <div className="flex items-start gap-2.5">
+ <Zap size={13} className="text-primary shrink-0 mt-0.5" />
+ <div className="flex-1 min-w-0">
+ <p className="text-xs font-medium text-foreground">{t("gpu.reasoningBanner")}</p>
+ <div className="flex items-center gap-2 mt-1.5">
+ <Button
+ onClick={handleDownload}
+ size="sm"
+ variant="default"
+ className="h-6 px-2.5 text-xs"
+ >
+ {t("gpu.enableButton")}
+ </Button>
+ <button
+ onClick={() => {
+ localStorage.setItem("llamaVulkanBannerDismissed", "true");
+ setDismissed(true);
+ }}
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors"
+ >
+ {t("gpu.dismiss")}
+ </button>
+ </div>
+ </div>
+ </div>
</div>
);
}
@@ -381,16 +424,13 @@ export default function ReasoningModelSelector({
const value = (item?.id || item?.name) as string | undefined;
if (!value) return null;
const ownedBy = typeof item?.owned_by === "string" ? item.owned_by : undefined;
- const { icon, invertInDark } = resolveOwnedByIcon(ownedBy);
return {
value,
label: (item?.id || item?.name || value) as string,
description:
(item?.description as string) ||
(ownedBy ? t("reasoning.custom.ownerLabel", { owner: ownedBy }) : undefined),
- icon,
ownedBy,
- invertInDark,
} as CloudModelOption;
})
.filter(Boolean) as CloudModelOption[];
diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsx
index e4bad1b29..c7c103eb5 100644
--- a/src/components/TranscriptionModelPicker.tsx
+++ b/src/components/TranscriptionModelPicker.tsx
@@ -950,9 +950,7 @@ export default function TranscriptionModelPicker({
<div className="flex items-center justify-between">
<div className="flex items-center gap-1.5">
<Check size={13} className="text-success" />
- <span className="text-xs font-medium text-foreground">
- GPU acceleration active
- </span>
+ <span className="text-xs font-medium text-foreground">{t("gpu.active")}</span>
</div>
<Button
onClick={handleCudaDelete}
@@ -960,37 +958,32 @@ export default function TranscriptionModelPicker({
variant="ghost"
className="h-6 px-2 text-xs text-muted-foreground hover:text-destructive"
>
- Remove
+ {t("gpu.remove")}
</Button>
</div>
) : (
- <div className="space-y-1.5">
- <div className="flex items-center gap-1.5">
- <Zap size={13} className="text-amber-500" />
- <span className="text-xs font-medium text-foreground">
- NVIDIA GPU detected
- {cudaStatus.gpuInfo.gpuName ? ` (${cudaStatus.gpuInfo.gpuName})` : ""}
- </span>
- </div>
- <p className="text-xs text-muted-foreground pl-5">
- GPU-accelerated Whisper available (~250 MB download)
- </p>
- <div className="flex items-center gap-2 pl-5">
- <Button
- onClick={handleCudaDownload}
- size="sm"
- variant="default"
- className="h-6 px-2.5 text-xs"
- >
- <Download size={11} className="mr-1" />
- Download
- </Button>
- <button
- onClick={() => setCudaDismissed(true)}
- className="text-xs text-muted-foreground hover:text-foreground transition-colors"
- >
- Not now
- </button>
+ <div className="flex items-start gap-2.5">
+ <Zap size={13} className="text-primary shrink-0 mt-0.5" />
+ <div className="flex-1 min-w-0">
+ <p className="text-xs font-medium text-foreground">
+ {t("gpu.transcriptionBanner")}
+ </p>
+ <div className="flex items-center gap-2 mt-1.5">
+ <Button
+ onClick={handleCudaDownload}
+ size="sm"
+ variant="default"
+ className="h-6 px-2.5 text-xs"
+ >
+ {t("gpu.enableButton")}
+ </Button>
+ <button
+ onClick={() => setCudaDismissed(true)}
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors"
+ >
+ {t("gpu.dismiss")}
+ </button>
+ </div>
</div>
</div>
)}
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 4b60a4459..06d1d7932 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -388,6 +388,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
this.onTranscriptionComplete?.(result);
+ if (result?.source === "openwhispr") {
+ window.dispatchEvent(new Event("usage-changed"));
+ }
+
const roundTripDurationMs = Math.round(performance.now() - pipelineStart);
const timingData = {
@@ -908,7 +912,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
stack: error.stack,
fallbackToCleanup: true,
});
- logger.error("Reasoning failed", { source, error: error.message }, "notes");
+ logger.warn("Reasoning failed", { source, error: error.message }, "notes");
}
}
@@ -1086,8 +1090,11 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
const language = getBaseLanguageCode(settings.preferredLanguage);
const arrayBuffer = await audioBlob.arrayBuffer();
+ const audioSizeBytes = audioBlob.size;
+ const audioFormat = audioBlob.type;
const opts = {};
if (language) opts.language = language;
+ if (settings.useReasoningModel && !this.skipReasoning) opts.sendLogs = "false";
const dictionaryPrompt = this.getCustomDictionaryPrompt();
if (dictionaryPrompt) opts.prompt = dictionaryPrompt;
@@ -1120,6 +1127,12 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
customPrompt: this.getCustomPrompt(),
language: settings.preferredLanguage || "auto",
locale: settings.uiLanguage || "en",
+ sttProvider: result.sttProvider,
+ sttModel: result.sttModel,
+ sttProcessingMs: result.sttProcessingMs,
+ audioDurationMs: result.audioDurationMs,
+ audioSizeBytes,
+ audioFormat,
});
if (!res.success) {
const err = new Error(res.error || "Cloud reasoning failed");
@@ -2147,6 +2160,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
);
const stSettings = getSettings();
+ let usedCloudReasoning = false;
if (stSettings.useReasoningModel && finalText && !this.skipReasoning) {
const reasoningStart = performance.now();
const agentName = localStorage.getItem("agentName") || "";
@@ -2161,6 +2175,9 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
customPrompt: this.getCustomPrompt(),
language: stSettings.preferredLanguage || "auto",
locale: stSettings.uiLanguage || "en",
+ sttProvider: "deepgram",
+ sttModel: "nova-3",
+ audioDurationMs: durationSeconds ? Math.round(durationSeconds * 1000) : undefined,
});
if (!res.success) {
const err = new Error(res.error || "Cloud reasoning failed");
@@ -2173,6 +2190,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
if (reasonResult.success && reasonResult.text) {
finalText = reasonResult.text;
}
+ usedCloudReasoning = true;
logger.info(
"Streaming reasoning complete",
@@ -2210,6 +2228,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
}
// If streaming produced no text, fall back to batch transcription
+ // (batch fallback records usage server-side via /api/transcribe)
+ let usedBatchFallback = false;
if (!finalText && durationSeconds > 2 && fallbackBlob?.size > 0) {
logger.info(
"Streaming produced no text, falling back to batch transcription",
@@ -2222,6 +2242,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
});
if (batchResult?.text) {
finalText = batchResult.text;
+ usedBatchFallback = true;
logger.info("Batch fallback succeeded", { textLength: finalText.length }, "streaming");
}
} catch (fallbackErr) {
@@ -2237,6 +2258,30 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
source: "deepgram-streaming",
});
+ if (!usedBatchFallback) {
+ (async () => {
+ try {
+ await withSessionRefresh(async () => {
+ const res = await window.electronAPI.cloudStreamingUsage(
+ finalText,
+ durationSeconds ?? 0,
+ { sendLogs: !usedCloudReasoning }
+ );
+ if (!res.success) {
+ const err = new Error(res.error || "Streaming usage recording failed");
+ err.code = res.code;
+ throw err;
+ }
+ });
+ } catch (err) {
+ logger.error("Failed to report streaming usage", { error: err.message }, "streaming");
+ }
+ window.dispatchEvent(new Event("usage-changed"));
+ })();
+ } else {
+ window.dispatchEvent(new Event("usage-changed"));
+ }
+
logger.info(
"Streaming total processing",
{
diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.js
index 047a24326..637fbfb95 100644
--- a/src/helpers/clipboard.js
+++ b/src/helpers/clipboard.js
@@ -255,6 +255,47 @@ class ClipboardManager {
return accessible;
}
+ _detectKdeWindowClass() {
+ if (this.commandExists("kdotool")) {
+ try {
+ const idResult = spawnSync("kdotool", ["getactivewindow"], { timeout: 1000 });
+ if (idResult.status === 0) {
+ const winId = idResult.stdout.toString().trim();
+ const classResult = spawnSync("kdotool", ["getwindowclassname", winId], {
+ timeout: 1000,
+ });
+ if (classResult.status === 0) {
+ const cls = classResult.stdout.toString().toLowerCase().trim();
+ if (cls) return cls;
+ }
+ }
+ } catch {}
+ }
+
+ const qdbus = ["qdbus6", "qdbus"].find((cmd) => this.commandExists(cmd));
+ if (qdbus) {
+ try {
+ const result = spawnSync(qdbus, ["org.kde.KWin", "/KWin", "supportInformation"], {
+ timeout: 2000,
+ maxBuffer: 512 * 1024,
+ });
+ if (result.status === 0) {
+ const lines = result.stdout.toString().split("\n");
+ let lastClass = null;
+ for (const line of lines) {
+ const classMatch = line.match(/^\s*resourceClass:\s+(.+)$/);
+ if (classMatch) lastClass = classMatch[1].trim();
+ if (/^\s*active:\s+(1|true)\s*$/i.test(line) && lastClass) {
+ return lastClass.toLowerCase();
+ }
+ }
+ }
+ } catch {}
+ }
+
+ return null;
+ }
+
safeLog(...args) {
if (process.env.NODE_ENV === "development") {
try {
@@ -827,18 +868,25 @@ class ClipboardManager {
};
const targetWindowId = preDetectTargetWindow();
- const xdotoolWindowClass = preDetectWindowClass(targetWindowId);
+ let detectedWindowClass = preDetectWindowClass(targetWindowId);
+
+ if (!detectedWindowClass && isKde) {
+ detectedWindowClass = this._detectKdeWindowClass();
+ if (detectedWindowClass) {
+ debugLogger.debug("KDE window class detected", { detectedWindowClass }, "clipboard");
+ }
+ }
if (linuxFastPaste) {
- const earlyIsTerminal = xdotoolWindowClass
- ? terminalClasses.some((t) => xdotoolWindowClass.includes(t))
+ const earlyIsTerminal = detectedWindowClass
+ ? terminalClasses.some((t) => detectedWindowClass.includes(t))
: false;
const spawnFastPaste = (args, label) =>
new Promise((resolve, reject) => {
debugLogger.debug(
`Attempting native linux-fast-paste (${label})`,
- { linuxFastPaste, args, targetWindowId, xdotoolWindowClass, earlyIsTerminal },
+ { linuxFastPaste, args, targetWindowId, detectedWindowClass, earlyIsTerminal },
"clipboard"
);
const proc = spawn(linuxFastPaste, args);
@@ -950,32 +998,12 @@ class ClipboardManager {
// Terminals use Ctrl+Shift+V instead of Ctrl+V
const isTerminal = () => {
- if (xdotoolWindowClass) {
- const isTerminalWindow = terminalClasses.some((term) => xdotoolWindowClass.includes(term));
- if (isTerminalWindow) {
- this.safeLog(`🖥️ Terminal detected via xdotool: ${xdotoolWindowClass}`);
- }
- return isTerminalWindow;
+ if (!detectedWindowClass) return false;
+ const isTerminalWindow = terminalClasses.some((term) => detectedWindowClass.includes(term));
+ if (isTerminalWindow) {
+ this.safeLog(`🖥️ Terminal detected: ${detectedWindowClass}`);
}
-
- try {
- if (this.commandExists("kdotool")) {
- const windowIdResult = spawnSync("kdotool", ["getactivewindow"]);
- if (windowIdResult.status === 0) {
- const windowId = windowIdResult.stdout.toString().trim();
- const classResult = spawnSync("kdotool", ["getwindowclassname", windowId]);
- if (classResult.status === 0) {
- const className = classResult.stdout.toString().toLowerCase().trim();
- const isTerminalWindow = terminalClasses.some((term) => className.includes(term));
- if (isTerminalWindow) {
- this.safeLog(`🖥️ Terminal detected via kdotool: ${className}`);
- }
- return isTerminalWindow;
- }
- }
- }
- } catch {}
- return false;
+ return isTerminalWindow;
};
const inTerminal = isTerminal();
@@ -992,7 +1020,7 @@ class ClipboardManager {
if (targetWindowId) {
this.safeLog(
- `🎯 Targeting window ID ${targetWindowId} for paste (class: ${xdotoolWindowClass})`
+ `🎯 Targeting window ID ${targetWindowId} for paste (class: ${detectedWindowClass})`
);
}
@@ -1036,7 +1064,7 @@ class ClipboardManager {
candidateTools: candidates.map((c) => c.cmd),
availableTools: available.map((c) => c.cmd),
targetWindowId,
- xdotoolWindowClass,
+ detectedWindowClass,
inTerminal,
pasteKeys,
},
diff --git a/src/helpers/globeKeyManager.js b/src/helpers/globeKeyManager.js
index e2884973e..22443bb49 100644
--- a/src/helpers/globeKeyManager.js
+++ b/src/helpers/globeKeyManager.js
@@ -4,12 +4,28 @@ const EventEmitter = require("events");
const fs = require("fs");
const debugLogger = require("./debugLogger");
+// Mach-O CPU type constants for architecture verification
+const ARCH_CPU_TYPE = {
+ arm64: 0x0100000c, // CPU_TYPE_ARM64
+ x64: 0x01000007, // CPU_TYPE_X86_64
+};
+
+// Maximum number of rapid automatic restarts before giving up
+const MAX_RESTART_ATTEMPTS = 3;
+// Delay between restart attempts (ms)
+const RESTART_DELAY_MS = 1000;
+// After this much sustained uptime, reset restart counter (allows future restarts after sleep/wake)
+const RESTART_RESET_MS = 10000;
+
class GlobeKeyManager extends EventEmitter {
constructor() {
super();
this.process = null;
this.isSupported = process.platform === "darwin";
this.hasReportedError = false;
+ this._isStopping = false;
+ this._restartCount = 0;
+ this._restartResetTimer = null;
}
start() {
@@ -22,6 +38,8 @@ class GlobeKeyManager extends EventEmitter {
return;
}
+ this._isStopping = false;
+
const listenerPath = this.resolveListenerBinary();
if (!listenerPath) {
debugLogger.info("[GlobeKeyManager] Binary not found in any candidate path");
@@ -35,6 +53,13 @@ class GlobeKeyManager extends EventEmitter {
debugLogger.info("[GlobeKeyManager] Binary found", { path: listenerPath });
+ // Verify binary architecture matches the running process
+ const archMismatch = this._checkArchMismatch(listenerPath);
+ if (archMismatch) {
+ this.reportError(new Error(archMismatch));
+ return;
+ }
+
try {
fs.accessSync(listenerPath, fs.constants.X_OK);
} catch {
@@ -53,6 +78,17 @@ class GlobeKeyManager extends EventEmitter {
this.process = spawn(listenerPath);
debugLogger.info("[GlobeKeyManager] Process spawned", { pid: this.process.pid });
+ // After sustained uptime, reset the restart counter so future sleep/wake
+ // cycles get a fresh set of restart attempts
+ if (this._restartResetTimer) clearTimeout(this._restartResetTimer);
+ this._restartResetTimer = setTimeout(() => {
+ this._restartResetTimer = null;
+ if (this._restartCount > 0) {
+ debugLogger.info("[GlobeKeyManager] Sustained uptime — restart counter reset");
+ this._restartCount = 0;
+ }
+ }, RESTART_RESET_MS);
+
this.process.stdout.setEncoding("utf8");
this.process.stdout.on("data", (chunk) => {
chunk
@@ -87,8 +123,11 @@ class GlobeKeyManager extends EventEmitter {
this.process.stderr.on("data", (data) => {
const message = data.toString().trim();
if (message.length > 0) {
- debugLogger.info("[GlobeKeyManager] stderr", { message });
- this.reportError(new Error(message));
+ if (message.includes("Failed to create event tap")) {
+ this.reportError(new Error(message));
+ } else {
+ debugLogger.warn("[GlobeKeyManager] Non-fatal stderr output", { message });
+ }
}
});
@@ -101,16 +140,58 @@ class GlobeKeyManager extends EventEmitter {
this.process.on("exit", (code, signal) => {
debugLogger.info("[GlobeKeyManager] Process exited", { code, signal });
this.process = null;
- if (code !== 0 && signal !== "SIGINT" && signal !== "SIGTERM") {
+ if (this._restartResetTimer) {
+ clearTimeout(this._restartResetTimer);
+ this._restartResetTimer = null;
+ }
+
+ // Intentional stop — don't restart or report
+ if (this._isStopping || signal === "SIGINT" || signal === "SIGTERM") {
+ return;
+ }
+
+ if (code !== 0) {
const error = new Error(
`Globe key listener exited with code ${code ?? "null"} signal ${signal ?? "null"}`
);
this.reportError(error);
+ return;
+ }
+
+ // Exit code 0 but we didn't request stop — the event tap was likely
+ // invalidated (e.g. after sleep/wake). Attempt automatic restart.
+ if (this._restartCount < MAX_RESTART_ATTEMPTS) {
+ this._restartCount++;
+ debugLogger.warn(
+ `[GlobeKeyManager] Unexpected exit (code 0), restarting (attempt ${this._restartCount}/${MAX_RESTART_ATTEMPTS})`
+ );
+ setTimeout(() => {
+ if (!this._isStopping && !this.process) {
+ this.start();
+ }
+ }, RESTART_DELAY_MS);
+ } else {
+ debugLogger.error(
+ "GlobeKeyManager exhausted restart attempts",
+ { attempts: MAX_RESTART_ATTEMPTS },
+ "hotkey"
+ );
+ this.reportError(
+ new Error(
+ `Globe key listener keeps exiting unexpectedly (${MAX_RESTART_ATTEMPTS} restarts failed). ` +
+ "Try restarting OpenWhispr."
+ )
+ );
}
});
}
stop() {
+ this._isStopping = true;
+ if (this._restartResetTimer) {
+ clearTimeout(this._restartResetTimer);
+ this._restartResetTimer = null;
+ }
if (this.process) {
this.process.kill();
this.process = null;
@@ -135,6 +216,44 @@ class GlobeKeyManager extends EventEmitter {
this.emit("error", error);
}
+ _checkArchMismatch(binaryPath) {
+ try {
+ const fd = fs.openSync(binaryPath, "r");
+ const header = Buffer.alloc(8);
+ fs.readSync(fd, header, 0, 8, 0);
+ fs.closeSync(fd);
+
+ const magic = header.readUInt32LE(0);
+ if (magic !== 0xfeedfacf) {
+ return `Globe listener binary is not a valid 64-bit Mach-O file (magic: 0x${magic.toString(16)})`;
+ }
+
+ const cpuType = header.readInt32LE(4);
+ const expectedCpu = ARCH_CPU_TYPE[process.arch];
+ if (expectedCpu && cpuType !== expectedCpu) {
+ const archNames = { [ARCH_CPU_TYPE.arm64]: "arm64", [ARCH_CPU_TYPE.x64]: "x86_64" };
+ const binaryArch = archNames[cpuType] || `unknown(0x${cpuType.toString(16)})`;
+ return (
+ `Globe listener binary architecture mismatch: binary is ${binaryArch} ` +
+ `but this Mac requires ${process.arch}. The app may have been built incorrectly. ` +
+ `Try reinstalling or run \`TARGET_ARCH=${process.arch} npm run compile:globe\`.`
+ );
+ }
+
+ debugLogger.info("[GlobeKeyManager] Binary architecture verified", {
+ arch: process.arch,
+ cpuType: `0x${cpuType.toString(16)}`,
+ });
+ return null;
+ } catch (err) {
+ debugLogger.warn("[GlobeKeyManager] Could not verify binary architecture", {
+ error: err.message,
+ });
+ // Don't block startup on verification failure — let spawn attempt proceed
+ return null;
+ }
+ }
+
resolveListenerBinary() {
const candidates = new Set([
path.join(__dirname, "..", "..", "resources", "bin", "macos-globe-listener"),
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index c28314afe..c88b6a737 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -1188,16 +1188,36 @@ class IPCHandlers {
if (prefs.localTranscriptionProvider === "nvidia") {
setVars.PARAKEET_MODEL = prefs.model;
clearVars.push("LOCAL_WHISPER_MODEL");
+ this.whisperManager.stopServer().catch((err) => {
+ debugLogger.error("Failed to stop whisper-server on provider switch", {
+ error: err.message,
+ });
+ });
} else {
setVars.LOCAL_WHISPER_MODEL = prefs.model;
clearVars.push("PARAKEET_MODEL");
+ this.parakeetManager.stopServer().catch((err) => {
+ debugLogger.error("Failed to stop parakeet-server on provider switch", {
+ error: err.message,
+ });
+ });
}
} else if (prefs.useLocalWhisper) {
// Local mode enabled but no model selected - clear pre-warming vars
clearVars.push("LOCAL_TRANSCRIPTION_PROVIDER", "PARAKEET_MODEL", "LOCAL_WHISPER_MODEL");
} else {
- // Cloud mode - clear all local transcription vars
+ // Cloud mode - stop local servers to free RAM
clearVars.push("LOCAL_TRANSCRIPTION_PROVIDER", "PARAKEET_MODEL", "LOCAL_WHISPER_MODEL");
+ this.whisperManager.stopServer().catch((err) => {
+ debugLogger.error("Failed to stop whisper-server on cloud switch", {
+ error: err.message,
+ });
+ });
+ this.parakeetManager.stopServer().catch((err) => {
+ debugLogger.error("Failed to stop parakeet-server on cloud switch", {
+ error: err.message,
+ });
+ });
}
if (prefs.reasoningProvider === "local" && prefs.reasoningModel) {
@@ -1205,6 +1225,12 @@ class IPCHandlers {
setVars.LOCAL_REASONING_MODEL = prefs.reasoningModel;
} else if (prefs.reasoningProvider && prefs.reasoningProvider !== "local") {
clearVars.push("REASONING_PROVIDER", "LOCAL_REASONING_MODEL");
+ const modelManager = require("./modelManagerBridge").default;
+ modelManager.stopServer().catch((err) => {
+ debugLogger.error("Failed to stop llama-server on provider switch", {
+ error: err.message,
+ });
+ });
}
this._syncStartupEnv(setVars, clearVars);
@@ -1626,8 +1652,10 @@ class IPCHandlers {
const { body, boundary } = buildMultipartBody(audioData, "audio.webm", "audio/webm", {
language: opts.language,
prompt: opts.prompt,
+ sendLogs: opts.sendLogs,
clientType: "desktop",
appVersion: app.getVersion(),
+ clientVersion: app.getVersion(),
sessionId: this.sessionId,
});
@@ -1669,6 +1697,10 @@ class IPCHandlers {
wordsRemaining: data.data.wordsRemaining,
plan: data.data.plan,
limitReached: data.data.limitReached || false,
+ sttProvider: data.data.sttProvider,
+ sttModel: data.data.sttModel,
+ sttProcessingMs: data.data.sttProcessingMs,
+ audioDurationMs: data.data.audioDurationMs,
};
} catch (error) {
debugLogger.error("Cloud transcription error", { error: error.message }, "cloud-api");
@@ -1712,6 +1744,13 @@ class IPCHandlers {
sessionId: this.sessionId,
clientType: "desktop",
appVersion: app.getVersion(),
+ clientVersion: app.getVersion(),
+ sttProvider: opts.sttProvider,
+ sttModel: opts.sttModel,
+ sttProcessingMs: opts.sttProcessingMs,
+ audioDurationMs: opts.audioDurationMs,
+ audioSizeBytes: opts.audioSizeBytes,
+ audioFormat: opts.audioFormat,
}),
});
@@ -1740,6 +1779,49 @@ class IPCHandlers {
}
});
+ ipcMain.handle(
+ "cloud-streaming-usage",
+ async (event, text, audioDurationSeconds, opts = {}) => {
+ try {
+ const apiUrl = getApiUrl();
+ if (!apiUrl) throw new Error("OpenWhispr API URL not configured");
+
+ const cookieHeader = await getSessionCookies(event);
+ if (!cookieHeader) throw new Error("No session cookies available");
+
+ const response = await fetch(`${apiUrl}/api/streaming-usage`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Cookie: cookieHeader,
+ },
+ body: JSON.stringify({
+ text,
+ audioDurationSeconds,
+ sessionId: this.sessionId,
+ clientType: "desktop",
+ appVersion: app.getVersion(),
+ clientVersion: app.getVersion(),
+ sendLogs: opts.sendLogs,
+ }),
+ });
+
+ if (response.status === 401) {
+ return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
+ }
+ if (!response.ok) {
+ throw new Error(`API error: ${response.status}`);
+ }
+
+ const data = await response.json();
+ return { success: true, ...data };
+ } catch (error) {
+ debugLogger.error("Cloud streaming usage error", { error: error.message }, "cloud-api");
+ return { success: false, error: error.message };
+ }
+ }
+ );
+
ipcMain.handle("cloud-usage", async (event) => {
try {
const apiUrl = getApiUrl();
@@ -1831,6 +1913,7 @@ class IPCHandlers {
source: "file_upload",
clientType: "desktop",
appVersion: app.getVersion(),
+ clientVersion: app.getVersion(),
sessionId: this.sessionId,
});
diff --git a/src/helpers/parakeetServer.js b/src/helpers/parakeetServer.js
index 318077169..03c21845d 100644
--- a/src/helpers/parakeetServer.js
+++ b/src/helpers/parakeetServer.js
@@ -14,7 +14,7 @@ const ParakeetWsServer = require("./parakeetWsServer");
const SAMPLE_RATE = 16000;
const BYTES_PER_SAMPLE = 4; // float32
-const MAX_SEGMENT_SECONDS = 30;
+const MAX_SEGMENT_SECONDS = 15;
const MAX_SEGMENT_BYTES = MAX_SEGMENT_SECONDS * SAMPLE_RATE * BYTES_PER_SAMPLE;
const SILENCE_RMS_THRESHOLD = 0.001;
@@ -78,9 +78,6 @@ class ParakeetServerManager {
await convertToWav(tempInputPath, tempWavPath, { sampleRate: 16000, channels: 1 });
- const outputStats = fs.statSync(tempWavPath);
- debugLogger.debug("FFmpeg conversion complete", { outputSize: outputStats.size });
-
const wavBuffer = fs.readFileSync(tempWavPath);
return { wavBuffer, filesToCleanup: [tempInputPath, tempWavPath] };
}
@@ -117,6 +114,13 @@ class ParakeetServerManager {
if (samples.length <= MAX_SEGMENT_BYTES) {
const result = await this.wsServer.transcribe(samples, SAMPLE_RATE);
+ if (!result.text?.trim()) {
+ debugLogger.warn("Parakeet returned empty text for non-silent audio", {
+ durationSeconds,
+ rms,
+ samplesBytes: samples.length,
+ });
+ }
return { ...result, language };
}
@@ -133,7 +137,14 @@ class ParakeetServerManager {
const segment = samples.subarray(offset, end);
const result = await this.wsServer.transcribe(segment, SAMPLE_RATE);
totalElapsed += result.elapsed || 0;
- if (result.text) texts.push(result.text);
+ if (result.text) {
+ texts.push(result.text);
+ } else {
+ debugLogger.warn("Parakeet segment returned empty text", {
+ segmentIndex: offset / MAX_SEGMENT_BYTES,
+ segmentDuration: segment.length / BYTES_PER_SAMPLE / SAMPLE_RATE,
+ });
+ }
}
return { text: texts.join(" "), elapsed: totalElapsed, language };
diff --git a/src/helpers/tray.js b/src/helpers/tray.js
index d9b13cdd3..b80b9eec3 100644
--- a/src/helpers/tray.js
+++ b/src/helpers/tray.js
@@ -79,6 +79,9 @@ class TrayManager {
this.controlPanelWindow.show();
}
this.controlPanelWindow.focus();
+ if (this.controlPanelWindow.webContents.isCrashed()) {
+ this.controlPanelWindow.webContents.reload();
+ }
return;
}
diff --git a/src/helpers/windowConfig.js b/src/helpers/windowConfig.js
index 8988aded7..4ce7867d2 100644
--- a/src/helpers/windowConfig.js
+++ b/src/helpers/windowConfig.js
@@ -37,6 +37,7 @@ const MAIN_WINDOW_CONFIG = {
const CONTROL_PANEL_CONFIG = {
width: 1200,
height: 800,
+ backgroundColor: "#1c1c2e",
webPreferences: {
preload: path.join(__dirname, "..", "..", "preload.js"),
nodeIntegration: false,
@@ -50,6 +51,7 @@ const CONTROL_PANEL_CONFIG = {
// directly from the browser. These would be blocked by CORS otherwise.
webSecurity: false,
spellcheck: false,
+ backgroundThrottling: false,
},
title: "Control Panel",
resizable: true,
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index db128801c..ff67f3f21 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -531,6 +531,24 @@ class WindowManager {
}
);
+ this.controlPanelWindow.webContents.on("render-process-gone", (_event, details) => {
+ if (details.reason === "crashed" || details.reason === "killed" || details.reason === "oom") {
+ debugLogger.error(
+ "Control panel renderer process gone",
+ { reason: details.reason, exitCode: details.exitCode },
+ "window"
+ );
+ setTimeout(() => this.loadControlPanel(), 1000);
+ }
+ });
+
+ this.controlPanelWindow.on("show", () => {
+ if (this.controlPanelWindow.webContents.isCrashed()) {
+ debugLogger.error("Control panel crashed, reloading on show", undefined, "window");
+ this.loadControlPanel();
+ }
+ });
+
await this.loadControlPanel();
}
diff --git a/src/hooks/useUsage.ts b/src/hooks/useUsage.ts
index 8633b0732..bf0cd363b 100644
--- a/src/hooks/useUsage.ts
+++ b/src/hooks/useUsage.ts
@@ -111,8 +111,16 @@ export function useUsage(): UseUsageResult | null {
fetchUsage();
}
};
+ const handleUsageChanged = () => {
+ lastFetchRef.current = 0;
+ fetchUsage();
+ };
window.addEventListener("focus", handleFocus);
- return () => window.removeEventListener("focus", handleFocus);
+ window.addEventListener("usage-changed", handleUsageChanged);
+ return () => {
+ window.removeEventListener("focus", handleFocus);
+ window.removeEventListener("usage-changed", handleUsageChanged);
+ };
}, [isLoaded, isSignedIn, fetchUsage]);
const openCheckout = useCallback(
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index a22635c35..c1c2a084a 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -234,7 +234,13 @@
"description": "Korrigiert automatisch Grammatik, Zeichensetzung und Formatierung, während Sie sprechen.",
"enable": "KI-Verbesserung aktivieren"
},
- "loading": "Laden..."
+ "loading": "Laden...",
+ "gpu": {
+ "bannerTitle": "GPU-Beschleunigung verfügbar",
+ "bannerDescription": "Aktiviere die GPU-Beschleunigung für schnellere Leistung.",
+ "enableButton": "GPU aktivieren",
+ "dismissButton": "Nicht jetzt"
+ }
},
"reasoning": {
"mode": {
@@ -1436,6 +1442,9 @@
"realtimeBanner": {
"message": "Echtzeit-Transkription mit Pro verfügbar",
"upgrade": "Upgraden"
+ },
+ "enhance": {
+ "title": "Verbesserungsfehler"
}
},
"dictionary": {
@@ -1502,5 +1511,47 @@
"add": "Hinzufügen",
"editButton": "Bearbeiten",
"addButton": "Hinzufügen"
+ },
+ "gpu": {
+ "transcriptionBanner": "Transkription mit GPU beschleunigen",
+ "reasoningBanner": "KI-Verarbeitung mit GPU beschleunigen",
+ "enableButton": "GPU aktivieren",
+ "active": "GPU-Beschleunigung aktiv",
+ "activating": "GPU wird aktiviert...",
+ "activationFailed": "GPU konnte nicht aktiviert werden",
+ "retry": "Erneut versuchen",
+ "remove": "Entfernen",
+ "dismiss": "Nicht jetzt",
+ "cancel": "Abbrechen"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Tastenkombination geändert"
+ },
+ "hotkeyUnavailable": {
+ "title": "Tastenkombination nicht verfügbar",
+ "description": "Die ausgewählte Tastenkombination konnte nicht registriert werden. Bitte wähle eine andere in den Einstellungen."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "{{hotkey}} drücken zum Sprechen",
+ "recording": "Aufnahme...",
+ "processing": "Verarbeitung...",
+ "clickToSpeak": "Klicken zum Sprechen"
+ },
+ "buttons": {
+ "cancelRecording": "Aufnahme abbrechen",
+ "cancelProcessing": "Verarbeitung abbrechen"
+ },
+ "commandMenu": {
+ "stopListening": "Aufnahme beenden",
+ "startListening": "Aufnahme starten",
+ "hideForNow": "Vorerst ausblenden"
+ },
+ "oauth": {
+ "redirectTitle": "Weiterleitung zur App...",
+ "closeTab": "Du kannst diesen Tab schließen."
+ }
}
}
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 29734035e..13e0a06bd 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -234,7 +234,13 @@
"description": "Automatically fix grammar, punctuation, and formatting as you speak.",
"enable": "Enable AI Enhancement"
},
- "loading": "Loading..."
+ "loading": "Loading...",
+ "gpu": {
+ "bannerTitle": "GPU acceleration available",
+ "bannerDescription": "Enable GPU acceleration for faster performance.",
+ "enableButton": "Enable GPU",
+ "dismissButton": "Not now"
+ }
},
"reasoning": {
"mode": {
@@ -1472,6 +1478,9 @@
"realtimeBanner": {
"message": "Real-time transcription available on Pro",
"upgrade": "Upgrade"
+ },
+ "enhance": {
+ "title": "Enhancement error"
}
},
"dictionary": {
@@ -1502,5 +1511,47 @@
"add": "Add API key",
"editButton": "edit",
"addButton": "add"
+ },
+ "gpu": {
+ "transcriptionBanner": "Speed up transcription with GPU acceleration",
+ "reasoningBanner": "Speed up AI processing with GPU acceleration",
+ "enableButton": "Enable GPU",
+ "active": "GPU acceleration active",
+ "activating": "Activating GPU...",
+ "activationFailed": "GPU could not be activated",
+ "retry": "Retry",
+ "remove": "Remove",
+ "dismiss": "Not now",
+ "cancel": "Cancel"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Hotkey changed"
+ },
+ "hotkeyUnavailable": {
+ "title": "Hotkey unavailable",
+ "description": "The selected hotkey could not be registered. Please choose a different one in settings."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Press {{hotkey}} to speak",
+ "recording": "Recording...",
+ "processing": "Processing...",
+ "clickToSpeak": "Click to speak"
+ },
+ "buttons": {
+ "cancelRecording": "Cancel recording",
+ "cancelProcessing": "Cancel processing"
+ },
+ "commandMenu": {
+ "stopListening": "Stop listening",
+ "startListening": "Start listening",
+ "hideForNow": "Hide for now"
+ },
+ "oauth": {
+ "redirectTitle": "Redirecting to app...",
+ "closeTab": "You can close this tab."
+ }
}
}
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 03ead7aef..bb9e8657a 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -234,7 +234,13 @@
"description": "Corrige automáticamente gramática, puntuación y formato mientras hablas.",
"enable": "Activar mejora con IA"
},
- "loading": "Cargando..."
+ "loading": "Cargando...",
+ "gpu": {
+ "bannerTitle": "Aceleración GPU disponible",
+ "bannerDescription": "Activa la aceleración GPU para un rendimiento más rápido.",
+ "enableButton": "Activar GPU",
+ "dismissButton": "Ahora no"
+ }
},
"reasoning": {
"mode": {
@@ -1440,6 +1446,9 @@
"realtimeBanner": {
"message": "Transcripción en tiempo real disponible con Pro",
"upgrade": "Mejorar"
+ },
+ "enhance": {
+ "title": "Error de mejora"
}
},
"dictionary": {
@@ -1506,5 +1515,47 @@
"add": "Agregar",
"editButton": "Editar",
"addButton": "Agregar"
+ },
+ "gpu": {
+ "transcriptionBanner": "Acelera la transcripción con GPU",
+ "reasoningBanner": "Acelera el procesamiento de IA con GPU",
+ "enableButton": "Activar GPU",
+ "active": "Aceleración GPU activa",
+ "activating": "Activando GPU...",
+ "activationFailed": "No se pudo activar la GPU",
+ "retry": "Reintentar",
+ "remove": "Eliminar",
+ "dismiss": "Ahora no",
+ "cancel": "Cancelar"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Atajo cambiado"
+ },
+ "hotkeyUnavailable": {
+ "title": "Atajo no disponible",
+ "description": "No se pudo registrar el atajo seleccionado. Elige otro en la configuración."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Pulsa {{hotkey}} para hablar",
+ "recording": "Grabando...",
+ "processing": "Procesando...",
+ "clickToSpeak": "Haz clic para hablar"
+ },
+ "buttons": {
+ "cancelRecording": "Cancelar grabación",
+ "cancelProcessing": "Cancelar procesamiento"
+ },
+ "commandMenu": {
+ "stopListening": "Dejar de escuchar",
+ "startListening": "Empezar a escuchar",
+ "hideForNow": "Ocultar por ahora"
+ },
+ "oauth": {
+ "redirectTitle": "Redirigiendo a la app...",
+ "closeTab": "Puedes cerrar esta pestaña."
+ }
}
}
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index e20bfb72c..4ccd8abc3 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -234,7 +234,13 @@
"description": "Corrige automatiquement grammaire, ponctuation et mise en forme pendant que vous parlez.",
"enable": "Activer l'amélioration IA"
},
- "loading": "Chargement..."
+ "loading": "Chargement...",
+ "gpu": {
+ "bannerTitle": "Accélération GPU disponible",
+ "bannerDescription": "Activez l'accélération GPU pour de meilleures performances.",
+ "enableButton": "Activer le GPU",
+ "dismissButton": "Pas maintenant"
+ }
},
"reasoning": {
"mode": {
@@ -1476,6 +1482,9 @@
"realtimeBanner": {
"message": "Transcription en temps réel disponible avec Pro",
"upgrade": "Passer à Pro"
+ },
+ "enhance": {
+ "title": "Erreur d'amélioration"
}
},
"dictionary": {
@@ -1506,5 +1515,47 @@
"add": "Ajouter une clé API",
"editButton": "modifier",
"addButton": "ajouter"
+ },
+ "gpu": {
+ "transcriptionBanner": "Accélérez la transcription avec le GPU",
+ "reasoningBanner": "Accélérez le traitement IA avec le GPU",
+ "enableButton": "Activer le GPU",
+ "active": "Accélération GPU active",
+ "activating": "Activation du GPU...",
+ "activationFailed": "Impossible d'activer le GPU",
+ "retry": "Réessayer",
+ "remove": "Supprimer",
+ "dismiss": "Pas maintenant",
+ "cancel": "Annuler"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Raccourci modifié"
+ },
+ "hotkeyUnavailable": {
+ "title": "Raccourci indisponible",
+ "description": "Le raccourci sélectionné n’a pas pu être enregistré. Veuillez en choisir un autre dans les paramètres."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Appuyez sur {{hotkey}} pour parler",
+ "recording": "Enregistrement...",
+ "processing": "Traitement...",
+ "clickToSpeak": "Cliquez pour parler"
+ },
+ "buttons": {
+ "cancelRecording": "Annuler l’enregistrement",
+ "cancelProcessing": "Annuler le traitement"
+ },
+ "commandMenu": {
+ "stopListening": "Arrêter l’écoute",
+ "startListening": "Commencer l’écoute",
+ "hideForNow": "Masquer pour l’instant"
+ },
+ "oauth": {
+ "redirectTitle": "Redirection vers l'app...",
+ "closeTab": "Vous pouvez fermer cet onglet."
+ }
}
}
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 4817be33d..e7805021f 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -234,7 +234,13 @@
"description": "Corregge automaticamente grammatica, punteggiatura e formattazione mentre parli.",
"enable": "Attiva miglioramento IA"
},
- "loading": "Caricamento..."
+ "loading": "Caricamento...",
+ "gpu": {
+ "bannerTitle": "Accelerazione GPU disponibile",
+ "bannerDescription": "Attiva l'accelerazione GPU per prestazioni più veloci.",
+ "enableButton": "Attiva GPU",
+ "dismissButton": "Non ora"
+ }
},
"reasoning": {
"mode": {
@@ -1440,6 +1446,9 @@
"realtimeBanner": {
"message": "Trascrizione in tempo reale disponibile con Pro",
"upgrade": "Passa a Pro"
+ },
+ "enhance": {
+ "title": "Errore di miglioramento"
}
},
"dictionary": {
@@ -1506,5 +1515,47 @@
"add": "Aggiungi",
"editButton": "Modifica",
"addButton": "Aggiungi"
+ },
+ "gpu": {
+ "transcriptionBanner": "Velocizza la trascrizione con la GPU",
+ "reasoningBanner": "Velocizza l'elaborazione IA con la GPU",
+ "enableButton": "Attiva GPU",
+ "active": "Accelerazione GPU attiva",
+ "activating": "Attivazione GPU...",
+ "activationFailed": "Impossibile attivare la GPU",
+ "retry": "Riprova",
+ "remove": "Rimuovi",
+ "dismiss": "Non ora",
+ "cancel": "Annulla"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Scorciatoia modificata"
+ },
+ "hotkeyUnavailable": {
+ "title": "Scorciatoia non disponibile",
+ "description": "Non è stato possibile registrare la scorciatoia selezionata. Scegline un’altra nelle impostazioni."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Premi {{hotkey}} per parlare",
+ "recording": "Registrazione...",
+ "processing": "Elaborazione...",
+ "clickToSpeak": "Clicca per parlare"
+ },
+ "buttons": {
+ "cancelRecording": "Annulla registrazione",
+ "cancelProcessing": "Annulla elaborazione"
+ },
+ "commandMenu": {
+ "stopListening": "Smetti di ascoltare",
+ "startListening": "Inizia ad ascoltare",
+ "hideForNow": "Nascondi per ora"
+ },
+ "oauth": {
+ "redirectTitle": "Reindirizzamento all'app...",
+ "closeTab": "Puoi chiudere questa scheda."
+ }
}
}
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index a27a398c0..6a9b17f59 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -234,7 +234,13 @@
"description": "話しながら文法、句読点、書式を自動的に修正します。",
"enable": "AI 補正を有効にする"
},
- "loading": "読み込み中..."
+ "loading": "読み込み中...",
+ "gpu": {
+ "bannerTitle": "GPU アクセラレーションが利用可能",
+ "bannerDescription": "GPU アクセラレーションを有効にしてパフォーマンスを向上させましょう。",
+ "enableButton": "GPU を有効化",
+ "dismissButton": "後で"
+ }
},
"reasoning": {
"mode": {
@@ -1364,6 +1370,9 @@
"realtimeBanner": {
"message": "Pro でリアルタイム文字起こしが利用可能",
"upgrade": "アップグレード"
+ },
+ "enhance": {
+ "title": "強化エラー"
}
},
"dictionary": {
@@ -1502,5 +1511,47 @@
"add": "追加",
"editButton": "編集",
"addButton": "追加"
+ },
+ "gpu": {
+ "transcriptionBanner": "GPU で文字起こしを高速化",
+ "reasoningBanner": "GPU で AI 処理を高速化",
+ "enableButton": "GPU を有効化",
+ "active": "GPU アクセラレーション有効",
+ "activating": "GPU を有効化中...",
+ "activationFailed": "GPU を有効化できませんでした",
+ "retry": "再試行",
+ "remove": "削除",
+ "dismiss": "後で",
+ "cancel": "キャンセル"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "ホットキーが変更されました"
+ },
+ "hotkeyUnavailable": {
+ "title": "ホットキーが使用できません",
+ "description": "選択したホットキーを登録できませんでした。設定から別のホットキーを選択してください。"
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "{{hotkey}} を押して話す",
+ "recording": "録音中...",
+ "processing": "処理中...",
+ "clickToSpeak": "クリックして話す"
+ },
+ "buttons": {
+ "cancelRecording": "録音をキャンセル",
+ "cancelProcessing": "処理をキャンセル"
+ },
+ "commandMenu": {
+ "stopListening": "録音を停止",
+ "startListening": "録音を開始",
+ "hideForNow": "一時的に非表示"
+ },
+ "oauth": {
+ "redirectTitle": "アプリにリダイレクト中...",
+ "closeTab": "このタブを閉じてください。"
+ }
}
}
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index a6cb46ea7..4387d5672 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -206,7 +206,13 @@
"description": "Corrija automaticamente gramática, pontuação e formatação enquanto você fala.",
"enable": "Ativar melhoria com IA"
},
- "loading": "Carregando..."
+ "loading": "Carregando...",
+ "gpu": {
+ "bannerTitle": "Aceleração GPU disponível",
+ "bannerDescription": "Ative a aceleração GPU para um desempenho mais rápido.",
+ "enableButton": "Ativar GPU",
+ "dismissButton": "Agora não"
+ }
},
"reasoning": {
"mode": {
@@ -1440,6 +1446,9 @@
"realtimeBanner": {
"message": "Transcrição em tempo real disponível no Pro",
"upgrade": "Fazer upgrade"
+ },
+ "enhance": {
+ "title": "Erro de aprimoramento"
}
},
"dictionary": {
@@ -1506,5 +1515,47 @@
"add": "Adicionar",
"editButton": "Editar",
"addButton": "Adicionar"
+ },
+ "gpu": {
+ "transcriptionBanner": "Acelere a transcrição com GPU",
+ "reasoningBanner": "Acelere o processamento de IA com GPU",
+ "enableButton": "Ativar GPU",
+ "active": "Aceleração GPU ativa",
+ "activating": "Ativando GPU...",
+ "activationFailed": "Não foi possível ativar a GPU",
+ "retry": "Tentar novamente",
+ "remove": "Remover",
+ "dismiss": "Agora não",
+ "cancel": "Cancelar"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Atalho alterado"
+ },
+ "hotkeyUnavailable": {
+ "title": "Atalho indisponível",
+ "description": "Não foi possível registrar o atalho selecionado. Escolha outro nas configurações."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Pressione {{hotkey}} para falar",
+ "recording": "Gravando...",
+ "processing": "Processando...",
+ "clickToSpeak": "Clique para falar"
+ },
+ "buttons": {
+ "cancelRecording": "Cancelar gravação",
+ "cancelProcessing": "Cancelar processamento"
+ },
+ "commandMenu": {
+ "stopListening": "Parar de ouvir",
+ "startListening": "Começar a ouvir",
+ "hideForNow": "Ocultar por agora"
+ },
+ "oauth": {
+ "redirectTitle": "Redirecionando para o app...",
+ "closeTab": "Você pode fechar esta aba."
+ }
}
}
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index c9f57b2b3..3989d31f8 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -234,7 +234,13 @@
"description": "Автоматически исправляйте грамматику, пунктуацию и форматирование прямо во время диктовки.",
"enable": "Включить ИИ-улучшение"
},
- "loading": "Загрузка..."
+ "loading": "Загрузка...",
+ "gpu": {
+ "bannerTitle": "Доступно ускорение GPU",
+ "bannerDescription": "Включите ускорение GPU для повышения производительности.",
+ "enableButton": "Включить GPU",
+ "dismissButton": "Не сейчас"
+ }
},
"reasoning": {
"mode": {
@@ -1440,6 +1446,9 @@
"realtimeBanner": {
"message": "Транскрипция в реальном времени доступна в Pro",
"upgrade": "Перейти"
+ },
+ "enhance": {
+ "title": "Ошибка улучшения"
}
},
"dictionary": {
@@ -1506,5 +1515,47 @@
"add": "Добавить",
"editButton": "Изменить ключ",
"addButton": "Добавить ключ"
+ },
+ "gpu": {
+ "transcriptionBanner": "Ускорьте транскрипцию с помощью GPU",
+ "reasoningBanner": "Ускорьте обработку ИИ с помощью GPU",
+ "enableButton": "Включить GPU",
+ "active": "Ускорение GPU активно",
+ "activating": "Активация GPU...",
+ "activationFailed": "Не удалось активировать GPU",
+ "retry": "Повторить",
+ "remove": "Удалить",
+ "dismiss": "Не сейчас",
+ "cancel": "Отмена"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "Горячая клавиша изменена"
+ },
+ "hotkeyUnavailable": {
+ "title": "Горячая клавиша недоступна",
+ "description": "Не удалось зарегистрировать выбранную комбинацию. Выберите другую в настройках."
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "Нажмите {{hotkey}} для записи",
+ "recording": "Запись...",
+ "processing": "Обработка...",
+ "clickToSpeak": "Нажмите для записи"
+ },
+ "buttons": {
+ "cancelRecording": "Отменить запись",
+ "cancelProcessing": "Отменить обработку"
+ },
+ "commandMenu": {
+ "stopListening": "Остановить запись",
+ "startListening": "Начать запись",
+ "hideForNow": "Скрыть"
+ },
+ "oauth": {
+ "redirectTitle": "Перенаправление в приложение...",
+ "closeTab": "Можете закрыть эту вкладку."
+ }
}
}
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index ce1ee0394..8fd8d17a0 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -234,7 +234,13 @@
"description": "在你说话的同时,自动修正语法、标点和格式。",
"enable": "启用 AI 增强"
},
- "loading": "加载中..."
+ "loading": "加载中...",
+ "gpu": {
+ "bannerTitle": "GPU 加速可用",
+ "bannerDescription": "启用 GPU 加速以获得更快的性能。",
+ "enableButton": "启用 GPU",
+ "dismissButton": "暂不启用"
+ }
},
"reasoning": {
"mode": {
@@ -1436,6 +1442,9 @@
"realtimeBanner": {
"message": "Pro 版可使用实时转录",
"upgrade": "升级"
+ },
+ "enhance": {
+ "title": "增强错误"
}
},
"dictionary": {
@@ -1502,5 +1511,47 @@
"add": "添加",
"editButton": "编辑密钥",
"addButton": "添加密钥"
+ },
+ "gpu": {
+ "transcriptionBanner": "使用 GPU 加速转录",
+ "reasoningBanner": "使用 GPU 加速 AI 处理",
+ "enableButton": "启用 GPU",
+ "active": "GPU 加速已启用",
+ "activating": "正在激活 GPU...",
+ "activationFailed": "无法激活 GPU",
+ "retry": "重试",
+ "remove": "移除",
+ "dismiss": "暂不启用",
+ "cancel": "取消"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "快捷键已更改"
+ },
+ "hotkeyUnavailable": {
+ "title": "快捷键不可用",
+ "description": "无法注册所选快捷键。请在设置中选择其他快捷键。"
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "按 {{hotkey}} 开始说话",
+ "recording": "录音中...",
+ "processing": "处理中...",
+ "clickToSpeak": "点击开始说话"
+ },
+ "buttons": {
+ "cancelRecording": "取消录音",
+ "cancelProcessing": "取消处理"
+ },
+ "commandMenu": {
+ "stopListening": "停止录音",
+ "startListening": "开始录音",
+ "hideForNow": "暂时隐藏"
+ },
+ "oauth": {
+ "redirectTitle": "正在跳转到应用...",
+ "closeTab": "您可以关闭此标签页。"
+ }
}
}
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index f5df0d459..ef2dbd9aa 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -234,7 +234,13 @@
"description": "說話時自動修正文法、標點和格式。",
"enable": "啟用 AI 增強"
},
- "loading": "載入中..."
+ "loading": "載入中...",
+ "gpu": {
+ "bannerTitle": "GPU 加速可用",
+ "bannerDescription": "啟用 GPU 加速以獲得更快的效能。",
+ "enableButton": "啟用 GPU",
+ "dismissButton": "暫時不要"
+ }
},
"reasoning": {
"mode": {
@@ -1436,6 +1442,9 @@
"realtimeBanner": {
"message": "Pro 方案可使用即時轉錄",
"upgrade": "升級"
+ },
+ "enhance": {
+ "title": "增強錯誤"
}
},
"dictionary": {
@@ -1502,5 +1511,47 @@
"add": "新增",
"editButton": "編輯金鑰",
"addButton": "新增金鑰"
+ },
+ "gpu": {
+ "transcriptionBanner": "使用 GPU 加速轉錄",
+ "reasoningBanner": "使用 GPU 加速 AI 處理",
+ "enableButton": "啟用 GPU",
+ "active": "GPU 加速已啟用",
+ "activating": "正在啟動 GPU...",
+ "activationFailed": "無法啟動 GPU",
+ "retry": "重試",
+ "remove": "移除",
+ "dismiss": "暫時不要",
+ "cancel": "取消"
+ },
+ "app": {
+ "toasts": {
+ "hotkeyChanged": {
+ "title": "快捷鍵已變更"
+ },
+ "hotkeyUnavailable": {
+ "title": "快捷鍵無法使用",
+ "description": "無法註冊所選快捷鍵。請在設定中選擇其他快捷鍵。"
+ }
+ },
+ "mic": {
+ "hotkeyToSpeak": "按 {{hotkey}} 開始說話",
+ "recording": "錄音中...",
+ "processing": "處理中...",
+ "clickToSpeak": "點擊開始說話"
+ },
+ "buttons": {
+ "cancelRecording": "取消錄音",
+ "cancelProcessing": "取消處理"
+ },
+ "commandMenu": {
+ "stopListening": "停止錄音",
+ "startListening": "開始錄音",
+ "hideForNow": "暫時隱藏"
+ },
+ "oauth": {
+ "redirectTitle": "正在跳轉到應用程式...",
+ "closeTab": "您可以關閉此分頁。"
+ }
}
}
diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.ts
index 724a4e449..ef6790ac5 100644
--- a/src/models/ModelRegistry.ts
+++ b/src/models/ModelRegistry.ts
@@ -256,10 +256,13 @@ export function getModelProvider(modelId: string): string {
return "openwhispr";
}
+ if (getSettings().reasoningProvider === "custom") {
+ return "custom";
+ }
+
const model = getAllReasoningModels().find((m) => m.value === modelId);
if (!model) {
- if (getSettings().reasoningProvider === "custom") return "custom";
if (modelId.includes("claude")) return "anthropic";
if (modelId.includes("gemini") && !modelId.includes("gemma")) return "gemini";
if ((modelId.includes("gpt-4") || modelId.includes("gpt-5")) && !modelId.includes("gpt-oss"))
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index fae211f3f..583487d2f 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -180,7 +180,7 @@ function invalidateApiKeyCaches(
debouncedPersistToEnv();
}
-export const useSettingsStore = create<SettingsState>()((set) => ({
+export const useSettingsStore = create<SettingsState>()((set, get) => ({
uiLanguage: normalizeUiLanguage(isBrowser ? localStorage.getItem("uiLanguage") : null),
useLocalWhisper: readBoolean("useLocalWhisper", false),
whisperModel: readString("whisperModel", "base"),
@@ -361,6 +361,7 @@ export const useSettingsStore = create<SettingsState>()((set) => ({
setAudioCuesEnabled: createBooleanSetter("audioCuesEnabled"),
setFloatingIconAutoHide: (enabled: boolean) => {
+ if (get().floatingIconAutoHide === enabled) return;
if (isBrowser) localStorage.setItem("floatingIconAutoHide", String(enabled));
set({ floatingIconAutoHide: enabled });
if (isBrowser) {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 60e02d070..57dc9462e 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -700,6 +700,18 @@ declare global {
error?: string;
code?: string;
}>;
+ cloudStreamingUsage?: (
+ text: string,
+ audioDurationSeconds: number,
+ opts?: { sendLogs?: boolean }
+ ) => Promise<{
+ success: boolean;
+ wordsUsed?: number;
+ wordsRemaining?: number;
+ limitReached?: boolean;
+ error?: string;
+ code?: string;
+ }>;
cloudUsage?: () => Promise<{
success: boolean;
wordsUsed?: number;