Skip to content

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

feat: unified provider architecture with four inference modes

Gabriel Stein3987a70c9ffa
diff --git a/preload.js b/preload.js
index 503c43379..0e4821544 100644
--- a/preload.js
+++ b/preload.js
@@ -207,6 +207,10 @@ contextBridge.exposeInMainWorld("electronAPI", {
checkFFmpegAvailability: () => ipcRenderer.invoke("check-ffmpeg-availability"),
getAudioDiagnostics: () => ipcRenderer.invoke("get-audio-diagnostics"),
+ // LAN Whisper transcription (remote whisper-server on local network)
+ transcribeLanWhisper: (audioBlob, options) =>
+ ipcRenderer.invoke("transcribe-lan-whisper", audioBlob, options),
+
// Whisper server functions (faster repeated transcriptions)
whisperServerStart: (modelName) => ipcRenderer.invoke("whisper-server-start", modelName),
whisperServerStop: () => ipcRenderer.invoke("whisper-server-stop"),
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 3d5625c06..68dd8f8a9 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -399,6 +399,9 @@ export default function ControlPanel() {
cloudTranscriptionBaseUrl: s.cloudTranscriptionBaseUrl,
parakeetModel: s.parakeetModel,
whisperModel: s.whisperModel,
+ transcriptionMode: s.transcriptionMode,
+ remoteTranscriptionType: s.remoteTranscriptionType,
+ remoteTranscriptionUrl: s.remoteTranscriptionUrl,
});
if (result.success && result.transcription) {
const rawText = result.transcription.text;
diff --git a/src/components/ReasoningModelSelector.tsx b/src/components/ReasoningModelSelector.tsx
index 57bac5dc8..70560be8a 100644
--- a/src/components/ReasoningModelSelector.tsx
+++ b/src/components/ReasoningModelSelector.tsx
@@ -49,6 +49,7 @@ interface ReasoningModelSelectorProps {
setGroqApiKey: (key: string) => void;
customReasoningApiKey?: string;
setCustomReasoningApiKey?: (key: string) => void;
+ mode?: "cloud" | "local";
}
function GpuStatusBadge() {
@@ -319,9 +320,10 @@ export default function ReasoningModelSelector({
setGroqApiKey,
customReasoningApiKey = "",
setCustomReasoningApiKey,
+ mode,
}: ReasoningModelSelectorProps) {
const { t } = useTranslation();
- const [selectedMode, setSelectedMode] = useState<"cloud" | "local">("cloud");
+ const [selectedMode, setSelectedMode] = useState<"cloud" | "local">(mode || "cloud");
const [selectedCloudProvider, setSelectedCloudProvider] = useState("openai");
const [selectedLocalProvider, setSelectedLocalProvider] = useState("qwen");
const [customModelOptions, setCustomModelOptions] = useState<CloudModelOption[]>([]);
@@ -492,7 +494,12 @@ export default function ReasoningModelSelector({
return customModelOptions;
}, [isCustomBaseDirty, customModelOptions]);
- const cloudProviderIds = ["openai", "anthropic", "gemini", "groq", "custom"];
+ const effectiveMode = mode || selectedMode;
+
+ const cloudProviderIds =
+ mode === "cloud"
+ ? ["openai", "anthropic", "gemini", "groq"]
+ : ["openai", "anthropic", "gemini", "groq", "custom"];
const cloudProviders = cloudProviderIds.map((id) => ({
id,
name:
@@ -729,22 +736,24 @@ export default function ReasoningModelSelector({
return (
<div className="space-y-4">
- <div className="space-y-2">
- <ProviderTabs
- providers={MODE_TABS}
- selectedId={selectedMode}
- onSelect={(id) => handleModeChange(id as "cloud" | "local")}
- renderIcon={renderModeIcon}
- colorScheme="purple"
- />
- <p className="text-xs text-muted-foreground text-center">
- {selectedMode === "local"
- ? t("reasoning.mode.localDescription")
- : t("reasoning.mode.cloudDescription")}
- </p>
- </div>
+ {!mode && (
+ <div className="space-y-2">
+ <ProviderTabs
+ providers={MODE_TABS}
+ selectedId={effectiveMode}
+ onSelect={(id) => handleModeChange(id as "cloud" | "local")}
+ renderIcon={renderModeIcon}
+ colorScheme="purple"
+ />
+ <p className="text-xs text-muted-foreground text-center">
+ {effectiveMode === "local"
+ ? t("reasoning.mode.localDescription")
+ : t("reasoning.mode.cloudDescription")}
+ </p>
+ </div>
+ )}
- {selectedMode === "cloud" ? (
+ {effectiveMode === "cloud" ? (
<div className="space-y-2">
<div className="border border-border rounded-lg overflow-hidden">
<ProviderTabs
diff --git a/src/components/SelfHostedPanel.tsx b/src/components/SelfHostedPanel.tsx
new file mode 100644
index 000000000..d497ddc23
--- /dev/null
+++ b/src/components/SelfHostedPanel.tsx
@@ -0,0 +1,107 @@
+import { useTranslation } from "react-i18next";
+import { Input } from "./ui/input";
+import ApiKeyInput from "./ui/ApiKeyInput";
+import { ProviderTabs } from "./ui/ProviderTabs";
+import { Network, Globe } from "lucide-react";
+import type { SelfHostedType } from "../types/electron";
+
+interface SelfHostedPanelProps {
+ service: "transcription" | "reasoning";
+ selectedType: SelfHostedType;
+ onTypeSelect: (type: SelfHostedType) => void;
+ lanUrl: string;
+ onLanUrlChange: (url: string) => void;
+ compatibleUrl: string;
+ onCompatibleUrlChange: (url: string) => void;
+ compatibleApiKey: string;
+ onCompatibleApiKeyChange: (key: string) => void;
+ compatibleModel: string;
+ onCompatibleModelChange: (model: string) => void;
+}
+
+const TYPE_TABS = [
+ { id: "openai-compatible", name: "OpenAI Compatible" },
+ { id: "lan", name: "LAN" },
+];
+
+export default function SelfHostedPanel({
+ service,
+ selectedType,
+ onTypeSelect,
+ lanUrl,
+ onLanUrlChange,
+ compatibleUrl,
+ onCompatibleUrlChange,
+ compatibleApiKey,
+ onCompatibleApiKeyChange,
+ compatibleModel,
+ onCompatibleModelChange,
+}: SelfHostedPanelProps) {
+ const { t } = useTranslation();
+
+ const renderTypeIcon = (id: string) => {
+ if (id === "lan") return <Network className="w-3.5 h-3.5" />;
+ return <Globe className="w-3.5 h-3.5" />;
+ };
+
+ const placeholderUrl =
+ service === "transcription" ? "http://192.168.1.126:8178" : "http://192.168.1.126:8080";
+
+ return (
+ <div className="space-y-2">
+ <ProviderTabs
+ providers={TYPE_TABS}
+ selectedId={selectedType}
+ onSelect={(id) => onTypeSelect(id as SelfHostedType)}
+ renderIcon={renderTypeIcon}
+ colorScheme="purple"
+ />
+
+ {selectedType === "openai-compatible" ? (
+ <div className="border border-border rounded-lg p-3 space-y-2.5">
+ <div className="space-y-1.5">
+ <label className="block text-xs font-medium text-foreground">
+ {t("settingsPage.selfHosted.endpointUrl")}
+ </label>
+ <Input
+ value={compatibleUrl}
+ onChange={(e) => onCompatibleUrlChange(e.target.value)}
+ placeholder="https://your-server.example.com/v1"
+ className="h-8 text-sm"
+ />
+ </div>
+ <ApiKeyInput
+ apiKey={compatibleApiKey}
+ setApiKey={onCompatibleApiKeyChange}
+ label={t("settingsPage.selfHosted.apiKeyOptional")}
+ helpText=""
+ />
+ <div className="space-y-1.5">
+ <label className="block text-xs font-medium text-foreground">{t("common.model")}</label>
+ <Input
+ value={compatibleModel}
+ onChange={(e) => onCompatibleModelChange(e.target.value)}
+ placeholder={service === "transcription" ? "whisper-1" : "llama-3"}
+ className="h-8 text-sm"
+ />
+ </div>
+ </div>
+ ) : (
+ <div className="border border-border rounded-lg p-3 space-y-2.5">
+ <div className="space-y-1.5">
+ <label className="block text-xs font-medium text-foreground">
+ {t("settingsPage.selfHosted.serverUrl")}
+ </label>
+ <Input
+ value={lanUrl}
+ onChange={(e) => onLanUrlChange(e.target.value)}
+ placeholder={placeholderUrl}
+ className="h-8 text-sm"
+ />
+ </div>
+ <p className="text-xs text-muted-foreground/70">{t("settingsPage.selfHosted.lanHint")}</p>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index e456bac8f..4eee85d4f 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -16,6 +16,8 @@ import {
Monitor,
Cloud,
Key,
+ Cpu,
+ Network,
Sparkles,
AlertTriangle,
Loader2,
@@ -35,6 +37,8 @@ import MicrophoneSettings from "./ui/MicrophoneSettings";
import PermissionCard from "./ui/PermissionCard";
import PasteToolsInfo from "./ui/PasteToolsInfo";
import TranscriptionModelPicker from "./TranscriptionModelPicker";
+import { ModeSelector } from "./ui/ModeSelector";
+import SelfHostedPanel from "./SelfHostedPanel";
import {
ConfirmDialog,
AlertDialog,
@@ -71,7 +75,12 @@ import { Skeleton } from "./ui/skeleton";
import { Progress } from "./ui/progress";
import { useToast } from "./ui/Toast";
import { useTheme } from "../hooks/useTheme";
-import type { GpuDevice, LocalTranscriptionProvider } from "../types/electron";
+import type {
+ GpuDevice,
+ LocalTranscriptionProvider,
+ InferenceMode,
+ SelfHostedType,
+} from "../types/electron";
import logger from "../utils/logger";
import { SettingsRow } from "./ui/SettingsSection";
import { useSettingsLayout } from "./ui/SidebarModal";
@@ -183,6 +192,12 @@ interface TranscriptionSectionProps {
setCustomTranscriptionApiKey: (key: string) => void;
cloudTranscriptionBaseUrl?: string;
setCloudTranscriptionBaseUrl: (url: string) => void;
+ transcriptionMode: InferenceMode;
+ setTranscriptionMode: (mode: InferenceMode) => void;
+ remoteTranscriptionType: SelfHostedType;
+ setRemoteTranscriptionType: (type: SelfHostedType) => void;
+ remoteTranscriptionUrl: string;
+ setRemoteTranscriptionUrl: (url: string) => void;
toast: (opts: {
title: string;
description: string;
@@ -218,11 +233,105 @@ function TranscriptionSection({
setCustomTranscriptionApiKey,
cloudTranscriptionBaseUrl,
setCloudTranscriptionBaseUrl,
+ transcriptionMode,
+ setTranscriptionMode,
+ remoteTranscriptionType,
+ setRemoteTranscriptionType,
+ remoteTranscriptionUrl,
+ setRemoteTranscriptionUrl,
toast,
}: TranscriptionSectionProps) {
const { t } = useTranslation();
- const isCustomMode = cloudTranscriptionMode === "byok" || useLocalWhisper;
- const isCloudMode = isSignedIn && cloudTranscriptionMode === "openwhispr" && !useLocalWhisper;
+
+ const transcriptionModes = [
+ {
+ id: "openwhispr" as InferenceMode,
+ label: t("settingsPage.transcription.modes.openwhispr"),
+ icon: <Cloud className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "providers" as InferenceMode,
+ label: t("settingsPage.transcription.modes.providers"),
+ icon: <Key className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "local" as InferenceMode,
+ label: t("settingsPage.transcription.modes.local"),
+ icon: <Cpu className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "self-hosted" as InferenceMode,
+ label: t("settingsPage.transcription.modes.selfHosted"),
+ icon: <Network className="w-3.5 h-3.5" />,
+ },
+ ];
+
+ const handleTranscriptionModeSelect = (mode: InferenceMode) => {
+ if (mode === transcriptionMode) return;
+ setTranscriptionMode(mode);
+ setUseLocalWhisper(mode === "local");
+ updateTranscriptionSettings({ useLocalWhisper: mode === "local" });
+ setCloudTranscriptionMode(mode === "openwhispr" ? "openwhispr" : "byok");
+
+ const toastKey = {
+ openwhispr: "switchedCloud",
+ providers: "switchedProviders",
+ local: "switchedLocal",
+ "self-hosted": "switchedSelfHosted",
+ }[mode];
+ toast({
+ title: t(`settingsPage.transcription.toasts.${toastKey}.title`),
+ description: t(`settingsPage.transcription.toasts.${toastKey}.description`),
+ variant: "success",
+ duration: 3000,
+ });
+ };
+
+ const handleLocalModelSelect = useCallback(
+ (modelId: string) => {
+ if (localTranscriptionProvider === "nvidia") {
+ setParakeetModel(modelId);
+ } else {
+ setWhisperModel(modelId);
+ }
+ },
+ [localTranscriptionProvider, setParakeetModel, setWhisperModel]
+ );
+
+ const renderTranscriptionPicker = (mode?: "cloud" | "local") => (
+ <TranscriptionModelPicker
+ selectedCloudProvider={cloudTranscriptionProvider}
+ onCloudProviderSelect={setCloudTranscriptionProvider}
+ selectedCloudModel={cloudTranscriptionModel}
+ onCloudModelSelect={setCloudTranscriptionModel}
+ selectedLocalModel={localTranscriptionProvider === "nvidia" ? parakeetModel : whisperModel}
+ onLocalModelSelect={handleLocalModelSelect}
+ selectedLocalProvider={localTranscriptionProvider}
+ onLocalProviderSelect={setLocalTranscriptionProvider}
+ useLocalWhisper={mode === "local" || (!mode && useLocalWhisper)}
+ onModeChange={
+ mode
+ ? () => {}
+ : (isLocal) => {
+ setUseLocalWhisper(isLocal);
+ updateTranscriptionSettings({ useLocalWhisper: isLocal });
+ if (isLocal) setCloudTranscriptionMode("byok");
+ }
+ }
+ mode={mode}
+ openaiApiKey={openaiApiKey}
+ setOpenaiApiKey={setOpenaiApiKey}
+ groqApiKey={groqApiKey}
+ setGroqApiKey={setGroqApiKey}
+ mistralApiKey={mistralApiKey}
+ setMistralApiKey={setMistralApiKey}
+ customTranscriptionApiKey={customTranscriptionApiKey}
+ setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}
+ cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}
+ setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}
+ variant="settings"
+ />
+ );
return (
<div className="space-y-4">
@@ -231,172 +340,37 @@ function TranscriptionSection({
description={t("settingsPage.transcription.description")}
/>
- {/* Mode selector */}
- {isSignedIn && (
- <SettingsPanel>
- <SettingsPanelRow>
- <button
- onClick={() => {
- if (!isCloudMode) {
- setCloudTranscriptionMode("openwhispr");
- setUseLocalWhisper(false);
- updateTranscriptionSettings({ useLocalWhisper: false });
- toast({
- title: t("settingsPage.transcription.toasts.switchedCloud.title"),
- description: t("settingsPage.transcription.toasts.switchedCloud.description"),
- variant: "success",
- duration: 3000,
- });
- }
- }}
- className="w-full flex items-center gap-3 text-left cursor-pointer group"
- >
- <div
- className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${
- isCloudMode
- ? "bg-primary/10 dark:bg-primary/15"
- : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"
- }`}
- >
- <Cloud
- className={`w-4 h-4 transition-colors ${
- isCloudMode ? "text-primary" : "text-muted-foreground"
- }`}
- />
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-foreground">
- {t("settingsPage.transcription.openwhisprCloud")}
- </span>
- {isCloudMode && (
- <span className="text-xs font-medium text-primary bg-primary/10 dark:bg-primary/15 px-1.5 py-px rounded-sm">
- {t("common.active")}
- </span>
- )}
- </div>
- <p className="text-xs text-muted-foreground/80 mt-0.5">
- {t("settingsPage.transcription.openwhisprCloudDescription")}
- </p>
- </div>
- <div
- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${
- isCloudMode
- ? "border-primary bg-primary"
- : "border-border-hover dark:border-border-subtle"
- }`}
- >
- {isCloudMode && (
- <div className="w-full h-full flex items-center justify-center">
- <div className="w-1.5 h-1.5 rounded-full bg-primary-foreground" />
- </div>
- )}
- </div>
- </button>
- </SettingsPanelRow>
- <SettingsPanelRow>
- <button
- onClick={() => {
- if (!isCustomMode) {
- setCloudTranscriptionMode("byok");
- setUseLocalWhisper(false);
- updateTranscriptionSettings({ useLocalWhisper: false });
- toast({
- title: t("settingsPage.transcription.toasts.switchedCustom.title"),
- description: t("settingsPage.transcription.toasts.switchedCustom.description"),
- variant: "success",
- duration: 3000,
- });
- }
- }}
- className="w-full flex items-center gap-3 text-left cursor-pointer group"
- >
- <div
- className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${
- isCustomMode
- ? "bg-accent/10 dark:bg-accent/15"
- : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"
- }`}
- >
- <Key
- className={`w-4 h-4 transition-colors ${
- isCustomMode ? "text-accent" : "text-muted-foreground"
- }`}
- />
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-foreground">
- {t("settingsPage.transcription.customSetup")}
- </span>
- {isCustomMode && (
- <span className="text-xs font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">
- {t("common.active")}
- </span>
- )}
- </div>
- <p className="text-xs text-muted-foreground/80 mt-0.5">
- {t("settingsPage.transcription.customSetupDescription")}
- </p>
- </div>
- <div
- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${
- isCustomMode
- ? "border-accent bg-accent"
- : "border-border-hover dark:border-border-subtle"
- }`}
- >
- {isCustomMode && (
- <div className="w-full h-full flex items-center justify-center">
- <div className="w-1.5 h-1.5 rounded-full bg-accent-foreground" />
- </div>
- )}
- </div>
- </button>
- </SettingsPanelRow>
- </SettingsPanel>
- )}
+ {isSignedIn ? (
+ <>
+ <ModeSelector
+ modes={transcriptionModes}
+ selectedMode={transcriptionMode}
+ onSelect={handleTranscriptionModeSelect}
+ />
- {/* Custom Setup model picker — shown when Custom Setup is active or not signed in */}
- {(isCustomMode || !isSignedIn) && (
- <TranscriptionModelPicker
- selectedCloudProvider={cloudTranscriptionProvider}
- onCloudProviderSelect={setCloudTranscriptionProvider}
- selectedCloudModel={cloudTranscriptionModel}
- onCloudModelSelect={setCloudTranscriptionModel}
- selectedLocalModel={
- localTranscriptionProvider === "nvidia" ? parakeetModel : whisperModel
- }
- onLocalModelSelect={(modelId) => {
- if (localTranscriptionProvider === "nvidia") {
- setParakeetModel(modelId);
- } else {
- setWhisperModel(modelId);
- }
- }}
- selectedLocalProvider={localTranscriptionProvider}
- onLocalProviderSelect={setLocalTranscriptionProvider}
- useLocalWhisper={useLocalWhisper}
- onModeChange={(isLocal) => {
- setUseLocalWhisper(isLocal);
- updateTranscriptionSettings({ useLocalWhisper: isLocal });
- if (isLocal) {
- setCloudTranscriptionMode("byok");
- }
- }}
- openaiApiKey={openaiApiKey}
- setOpenaiApiKey={setOpenaiApiKey}
- groqApiKey={groqApiKey}
- setGroqApiKey={setGroqApiKey}
- mistralApiKey={mistralApiKey}
- setMistralApiKey={setMistralApiKey}
- customTranscriptionApiKey={customTranscriptionApiKey}
- setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}
- cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}
- setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}
- variant="settings"
- />
+ {transcriptionMode === "providers" && renderTranscriptionPicker("cloud")}
+ {transcriptionMode === "local" && renderTranscriptionPicker("local")}
+
+ {transcriptionMode === "self-hosted" && (
+ <SelfHostedPanel
+ service="transcription"
+ selectedType={remoteTranscriptionType}
+ onTypeSelect={setRemoteTranscriptionType}
+ lanUrl={remoteTranscriptionUrl}
+ onLanUrlChange={setRemoteTranscriptionUrl}
+ compatibleUrl={cloudTranscriptionBaseUrl || ""}
+ onCompatibleUrlChange={setCloudTranscriptionBaseUrl}
+ compatibleApiKey={customTranscriptionApiKey}
+ onCompatibleApiKeyChange={setCustomTranscriptionApiKey}
+ compatibleModel={cloudTranscriptionModel}
+ onCompatibleModelChange={setCloudTranscriptionModel}
+ />
+ )}
+ </>
+ ) : (
+ renderTranscriptionPicker()
)}
+
<GpuDeviceSelector purpose="transcription" />
</div>
);
@@ -424,6 +398,12 @@ interface AiModelsSectionProps {
setGroqApiKey: (key: string) => void;
customReasoningApiKey: string;
setCustomReasoningApiKey: (key: string) => void;
+ reasoningMode: InferenceMode;
+ setReasoningMode: (mode: InferenceMode) => void;
+ remoteReasoningType: SelfHostedType;
+ setRemoteReasoningType: (type: SelfHostedType) => void;
+ remoteReasoningUrl: string;
+ setRemoteReasoningUrl: (url: string) => void;
toast: (opts: {
title: string;
description: string;
@@ -454,11 +434,82 @@ function AiModelsSection({
setGroqApiKey,
customReasoningApiKey,
setCustomReasoningApiKey,
+ reasoningMode,
+ setReasoningMode,
+ remoteReasoningType,
+ setRemoteReasoningType,
+ remoteReasoningUrl,
+ setRemoteReasoningUrl,
toast,
}: AiModelsSectionProps) {
const { t } = useTranslation();
- const isCustomMode = cloudReasoningMode === "byok";
- const isCloudMode = isSignedIn && cloudReasoningMode === "openwhispr";
+
+ const aiModes = [
+ {
+ id: "openwhispr" as InferenceMode,
+ label: t("settingsPage.aiModels.modes.openwhispr"),
+ icon: <Cloud className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "providers" as InferenceMode,
+ label: t("settingsPage.aiModels.modes.providers"),
+ icon: <Key className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "local" as InferenceMode,
+ label: t("settingsPage.aiModels.modes.local"),
+ icon: <Cpu className="w-3.5 h-3.5" />,
+ },
+ {
+ id: "self-hosted" as InferenceMode,
+ label: t("settingsPage.aiModels.modes.selfHosted"),
+ icon: <Network className="w-3.5 h-3.5" />,
+ },
+ ];
+
+ const handleReasoningModeSelect = (mode: InferenceMode) => {
+ if (mode === reasoningMode) return;
+ setReasoningMode(mode);
+ setCloudReasoningMode(mode === "openwhispr" ? "openwhispr" : "byok");
+ if (mode === "openwhispr" || mode === "self-hosted") {
+ window.electronAPI?.llamaServerStop?.();
+ }
+
+ const toastKey = {
+ openwhispr: "switchedCloud",
+ providers: "switchedProviders",
+ local: "switchedLocal",
+ "self-hosted": "switchedSelfHosted",
+ }[mode];
+ toast({
+ title: t(`settingsPage.aiModels.toasts.${toastKey}.title`),
+ description: t(`settingsPage.aiModels.toasts.${toastKey}.description`),
+ variant: "success",
+ duration: 3000,
+ });
+ };
+
+ const renderReasoningSelector = (mode?: "cloud" | "local") => (
+ <ReasoningModelSelector
+ reasoningModel={reasoningModel}
+ setReasoningModel={setReasoningModel}
+ localReasoningProvider={reasoningProvider}
+ setLocalReasoningProvider={setReasoningProvider}
+ cloudReasoningBaseUrl={cloudReasoningBaseUrl}
+ setCloudReasoningBaseUrl={setCloudReasoningBaseUrl}
+ openaiApiKey={openaiApiKey}
+ setOpenaiApiKey={setOpenaiApiKey}
+ anthropicApiKey={anthropicApiKey}
+ setAnthropicApiKey={setAnthropicApiKey}
+ geminiApiKey={geminiApiKey}
+ setGeminiApiKey={setGeminiApiKey}
+ groqApiKey={groqApiKey}
+ setGroqApiKey={setGroqApiKey}
+ customReasoningApiKey={customReasoningApiKey}
+ setCustomReasoningApiKey={setCustomReasoningApiKey}
+ mode={mode}
+ />
+ );
return (
<div className="space-y-4">
@@ -467,7 +518,6 @@ function AiModelsSection({
description={t("settingsPage.aiModels.description")}
/>
- {/* Enable toggle — always at top */}
<SettingsPanel>
<SettingsPanelRow>
<SettingsRow
@@ -481,149 +531,35 @@ function AiModelsSection({
{useReasoningModel && (
<>
- {/* Mode selector */}
- {isSignedIn && (
- <SettingsPanel>
- <SettingsPanelRow>
- <button
- onClick={() => {
- if (!isCloudMode) {
- setCloudReasoningMode("openwhispr");
- window.electronAPI?.llamaServerStop?.();
- toast({
- title: t("settingsPage.aiModels.toasts.switchedCloud.title"),
- description: t("settingsPage.aiModels.toasts.switchedCloud.description"),
- variant: "success",
- duration: 3000,
- });
- }
- }}
- className="w-full flex items-center gap-3 text-left cursor-pointer group"
- >
- <div
- className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${
- isCloudMode
- ? "bg-primary/10 dark:bg-primary/15"
- : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"
- }`}
- >
- <Cloud
- className={`w-4 h-4 transition-colors ${
- isCloudMode ? "text-primary" : "text-muted-foreground"
- }`}
- />
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-foreground">
- {t("settingsPage.aiModels.openwhisprCloud")}
- </span>
- {isCloudMode && (
- <span className="text-xs font-medium text-primary bg-primary/10 dark:bg-primary/15 px-1.5 py-px rounded-sm">
- {t("common.active")}
- </span>
- )}
- </div>
- <p className="text-xs text-muted-foreground/80 mt-0.5">
- {t("settingsPage.aiModels.openwhisprCloudDescription")}
- </p>
- </div>
- <div
- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${
- isCloudMode
- ? "border-primary bg-primary"
- : "border-border-hover dark:border-border-subtle"
- }`}
- >
- {isCloudMode && (
- <div className="w-full h-full flex items-center justify-center">
- <div className="w-1.5 h-1.5 rounded-full bg-primary-foreground" />
- </div>
- )}
- </div>
- </button>
- </SettingsPanelRow>
- <SettingsPanelRow>
- <button
- onClick={() => {
- if (!isCustomMode) {
- setCloudReasoningMode("byok");
- toast({
- title: t("settingsPage.aiModels.toasts.switchedCustom.title"),
- description: t("settingsPage.aiModels.toasts.switchedCustom.description"),
- variant: "success",
- duration: 3000,
- });
- }
- }}
- className="w-full flex items-center gap-3 text-left cursor-pointer group"
- >
- <div
- className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${
- isCustomMode
- ? "bg-accent/10 dark:bg-accent/15"
- : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"
- }`}
- >
- <Key
- className={`w-4 h-4 transition-colors ${
- isCustomMode ? "text-accent" : "text-muted-foreground"
- }`}
- />
- </div>
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-foreground">
- {t("settingsPage.aiModels.customSetup")}
- </span>
- {isCustomMode && (
- <span className="text-xs font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">
- {t("common.active")}
- </span>
- )}
- </div>
- <p className="text-xs text-muted-foreground/80 mt-0.5">
- {t("settingsPage.aiModels.customSetupDescription")}
- </p>
- </div>
- <div
- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${
- isCustomMode
- ? "border-accent bg-accent"
- : "border-border-hover dark:border-border-subtle"
- }`}
- >
- {isCustomMode && (
- <div className="w-full h-full flex items-center justify-center">
- <div className="w-1.5 h-1.5 rounded-full bg-accent-foreground" />
- </div>
- )}
- </div>
- </button>
- </SettingsPanelRow>
- </SettingsPanel>
- )}
+ {isSignedIn ? (
+ <>
+ <ModeSelector
+ modes={aiModes}
+ selectedMode={reasoningMode}
+ onSelect={handleReasoningModeSelect}
+ />
- {/* Custom Setup model picker — shown when Custom Setup is active or not signed in */}
- {(isCustomMode || !isSignedIn) && (
- <ReasoningModelSelector
- reasoningModel={reasoningModel}
- setReasoningModel={setReasoningModel}
- localReasoningProvider={reasoningProvider}
- setLocalReasoningProvider={setReasoningProvider}
- cloudReasoningBaseUrl={cloudReasoningBaseUrl}
- setCloudReasoningBaseUrl={setCloudReasoningBaseUrl}
- openaiApiKey={openaiApiKey}
- setOpenaiApiKey={setOpenaiApiKey}
- anthropicApiKey={anthropicApiKey}
- setAnthropicApiKey={setAnthropicApiKey}
- geminiApiKey={geminiApiKey}
- setGeminiApiKey={setGeminiApiKey}
- groqApiKey={groqApiKey}
- setGroqApiKey={setGroqApiKey}
- customReasoningApiKey={customReasoningApiKey}
- setCustomReasoningApiKey={setCustomReasoningApiKey}
- />
+ {reasoningMode === "providers" && renderReasoningSelector("cloud")}
+ {reasoningMode === "local" && renderReasoningSelector("local")}
+
+ {reasoningMode === "self-hosted" && (
+ <SelfHostedPanel
+ service="reasoning"
+ selectedType={remoteReasoningType}
+ onTypeSelect={setRemoteReasoningType}
+ lanUrl={remoteReasoningUrl}
+ onLanUrlChange={setRemoteReasoningUrl}
+ compatibleUrl={cloudReasoningBaseUrl}
+ onCompatibleUrlChange={setCloudReasoningBaseUrl}
+ compatibleApiKey={customReasoningApiKey}
+ onCompatibleApiKeyChange={setCustomReasoningApiKey}
+ compatibleModel={reasoningModel}
+ onCompatibleModelChange={setReasoningModel}
+ />
+ )}
+ </>
+ ) : (
+ renderReasoningSelector()
)}
<GpuDeviceSelector purpose="intelligence" />
</>
@@ -765,6 +701,18 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
setCloudTranscriptionMode,
cloudReasoningMode,
setCloudReasoningMode,
+ transcriptionMode,
+ setTranscriptionMode,
+ remoteTranscriptionType,
+ setRemoteTranscriptionType,
+ remoteTranscriptionUrl,
+ setRemoteTranscriptionUrl,
+ reasoningMode,
+ setReasoningMode,
+ remoteReasoningType,
+ setRemoteReasoningType,
+ remoteReasoningUrl,
+ setRemoteReasoningUrl,
audioCuesEnabled,
setAudioCuesEnabled,
pauseMediaOnDictation,
@@ -2963,17 +2911,19 @@ EOF`,
disabled={isHotkeyRegistering}
validate={validateDictationHotkey}
/>
- {effectiveDefaultHotkey && dictationKey && dictationKey !== effectiveDefaultHotkey && (
- <button
- onClick={() => registerHotkey(effectiveDefaultHotkey)}
- disabled={isHotkeyRegistering}
- className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors disabled:opacity-50"
- >
- {t("settingsPage.general.hotkey.resetToDefault", {
- hotkey: formatHotkeyLabel(effectiveDefaultHotkey),
- })}
- </button>
- )}
+ {effectiveDefaultHotkey &&
+ dictationKey &&
+ dictationKey !== effectiveDefaultHotkey && (
+ <button
+ onClick={() => registerHotkey(effectiveDefaultHotkey)}
+ disabled={isHotkeyRegistering}
+ className="mt-2 text-xs text-muted-foreground/70 hover:text-foreground transition-colors disabled:opacity-50"
+ >
+ {t("settingsPage.general.hotkey.resetToDefault", {
+ hotkey: formatHotkeyLabel(effectiveDefaultHotkey),
+ })}
+ </button>
+ )}
</SettingsPanelRow>
{!isUsingNativeShortcut && (
@@ -3050,6 +3000,12 @@ EOF`,
setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}
cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}
setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}
+ transcriptionMode={transcriptionMode}
+ setTranscriptionMode={setTranscriptionMode}
+ remoteTranscriptionType={remoteTranscriptionType}
+ setRemoteTranscriptionType={setRemoteTranscriptionType}
+ remoteTranscriptionUrl={remoteTranscriptionUrl}
+ setRemoteTranscriptionUrl={setRemoteTranscriptionUrl}
toast={toast}
/>
);
@@ -3081,6 +3037,12 @@ EOF`,
setGroqApiKey={setGroqApiKey}
customReasoningApiKey={customReasoningApiKey}
setCustomReasoningApiKey={setCustomReasoningApiKey}
+ reasoningMode={reasoningMode}
+ setReasoningMode={setReasoningMode}
+ remoteReasoningType={remoteReasoningType}
+ setRemoteReasoningType={setRemoteReasoningType}
+ remoteReasoningUrl={remoteReasoningUrl}
+ setRemoteReasoningUrl={setRemoteReasoningUrl}
toast={toast}
/>
);
@@ -3222,6 +3184,12 @@ EOF`,
setGroqApiKey={setGroqApiKey}
customReasoningApiKey={customReasoningApiKey}
setCustomReasoningApiKey={setCustomReasoningApiKey}
+ reasoningMode={reasoningMode}
+ setReasoningMode={setReasoningMode}
+ remoteReasoningType={remoteReasoningType}
+ setRemoteReasoningType={setRemoteReasoningType}
+ remoteReasoningUrl={remoteReasoningUrl}
+ setRemoteReasoningUrl={setRemoteReasoningUrl}
toast={toast}
/>
diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsx
index c7c103eb5..4634dc125 100644
--- a/src/components/TranscriptionModelPicker.tsx
+++ b/src/components/TranscriptionModelPicker.tsx
@@ -203,6 +203,7 @@ interface TranscriptionModelPickerProps {
setCloudTranscriptionBaseUrl?: (url: string) => void;
className?: string;
variant?: "onboarding" | "settings";
+ mode?: "cloud" | "local";
}
const CLOUD_PROVIDER_TABS = [
@@ -278,8 +279,10 @@ export default function TranscriptionModelPicker({
setCloudTranscriptionBaseUrl,
className = "",
variant = "settings",
+ mode,
}: TranscriptionModelPickerProps) {
const { t } = useTranslation();
+ const effectiveLocal = mode === "local" ? true : mode === "cloud" ? false : useLocalWhisper;
const [localModels, setLocalModels] = useState<LocalModel[]>([]);
const [parakeetModels, setParakeetModels] = useState<LocalModel[]>([]);
const [internalLocalProvider, setInternalLocalProvider] = useState(selectedLocalProvider);
@@ -311,7 +314,9 @@ export default function TranscriptionModelPicker({
const colorScheme: ColorScheme = variant === "settings" ? "purple" : "blue";
const styles = useMemo(() => MODEL_PICKER_COLORS[colorScheme], [colorScheme]);
const cloudProviders = useMemo(() => getTranscriptionProviders(), []);
- const cloudProviderTabs = CLOUD_PROVIDER_TABS.map((provider) =>
+ const cloudProviderTabs = CLOUD_PROVIDER_TABS.filter(
+ (p) => !(mode === "cloud" && p.id === "custom")
+ ).map((provider) =>
provider.id === "custom" ? { ...provider, name: t("transcription.customProvider") } : provider
);
@@ -419,7 +424,7 @@ export default function TranscriptionModelPicker({
}, [ensureValidCloudSelection]);
useEffect(() => {
- if (!useLocalWhisper) return;
+ if (!effectiveLocal) return;
if (internalLocalProvider === "whisper" && !hasLoadedRef.current) {
hasLoadedRef.current = true;
@@ -428,15 +433,15 @@ export default function TranscriptionModelPicker({
hasLoadedParakeetRef.current = true;
loadParakeetModelsRef.current?.();
}
- }, [useLocalWhisper, internalLocalProvider]);
+ }, [effectiveLocal, internalLocalProvider]);
useEffect(() => {
- if (useLocalWhisper) return;
+ if (effectiveLocal) return;
hasLoadedRef.current = false;
hasLoadedParakeetRef.current = false;
ensureValidCloudSelectionRef.current?.();
- }, [useLocalWhisper]);
+ }, [effectiveLocal]);
useEffect(() => {
const handleModelsCleared = () => {
@@ -448,13 +453,13 @@ export default function TranscriptionModelPicker({
}, [loadLocalModels, loadParakeetModels]);
useEffect(() => {
- if (!useLocalWhisper || internalLocalProvider !== "whisper") return;
+ if (!effectiveLocal || internalLocalProvider !== "whisper") return;
if (getCachedPlatform() === "darwin") return;
window.electronAPI
?.getCudaWhisperStatus?.()
?.then(setCudaStatus)
.catch(() => {});
- }, [useLocalWhisper, internalLocalProvider]);
+ }, [effectiveLocal, internalLocalProvider]);
useEffect(() => {
if (!cudaDownloading) return;
@@ -641,7 +646,7 @@ export default function TranscriptionModelPicker({
}, [currentCloudProvider, selectedCloudProvider, t]);
const progressDisplay = useMemo(() => {
- if (!useLocalWhisper) return null;
+ if (!effectiveLocal) return null;
if (downloadingModel && internalLocalProvider === "whisper") {
const modelInfo = WHISPER_MODEL_INFO[downloadingModel];
@@ -673,7 +678,7 @@ export default function TranscriptionModelPicker({
downloadingParakeetModel,
parakeetDownloadProgress,
isInstallingParakeet,
- useLocalWhisper,
+ effectiveLocal,
internalLocalProvider,
]);
@@ -814,9 +819,9 @@ export default function TranscriptionModelPicker({
return (
<div className={`space-y-2 ${className}`}>
- <ModeToggle useLocalWhisper={useLocalWhisper} onModeChange={handleModeChange} />
+ {!mode && <ModeToggle useLocalWhisper={effectiveLocal} onModeChange={handleModeChange} />}
- {!useLocalWhisper ? (
+ {!effectiveLocal ? (
<div className={styles.container}>
<div className="p-2 pb-0">
<ProviderTabs
diff --git a/src/components/ui/ModeSelector.tsx b/src/components/ui/ModeSelector.tsx
new file mode 100644
index 000000000..5852fb5ff
--- /dev/null
+++ b/src/components/ui/ModeSelector.tsx
@@ -0,0 +1,88 @@
+import { ReactNode, useRef, useState, useEffect, useCallback } from "react";
+import type { InferenceMode } from "../../types/electron";
+
+export interface ModeSelectorItem {
+ id: InferenceMode;
+ label: string;
+ icon: ReactNode;
+ disabled?: boolean;
+}
+
+interface ModeSelectorProps {
+ modes: ModeSelectorItem[];
+ selectedMode: InferenceMode;
+ onSelect: (mode: InferenceMode) => void;
+}
+
+export function ModeSelector({ modes, selectedMode, onSelect }: ModeSelectorProps) {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [indicatorStyle, setIndicatorStyle] = useState<React.CSSProperties>({ opacity: 0 });
+
+ const updateIndicator = useCallback(() => {
+ const container = containerRef.current;
+ if (!container) return;
+
+ const selectedIndex = modes.findIndex((m) => m.id === selectedMode);
+ if (selectedIndex === -1) {
+ setIndicatorStyle({ opacity: 0 });
+ return;
+ }
+
+ const buttons = container.querySelectorAll<HTMLButtonElement>("[data-mode-button]");
+ const selectedButton = buttons[selectedIndex];
+ if (!selectedButton) return;
+
+ const containerRect = container.getBoundingClientRect();
+ const buttonRect = selectedButton.getBoundingClientRect();
+
+ setIndicatorStyle({
+ width: buttonRect.width,
+ height: buttonRect.height,
+ transform: `translateX(${buttonRect.left - containerRect.left}px)`,
+ opacity: 1,
+ });
+ }, [modes, selectedMode]);
+
+ useEffect(() => {
+ updateIndicator();
+ }, [updateIndicator]);
+
+ useEffect(() => {
+ const observer = new ResizeObserver(() => updateIndicator());
+ if (containerRef.current) observer.observe(containerRef.current);
+ return () => observer.disconnect();
+ }, [updateIndicator]);
+
+ return (
+ <div
+ ref={containerRef}
+ className="relative flex p-0.5 rounded-md bg-surface-raised dark:bg-surface-1"
+ >
+ <div
+ className="absolute top-0.5 left-0 rounded-md bg-card border border-border dark:border-border-subtle shadow-sm dark:shadow-(--shadow-card) transition-[width,height,transform,opacity] duration-200 ease-out pointer-events-none"
+ style={indicatorStyle}
+ />
+ {modes.map((mode) => {
+ const isSelected = selectedMode === mode.id;
+ return (
+ <button
+ key={mode.id}
+ data-mode-button
+ disabled={mode.disabled}
+ onClick={() => !mode.disabled && onSelect(mode.id)}
+ className={`relative z-10 flex-1 flex items-center justify-center gap-1.5 px-2.5 py-1.5 rounded-md font-medium text-xs transition-colors duration-150 ${
+ mode.disabled
+ ? "text-muted-foreground/40 cursor-not-allowed"
+ : isSelected
+ ? "text-foreground"
+ : "text-muted-foreground hover:text-foreground cursor-pointer"
+ }`}
+ >
+ {mode.icon}
+ <span className="whitespace-nowrap">{mode.label}</span>
+ </button>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index de4949c15..ee1052e6d 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -1201,6 +1201,48 @@ class IPCHandlers {
return this.whisperManager.getServerStatus();
});
+ ipcMain.handle("transcribe-lan-whisper", async (event, audioBlob, options = {}) => {
+ debugLogger.log("transcribe-lan-whisper called", {
+ audioBlobSize: audioBlob?.byteLength || audioBlob?.length || 0,
+ url: options.url,
+ });
+
+ if (!options.url) {
+ return {
+ success: false,
+ error: "lan_url_missing",
+ message: "LAN server URL not configured",
+ };
+ }
+
+ try {
+ const result = await this.whisperManager.transcribeViaLan(audioBlob, options.url, options);
+
+ debugLogger.log("LAN Whisper result", {
+ success: result.success,
+ hasText: !!result.text,
+ });
+
+ if (!result.success && result.message === "No audio detected") {
+ event.sender.send("no-audio-detected");
+ }
+
+ return result;
+ } catch (error) {
+ debugLogger.error("LAN Whisper transcription error", { error: error.message });
+
+ if (error.message.includes("unreachable")) {
+ return {
+ success: false,
+ error: "lan_unreachable",
+ message: "LAN whisper-server is unreachable. Check the URL and network connection.",
+ };
+ }
+
+ return { success: false, error: "lan_error", message: error.message };
+ }
+ });
+
ipcMain.handle("detect-gpu", async () => {
const { detectNvidiaGpu } = require("../utils/gpuDetection");
return detectNvidiaGpu();
@@ -1599,9 +1641,13 @@ class IPCHandlers {
if (!info?.hotkey) continue;
if (!usesNativeListener(info.hotkey)) {
- debugLogger.log(`[IPC] Unregistering globalShortcut "${info.hotkey}" (slot "${slot}") for capture mode`);
+ debugLogger.log(
+ `[IPC] Unregistering globalShortcut "${info.hotkey}" (slot "${slot}") for capture mode`
+ );
const { globalShortcut } = require("electron");
- try { globalShortcut.unregister(info.hotkey); } catch {}
+ try {
+ globalShortcut.unregister(info.hotkey);
+ } catch {}
}
}
@@ -1614,7 +1660,9 @@ class IPCHandlers {
// On GNOME, unregister all native keybindings during capture
if (hotkeyManager.isUsingGnome() && hotkeyManager.gnomeManager) {
for (const slot of [...hotkeyManager.gnomeManager.registeredSlots]) {
- debugLogger.log(`[IPC] Unregistering GNOME keybinding (slot "${slot}") for capture mode`);
+ debugLogger.log(
+ `[IPC] Unregistering GNOME keybinding (slot "${slot}") for capture mode`
+ );
await hotkeyManager.gnomeManager.unregisterKeybinding(slot).catch((err) => {
debugLogger.warn(`[IPC] Failed to unregister GNOME slot "${slot}":`, err.message);
});
@@ -1641,7 +1689,10 @@ class IPCHandlers {
} else {
// Exiting capture mode - re-register globalShortcut if not already registered
// Skip for KDE/GNOME/Hyprland — updateHotkey handles re-registration via native path
- const usesNativePath = hotkeyManager.isUsingKDE() || hotkeyManager.isUsingGnome() || hotkeyManager.isUsingHyprland();
+ const usesNativePath =
+ hotkeyManager.isUsingKDE() ||
+ hotkeyManager.isUsingGnome() ||
+ hotkeyManager.isUsingHyprland();
if (effectiveHotkey && !usesNativeListener(effectiveHotkey) && !usesNativePath) {
const { globalShortcut } = require("electron");
const accelerator = effectiveHotkey.startsWith("Fn+")
@@ -1709,18 +1760,28 @@ class IPCHandlers {
`[IPC] Re-registering KDE keybinding "${effectiveHotkey}" after capture mode`
);
const callback = this.windowManager.createHotkeyCallback();
- const result = await hotkeyManager.kdeManager.registerKeybinding(effectiveHotkey, "dictation", callback);
+ const result = await hotkeyManager.kdeManager.registerKeybinding(
+ effectiveHotkey,
+ "dictation",
+ callback
+ );
if (result === true) {
hotkeyManager.currentHotkey = effectiveHotkey;
} else {
- debugLogger.warn(`[IPC] Failed to re-register KDE keybinding "${effectiveHotkey}" after capture mode`, { result });
+ debugLogger.warn(
+ `[IPC] Failed to re-register KDE keybinding "${effectiveHotkey}" after capture mode`,
+ { result }
+ );
}
}
// Re-register non-dictation slots (meeting, agent) that were unregistered on capture enter
for (const [slot, info] of hotkeyManager.slots) {
- if (slot === "dictation" || slot === "cancel" || !info?.hotkey || !info?.callback) continue;
- debugLogger.log(`[IPC] Re-registering slot "${slot}" ("${info.hotkey}") after capture mode`);
+ if (slot === "dictation" || slot === "cancel" || !info?.hotkey || !info?.callback)
+ continue;
+ debugLogger.log(
+ `[IPC] Re-registering slot "${slot}" ("${info.hotkey}") after capture mode`
+ );
await hotkeyManager.registerSlot(slot, info.hotkey, info.callback).catch((err) => {
debugLogger.warn(`[IPC] Failed to re-register slot "${slot}":`, err.message);
});
@@ -2687,7 +2748,28 @@ class IPCHandlers {
try {
let result;
- if (settings?.useLocalWhisper) {
+ if (
+ settings?.transcriptionMode === "self-hosted" &&
+ settings?.remoteTranscriptionType === "lan" &&
+ settings?.remoteTranscriptionUrl
+ ) {
+ try {
+ const lanResult = await this.whisperManager.transcribeViaLan(
+ buffer,
+ settings.remoteTranscriptionUrl,
+ { language: settings.language || null }
+ );
+ if (lanResult?.success && lanResult.text) {
+ result = { text: lanResult.text, source: "lan", model: "remote" };
+ }
+ } catch (lanError) {
+ debugLogger.warn("LAN whisper-server failed, falling back", {
+ error: lanError.message,
+ });
+ }
+ }
+
+ if (!result && settings?.useLocalWhisper) {
if (settings.localTranscriptionProvider === "nvidia") {
const model =
settings.parakeetModel || process.env.PARAKEET_MODEL || "parakeet-tdt-0.6b-v3";
@@ -2697,7 +2779,7 @@ class IPCHandlers {
model: settings.whisperModel,
});
}
- } else if (settings?.cloudTranscriptionMode === "openwhispr") {
+ } else if (!result && settings?.cloudTranscriptionMode === "openwhispr") {
const win = BrowserWindow.fromWebContents(event.sender);
if (win) {
const cookieHeader = await getSessionCookiesFromWindow(win);
@@ -2719,7 +2801,7 @@ class IPCHandlers {
}
}
}
- } else {
+ } else if (!result) {
const provider = settings?.cloudTranscriptionProvider || "openai";
const model = this._resolveByokModel(provider, settings?.cloudTranscriptionModel);
diff --git a/src/helpers/whisper.js b/src/helpers/whisper.js
index 1a1de6399..d96e45671 100644
--- a/src/helpers/whisper.js
+++ b/src/helpers/whisper.js
@@ -314,6 +314,51 @@ class WhisperManager {
return this.parseWhisperResult(result);
}
+ async transcribeViaLan(audioBlob, url, options = {}) {
+ debugLogger.info("Transcription mode: LAN", { url, language: options.language || "auto" });
+
+ await this.serverManager.connectRemote(url);
+
+ let audioBuffer;
+ if (Buffer.isBuffer(audioBlob)) {
+ audioBuffer = audioBlob;
+ } else if (ArrayBuffer.isView(audioBlob)) {
+ audioBuffer = Buffer.from(audioBlob.buffer, audioBlob.byteOffset, audioBlob.byteLength);
+ } else if (audioBlob instanceof ArrayBuffer) {
+ audioBuffer = Buffer.from(audioBlob);
+ } else if (typeof audioBlob === "string") {
+ audioBuffer = Buffer.from(audioBlob, "base64");
+ } else if (audioBlob && audioBlob.buffer && typeof audioBlob.byteLength === "number") {
+ audioBuffer = Buffer.from(audioBlob.buffer, audioBlob.byteOffset || 0, audioBlob.byteLength);
+ } else {
+ throw new Error(`Unsupported audio data type: ${typeof audioBlob}`);
+ }
+
+ if (!audioBuffer || audioBuffer.length === 0) {
+ throw new Error("Audio buffer is empty - no audio data received");
+ }
+
+ debugLogger.logWhisperPipeline("transcribeViaLan - sending to server", {
+ bufferSize: audioBuffer.length,
+ url,
+ language: options.language,
+ });
+
+ const startTime = Date.now();
+ const result = await this.serverManager.transcribe(audioBuffer, {
+ language: options.language || null,
+ initialPrompt: options.initialPrompt || null,
+ });
+ const elapsed = Date.now() - startTime;
+
+ debugLogger.logWhisperPipeline("transcribeViaLan - completed", {
+ elapsed,
+ resultKeys: Object.keys(result),
+ });
+
+ return this.parseWhisperResult(result);
+ }
+
// Normalize whitespace: replace newlines with spaces and collapse multiple spaces
// whisper.cpp returns text with \n between audio segments which causes formatting issues
normalizeWhitespace(text) {
diff --git a/src/helpers/whisperServer.js b/src/helpers/whisperServer.js
index 5d46a5e45..10d3a21c8 100644
--- a/src/helpers/whisperServer.js
+++ b/src/helpers/whisperServer.js
@@ -20,8 +20,10 @@ class WhisperServerManager extends EventEmitter {
constructor() {
super();
this.process = null;
+ this.hostname = "127.0.0.1";
this.port = null;
this.ready = false;
+ this.isRemote = false;
this.modelPath = null;
this.startupPromise = null;
this.healthCheckInterval = null;
@@ -173,6 +175,48 @@ class WhisperServerManager extends EventEmitter {
return this.getServerBinaryPath() !== null;
}
+ async connectRemote(url) {
+ const parsed = new URL(url);
+ const hostname = parsed.hostname;
+ const port = parseInt(parsed.port, 10) || (parsed.protocol === "https:" ? 443 : 80);
+
+ debugLogger.debug("Connecting to remote whisper-server", { hostname, port });
+
+ const reachable = await new Promise((resolve) => {
+ const req = http.request(
+ { hostname, port, path: "/", method: "GET", timeout: HEALTH_CHECK_TIMEOUT_MS },
+ (res) => {
+ resolve(true);
+ res.resume();
+ }
+ );
+ req.on("error", () => resolve(false));
+ req.on("timeout", () => {
+ req.destroy();
+ resolve(false);
+ });
+ req.end();
+ });
+
+ if (!reachable) {
+ throw new Error(`Remote whisper-server unreachable at ${hostname}:${port}`);
+ }
+
+ if (this.process) {
+ await this.stop();
+ }
+
+ this.hostname = hostname;
+ this.port = port;
+ this.ready = true;
+ this.isRemote = true;
+ this.canConvert = !!this.getFFmpegPath();
+
+ this.startHealthCheck();
+
+ debugLogger.info("Connected to remote whisper-server", { hostname, port });
+ }
+
async findAvailablePort() {
for (let port = PORT_RANGE_START; port <= PORT_RANGE_END; port++) {
if (await this.isPortAvailable(port)) return port;
@@ -195,12 +239,14 @@ class WhisperServerManager extends EventEmitter {
async start(modelPath, options = {}) {
if (this.startupPromise) return this.startupPromise;
- if (this.ready && this.modelPath === modelPath) return;
+ if (this.ready && this.modelPath === modelPath && !this.isRemote) return;
- if (this.process) {
+ if (this.process || this.isRemote) {
await this.stop();
}
+ this.isRemote = false;
+ this.hostname = "127.0.0.1";
this.startupPromise = this._doStart(modelPath, options);
try {
await this.startupPromise;
@@ -359,7 +405,7 @@ class WhisperServerManager extends EventEmitter {
return new Promise((resolve) => {
const req = http.request(
{
- hostname: "127.0.0.1",
+ hostname: this.hostname,
port: this.port,
path: "/",
method: "GET",
@@ -383,7 +429,7 @@ class WhisperServerManager extends EventEmitter {
startHealthCheck() {
this.stopHealthCheck();
this.healthCheckInterval = setInterval(async () => {
- if (!this.process) {
+ if (!this.isRemote && !this.process) {
this.stopHealthCheck();
return;
}
@@ -402,7 +448,7 @@ class WhisperServerManager extends EventEmitter {
}
async transcribe(audioBuffer, options = {}) {
- if (!this.ready || !this.process) {
+ if (!this.ready || (!this.process && !this.isRemote)) {
throw new Error("whisper-server is not running");
}
@@ -471,7 +517,7 @@ class WhisperServerManager extends EventEmitter {
const req = http.request(
{
- hostname: "127.0.0.1",
+ hostname: this.hostname,
port: this.port,
path: "/inference",
method: "POST",
@@ -545,6 +591,15 @@ class WhisperServerManager extends EventEmitter {
async stop() {
this.stopHealthCheck();
+ if (this.isRemote) {
+ debugLogger.debug("Disconnecting from remote whisper-server");
+ this.ready = false;
+ this.isRemote = false;
+ this.hostname = "127.0.0.1";
+ this.port = null;
+ return;
+ }
+
if (!this.process) {
this.ready = false;
return;
@@ -586,8 +641,10 @@ class WhisperServerManager extends EventEmitter {
getStatus() {
return {
available: this.isAvailable(),
- running: this.ready && this.process !== null,
+ running: this.ready && (this.process !== null || this.isRemote),
port: this.port,
+ hostname: this.hostname,
+ isRemote: this.isRemote,
modelPath: this.modelPath,
modelName: this.modelPath ? path.basename(this.modelPath, ".bin").replace("ggml-", "") : null,
};
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index fe3968bdf..61d7b3ac9 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -2,7 +2,7 @@ import React, { createContext, useCallback, useContext, useEffect, useRef } from
import { useSettingsStore, initializeSettings } from "../stores/settingsStore";
import logger from "../utils/logger";
import { useLocalStorage } from "./useLocalStorage";
-import type { LocalTranscriptionProvider } from "../types/electron";
+import type { LocalTranscriptionProvider, InferenceMode, SelfHostedType } from "../types/electron";
export interface TranscriptionSettings {
uiLanguage: string;
@@ -18,6 +18,9 @@ export interface TranscriptionSettings {
cloudTranscriptionModel: string;
cloudTranscriptionBaseUrl?: string;
cloudTranscriptionMode: string;
+ transcriptionMode: InferenceMode;
+ remoteTranscriptionType: SelfHostedType;
+ remoteTranscriptionUrl: string;
customDictionary: string[];
assemblyAiStreaming: boolean;
}
@@ -28,6 +31,9 @@ export interface ReasoningSettings {
reasoningProvider: string;
cloudReasoningBaseUrl?: string;
cloudReasoningMode: string;
+ reasoningMode: InferenceMode;
+ remoteReasoningType: SelfHostedType;
+ remoteReasoningUrl: string;
}
export interface HotkeySettings {
@@ -178,6 +184,12 @@ function useSettingsInternal() {
cloudReasoningBaseUrl: store.cloudReasoningBaseUrl,
cloudTranscriptionMode: store.cloudTranscriptionMode,
cloudReasoningMode: store.cloudReasoningMode,
+ transcriptionMode: store.transcriptionMode,
+ remoteTranscriptionType: store.remoteTranscriptionType,
+ remoteTranscriptionUrl: store.remoteTranscriptionUrl,
+ reasoningMode: store.reasoningMode,
+ remoteReasoningType: store.remoteReasoningType,
+ remoteReasoningUrl: store.remoteReasoningUrl,
customDictionary: store.customDictionary,
assemblyAiStreaming: store.assemblyAiStreaming,
setAssemblyAiStreaming: store.setAssemblyAiStreaming,
@@ -207,6 +219,12 @@ function useSettingsInternal() {
setCloudReasoningBaseUrl: store.setCloudReasoningBaseUrl,
setCloudTranscriptionMode: store.setCloudTranscriptionMode,
setCloudReasoningMode: store.setCloudReasoningMode,
+ setTranscriptionMode: store.setTranscriptionMode,
+ setRemoteTranscriptionType: store.setRemoteTranscriptionType,
+ setRemoteTranscriptionUrl: store.setRemoteTranscriptionUrl,
+ setReasoningMode: store.setReasoningMode,
+ setRemoteReasoningType: store.setRemoteReasoningType,
+ setRemoteReasoningUrl: store.setRemoteReasoningUrl,
setCustomDictionary: store.setCustomDictionary,
setUseReasoningModel: store.setUseReasoningModel,
setReasoningModel: store.setReasoningModel,
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 0ba581634..63a426b65 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -1091,6 +1091,12 @@
"description": "Bereinigt Transkriptionen, verarbeitet Befehle und korrigiert Fehler unter Beibehaltung Ihres Stils.",
"enableTextCleanup": "Textbereinigung aktivieren",
"enableTextCleanupDescription": "KI verbessert die Transkriptionsqualität",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Anbieter",
+ "local": "Lokal",
+ "selfHosted": "Selbst gehostet"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funktioniert sofort. Keine Konfiguration nötig.",
"title": "KI-Textverbesserung",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "Konfigurieren Sie Ihren eigenen Anbieter und API-Schlüssel.",
"title": "Zu benutzerdefinierter Einrichtung gewechselt"
+ },
+ "switchedProviders": {
+ "title": "Cloud-Anbieter",
+ "description": "Verwendung Ihrer eigenen API-Schlüssel."
+ },
+ "switchedLocal": {
+ "title": "Lokal",
+ "description": "KI wird lokal auf Ihrem Gerät ausgeführt."
+ },
+ "switchedSelfHosted": {
+ "title": "Selbst gehostet",
+ "description": "Verwendung Ihres eigenen Servers."
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "Benutzerdefinierte Einrichtung",
"customSetupDescription": "Verwenden Sie Ihren eigenen Anbieter und API-Schlüssel.",
"description": "Wählen Sie, wie OpenWhispr Ihre Stimme transkribiert",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Anbieter",
+ "local": "Lokal",
+ "selfHosted": "Selbst gehostet"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funktioniert sofort. Keine Konfiguration nötig.",
"title": "Sprache-zu-Text",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "Konfigurieren Sie Ihren eigenen Anbieter und API-Schlüssel.",
"title": "Zu benutzerdefinierter Einrichtung gewechselt"
+ },
+ "switchedProviders": {
+ "title": "Cloud-Anbieter",
+ "description": "Verwendung Ihrer eigenen API-Schlüssel."
+ },
+ "switchedLocal": {
+ "title": "Lokal",
+ "description": "Transkription wird lokal auf Ihrem Gerät ausgeführt."
+ },
+ "switchedSelfHosted": {
+ "title": "Selbst gehostet",
+ "description": "Verwendung Ihres eigenen Servers."
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "GPU für lokale KI-Verarbeitung"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "Endpunkt-URL",
+ "serverUrl": "Server-URL",
+ "apiKeyOptional": "API-Schlüssel (optional)",
+ "lanHint": "Audio bleibt in Ihrem Netzwerk — nichts verlässt Ihr LAN."
}
},
"models": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 6b182ec77..fe2862ef5 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -1139,6 +1139,12 @@
"description": "Clean up transcriptions, handle commands, and fix errors while preserving your tone.",
"enableTextCleanup": "Enable text cleanup",
"enableTextCleanupDescription": "AI improves transcription quality",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Providers",
+ "local": "On Device",
+ "selfHosted": "Self-Hosted"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Just works. No configuration needed.",
"title": "AI Text Enhancement",
@@ -1150,6 +1156,18 @@
"switchedCustom": {
"description": "Configure your own provider and API key.",
"title": "Switched to Custom Setup"
+ },
+ "switchedProviders": {
+ "title": "Cloud Providers",
+ "description": "Using your own API keys."
+ },
+ "switchedLocal": {
+ "title": "On Device",
+ "description": "AI runs locally on your machine."
+ },
+ "switchedSelfHosted": {
+ "title": "Self-Hosted",
+ "description": "Using your own server."
}
}
},
@@ -1430,6 +1448,12 @@
"customSetup": "Custom Setup",
"customSetupDescription": "Use your own provider and API key.",
"description": "Choose how OpenWhispr transcribes your voice",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Providers",
+ "local": "On Device",
+ "selfHosted": "Self-Hosted"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Just works. No configuration needed.",
"title": "Speech to Text",
@@ -1441,6 +1465,18 @@
"switchedCustom": {
"description": "Configure your own provider and API key.",
"title": "Switched to Custom Setup"
+ },
+ "switchedProviders": {
+ "title": "Cloud Providers",
+ "description": "Using your own API keys."
+ },
+ "switchedLocal": {
+ "title": "On Device",
+ "description": "Transcription runs locally on your machine."
+ },
+ "switchedSelfHosted": {
+ "title": "Self-Hosted",
+ "description": "Using your own server."
}
},
"gpuDevice": {
@@ -1453,6 +1489,12 @@
"title": "Intelligence GPU",
"description": "GPU used for local AI processing"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "Endpoint URL",
+ "serverUrl": "Server URL",
+ "apiKeyOptional": "API Key (optional)",
+ "lanHint": "Audio stays on your network — nothing leaves your LAN."
}
},
"models": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index cc9f20e9e..1c62bafe7 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -1091,6 +1091,12 @@
"description": "Corrige transcripciones, gestiona comandos y soluciona errores preservando tu tono.",
"enableTextCleanup": "Activar corrección de texto",
"enableTextCleanupDescription": "La IA mejora la calidad de transcripción",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Proveedores",
+ "local": "En dispositivo",
+ "selfHosted": "Autoalojado"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funciona de inmediato. Sin configuración necesaria.",
"title": "Mejora de texto con IA",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "Configura tu propio proveedor y clave API.",
"title": "Cambiado a configuración personalizada"
+ },
+ "switchedProviders": {
+ "title": "Proveedores en la nube",
+ "description": "Usando tus propias claves API."
+ },
+ "switchedLocal": {
+ "title": "En dispositivo",
+ "description": "La IA se ejecuta localmente en tu máquina."
+ },
+ "switchedSelfHosted": {
+ "title": "Autoalojado",
+ "description": "Usando tu propio servidor."
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "Configuración personalizada",
"customSetupDescription": "Usa tu propio proveedor y clave API.",
"description": "Elige cómo OpenWhispr transcribe tu voz",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Proveedores",
+ "local": "En dispositivo",
+ "selfHosted": "Autoalojado"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funciona de inmediato. Sin configuración necesaria.",
"title": "Voz a texto",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "Configura tu propio proveedor y clave API.",
"title": "Cambiado a configuración personalizada"
+ },
+ "switchedProviders": {
+ "title": "Proveedores en la nube",
+ "description": "Usando tus propias claves API."
+ },
+ "switchedLocal": {
+ "title": "En dispositivo",
+ "description": "La transcripción se ejecuta localmente en tu máquina."
+ },
+ "switchedSelfHosted": {
+ "title": "Autoalojado",
+ "description": "Usando tu propio servidor."
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "GPU usado para procesamiento IA local"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "URL del endpoint",
+ "serverUrl": "URL del servidor",
+ "apiKeyOptional": "API Key (opcional)",
+ "lanHint": "El audio permanece en tu red — nada sale de tu LAN."
}
},
"models": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 5ef220b6d..92fc4e738 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -1091,6 +1091,12 @@
"description": "Corrige les transcriptions, gère les commandes et corrige les erreurs tout en préservant votre ton.",
"enableTextCleanup": "Activer la correction de texte",
"enableTextCleanupDescription": "L'IA améliore la qualité de transcription",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Fournisseurs",
+ "local": "Sur l'appareil",
+ "selfHosted": "Auto-hébergé"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Fonctionne directement. Aucune configuration requise.",
"title": "Amélioration du texte par IA",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "Configurez votre propre fournisseur et clé API.",
"title": "Basculé vers la configuration personnalisée"
+ },
+ "switchedProviders": {
+ "title": "Fournisseurs cloud",
+ "description": "Utilisation de vos propres clés API."
+ },
+ "switchedLocal": {
+ "title": "Sur l'appareil",
+ "description": "L'IA s'exécute localement sur votre machine."
+ },
+ "switchedSelfHosted": {
+ "title": "Auto-hébergé",
+ "description": "Utilisation de votre propre serveur."
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "Configuration personnalisée",
"customSetupDescription": "Utilisez votre propre fournisseur et clé API.",
"description": "Choisissez comment OpenWhispr transcrit votre voix",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Fournisseurs",
+ "local": "Sur l'appareil",
+ "selfHosted": "Auto-hébergé"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Fonctionne directement. Aucune configuration requise.",
"title": "Reconnaissance vocale",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "Configurez votre propre fournisseur et clé API.",
"title": "Basculé vers la configuration personnalisée"
+ },
+ "switchedProviders": {
+ "title": "Fournisseurs cloud",
+ "description": "Utilisation de vos propres clés API."
+ },
+ "switchedLocal": {
+ "title": "Sur l'appareil",
+ "description": "La transcription s'exécute localement sur votre machine."
+ },
+ "switchedSelfHosted": {
+ "title": "Auto-hébergé",
+ "description": "Utilisation de votre propre serveur."
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "GPU utilisé pour le traitement IA local"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "URL du point d'accès",
+ "serverUrl": "URL du serveur",
+ "apiKeyOptional": "Clé API (facultative)",
+ "lanHint": "L'audio reste sur votre réseau — rien ne quitte votre LAN."
}
},
"models": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index fb14675ea..44562ce58 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -1091,6 +1091,12 @@
"description": "Correggi le trascrizioni, gestisci i comandi e risolvi gli errori preservando il tuo tono.",
"enableTextCleanup": "Attiva correzione testo",
"enableTextCleanupDescription": "L'IA migliora la qualità della trascrizione",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Provider",
+ "local": "Sul dispositivo",
+ "selfHosted": "Self-hosted"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funziona subito. Nessuna configurazione necessaria.",
"title": "Miglioramento testo con IA",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "Configura il tuo provider e la tua chiave API.",
"title": "Passato a configurazione personalizzata"
+ },
+ "switchedProviders": {
+ "title": "Provider cloud",
+ "description": "Utilizzo delle tue chiavi API."
+ },
+ "switchedLocal": {
+ "title": "Sul dispositivo",
+ "description": "L'IA viene eseguita localmente sulla tua macchina."
+ },
+ "switchedSelfHosted": {
+ "title": "Self-hosted",
+ "description": "Utilizzo del tuo server."
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "Configurazione personalizzata",
"customSetupDescription": "Usa il tuo provider e la tua chiave API.",
"description": "Scegli come OpenWhispr trascrive la tua voce",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Provider",
+ "local": "Sul dispositivo",
+ "selfHosted": "Self-hosted"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funziona subito. Nessuna configurazione necessaria.",
"title": "Riconoscimento vocale",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "Configura il tuo provider e la tua chiave API.",
"title": "Passato a configurazione personalizzata"
+ },
+ "switchedProviders": {
+ "title": "Provider cloud",
+ "description": "Utilizzo delle tue chiavi API."
+ },
+ "switchedLocal": {
+ "title": "Sul dispositivo",
+ "description": "La trascrizione viene eseguita localmente sulla tua macchina."
+ },
+ "switchedSelfHosted": {
+ "title": "Self-hosted",
+ "description": "Utilizzo del tuo server."
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "GPU usata per l'elaborazione IA locale"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "URL endpoint",
+ "serverUrl": "URL server",
+ "apiKeyOptional": "API Key (opzionale)",
+ "lanHint": "L'audio resta sulla tua rete — niente esce dalla tua LAN."
}
},
"models": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index bf8546528..1dcad18d8 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -1091,6 +1091,12 @@
"description": "文字起こしのクリーンアップ、コマンド処理、エラー修正を行いながら、あなたの話し方を維持します。",
"enableTextCleanup": "テキスト補正を有効にする",
"enableTextCleanupDescription": "AI が文字起こしの品質を向上",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "プロバイダー",
+ "local": "デバイス上",
+ "selfHosted": "セルフホスト"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "設定不要ですぐに使えます。",
"title": "AI テキスト補正",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "独自のプロバイダーと API キーを設定してください。",
"title": "カスタム設定に切り替えました"
+ },
+ "switchedProviders": {
+ "title": "クラウドプロバイダー",
+ "description": "独自の API キーを使用します。"
+ },
+ "switchedLocal": {
+ "title": "デバイス上",
+ "description": "AI はお使いのマシン上でローカルに実行されます。"
+ },
+ "switchedSelfHosted": {
+ "title": "セルフホスト",
+ "description": "独自のサーバーを使用します。"
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "カスタム設定",
"customSetupDescription": "独自のプロバイダーと API キーを使用。",
"description": "OpenWhispr の音声文字起こし方法を選択",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "プロバイダー",
+ "local": "デバイス上",
+ "selfHosted": "セルフホスト"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "設定不要ですぐに使えます。",
"title": "音声テキスト変換",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "独自のプロバイダーと API キーを設定してください。",
"title": "カスタム設定に切り替えました"
+ },
+ "switchedProviders": {
+ "title": "クラウドプロバイダー",
+ "description": "独自の API キーを使用します。"
+ },
+ "switchedLocal": {
+ "title": "デバイス上",
+ "description": "文字起こしはお使いのマシン上でローカルに実行されます。"
+ },
+ "switchedSelfHosted": {
+ "title": "セルフホスト",
+ "description": "独自のサーバーを使用します。"
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "ローカルAI処理に使用するGPU"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "エンドポイント URL",
+ "serverUrl": "サーバー URL",
+ "apiKeyOptional": "API キー(任意)",
+ "lanHint": "音声はネットワーク内に留まります — LAN の外には出ません。"
}
},
"models": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 979dd08b0..ba71df02c 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -1063,6 +1063,12 @@
"description": "Limpe transcrições, processe comandos e corrija erros preservando seu tom de voz.",
"enableTextCleanup": "Ativar limpeza de texto",
"enableTextCleanupDescription": "A IA melhora a qualidade da transcrição",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Provedores",
+ "local": "No dispositivo",
+ "selfHosted": "Auto-hospedado"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funciona de imediato. Sem configuração necessária.",
"title": "Melhoria de texto com IA",
@@ -1074,6 +1080,18 @@
"switchedCustom": {
"description": "Configure seu próprio provedor e chave API.",
"title": "Mudou para configuração personalizada"
+ },
+ "switchedProviders": {
+ "title": "Provedores na nuvem",
+ "description": "Usando suas próprias chaves API."
+ },
+ "switchedLocal": {
+ "title": "No dispositivo",
+ "description": "A IA é executada localmente na sua máquina."
+ },
+ "switchedSelfHosted": {
+ "title": "Auto-hospedado",
+ "description": "Usando seu próprio servidor."
}
}
},
@@ -1354,6 +1372,12 @@
"customSetup": "Configuração personalizada",
"customSetupDescription": "Use seu próprio provedor e chave API.",
"description": "Escolha como o OpenWhispr transcreve sua voz",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Provedores",
+ "local": "No dispositivo",
+ "selfHosted": "Auto-hospedado"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Funciona de imediato. Sem configuração necessária.",
"title": "Fala para texto",
@@ -1365,6 +1389,18 @@
"switchedCustom": {
"description": "Configure seu próprio provedor e chave API.",
"title": "Mudou para configuração personalizada"
+ },
+ "switchedProviders": {
+ "title": "Provedores na nuvem",
+ "description": "Usando suas próprias chaves API."
+ },
+ "switchedLocal": {
+ "title": "No dispositivo",
+ "description": "A transcrição é executada localmente na sua máquina."
+ },
+ "switchedSelfHosted": {
+ "title": "Auto-hospedado",
+ "description": "Usando seu próprio servidor."
}
},
"gpuDevice": {
@@ -1377,6 +1413,12 @@
"title": "Intelligence GPU",
"description": "GPU usado para processamento IA local"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "URL do endpoint",
+ "serverUrl": "URL do servidor",
+ "apiKeyOptional": "API Key (opcional)",
+ "lanHint": "O áudio permanece na sua rede — nada sai da sua LAN."
}
},
"models": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 36ccf0acc..79ce07639 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -1091,6 +1091,12 @@
"description": "Очищайте транскрипции, обрабатывайте команды и исправляйте ошибки, сохраняя вашу манеру речи.",
"enableTextCleanup": "Включить очистку текста",
"enableTextCleanupDescription": "ИИ улучшает качество транскрипции",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Провайдеры",
+ "local": "На устройстве",
+ "selfHosted": "Свой сервер"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Просто работает. Настройка не требуется.",
"title": "ИИ-улучшение текста",
@@ -1102,6 +1108,18 @@
"switchedCustom": {
"description": "Настройте собственного провайдера и API-ключ.",
"title": "Переключено на пользовательскую настройку"
+ },
+ "switchedProviders": {
+ "title": "Облачные провайдеры",
+ "description": "Используются ваши собственные API-ключи."
+ },
+ "switchedLocal": {
+ "title": "На устройстве",
+ "description": "ИИ работает локально на вашем компьютере."
+ },
+ "switchedSelfHosted": {
+ "title": "Свой сервер",
+ "description": "Используется ваш собственный сервер."
}
}
},
@@ -1382,6 +1400,12 @@
"customSetup": "Пользовательская настройка",
"customSetupDescription": "Используйте собственного провайдера и API-ключ.",
"description": "Выберите, как OpenWhispr будет транскрибировать вашу речь",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "Провайдеры",
+ "local": "На устройстве",
+ "selfHosted": "Свой сервер"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "Просто работает. Настройка не требуется.",
"title": "Распознавание речи",
@@ -1393,6 +1417,18 @@
"switchedCustom": {
"description": "Настройте собственного провайдера и API-ключ.",
"title": "Переключено на пользовательскую настройку"
+ },
+ "switchedProviders": {
+ "title": "Облачные провайдеры",
+ "description": "Используются ваши собственные API-ключи."
+ },
+ "switchedLocal": {
+ "title": "На устройстве",
+ "description": "Транскрипция выполняется локально на вашем компьютере."
+ },
+ "switchedSelfHosted": {
+ "title": "Свой сервер",
+ "description": "Используется ваш собственный сервер."
}
},
"gpuDevice": {
@@ -1405,6 +1441,12 @@
"title": "Intelligence GPU",
"description": "GPU для локальной обработки ИИ"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "URL эндпоинта",
+ "serverUrl": "URL сервера",
+ "apiKeyOptional": "API-ключ (необязательно)",
+ "lanHint": "Аудио остаётся в вашей сети — ничего не покидает вашу LAN."
}
},
"models": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 1ee17acbb..6d899fdc4 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -1086,6 +1086,12 @@
"description": "整理转录文本、处理指令、修正错误,同时保留你的语气风格。",
"enableTextCleanup": "启用文本整理",
"enableTextCleanupDescription": "AI 提升转录质量",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "服务商",
+ "local": "本地运行",
+ "selfHosted": "自托管"
+ },
"openwhisprCloud": "OpenWhispr 云端",
"openwhisprCloudDescription": "开箱即用,无需配置。",
"title": "AI 文本增强",
@@ -1097,6 +1103,18 @@
"switchedCustom": {
"description": "请配置你的服务商和 API Key。",
"title": "已切换到自定义设置"
+ },
+ "switchedProviders": {
+ "title": "云服务商",
+ "description": "使用你自己的 API Key。"
+ },
+ "switchedLocal": {
+ "title": "本地运行",
+ "description": "AI 在你的设备上本地运行。"
+ },
+ "switchedSelfHosted": {
+ "title": "自托管",
+ "description": "使用你自己的服务器。"
}
}
},
@@ -1377,6 +1395,12 @@
"customSetup": "自定义设置",
"customSetupDescription": "使用你自己的服务商和 API Key。",
"description": "选择 OpenWhispr 转录语音的方式",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "服务商",
+ "local": "本地运行",
+ "selfHosted": "自托管"
+ },
"openwhisprCloud": "OpenWhispr 云端",
"openwhisprCloudDescription": "开箱即用,无需配置。",
"title": "语音转文字",
@@ -1388,6 +1412,18 @@
"switchedCustom": {
"description": "请配置你的服务商和 API Key。",
"title": "已切换到自定义设置"
+ },
+ "switchedProviders": {
+ "title": "云服务商",
+ "description": "使用你自己的 API Key。"
+ },
+ "switchedLocal": {
+ "title": "本地运行",
+ "description": "转录在你的设备上本地运行。"
+ },
+ "switchedSelfHosted": {
+ "title": "自托管",
+ "description": "使用你自己的服务器。"
}
},
"gpuDevice": {
@@ -1400,6 +1436,12 @@
"title": "Intelligence GPU",
"description": "用于本地 AI 处理的 GPU"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "端点 URL",
+ "serverUrl": "服务器 URL",
+ "apiKeyOptional": "API Key(可选)",
+ "lanHint": "音频留在你的网络中 — 不会离开你的 LAN。"
}
},
"models": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 04641d5bd..73efa8498 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -1086,6 +1086,12 @@
"description": "整理轉錄文字、處理指令、修正錯誤,同時保留你的語調。",
"enableTextCleanup": "啟用文字整理",
"enableTextCleanupDescription": "AI 自動提升轉錄品質",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "供應商",
+ "local": "本機執行",
+ "selfHosted": "自架主機"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "即開即用,無需設定。",
"title": "AI 文字增強",
@@ -1097,6 +1103,18 @@
"switchedCustom": {
"description": "設定你自己的供應商和 API Key。",
"title": "已切換至自訂設定"
+ },
+ "switchedProviders": {
+ "title": "雲端供應商",
+ "description": "使用你自己的 API Key。"
+ },
+ "switchedLocal": {
+ "title": "本機執行",
+ "description": "AI 在你的裝置上本機執行。"
+ },
+ "switchedSelfHosted": {
+ "title": "自架主機",
+ "description": "使用你自己的伺服器。"
}
}
},
@@ -1377,6 +1395,12 @@
"customSetup": "自訂設定",
"customSetupDescription": "使用你自己的供應商和 API Key。",
"description": "選擇 OpenWhispr 轉錄語音的方式",
+ "modes": {
+ "openwhispr": "OpenWhispr",
+ "providers": "供應商",
+ "local": "本機執行",
+ "selfHosted": "自架主機"
+ },
"openwhisprCloud": "OpenWhispr Cloud",
"openwhisprCloudDescription": "即開即用,無需設定。",
"title": "語音轉文字",
@@ -1388,6 +1412,18 @@
"switchedCustom": {
"description": "設定你自己的供應商和 API Key。",
"title": "已切換至自訂設定"
+ },
+ "switchedProviders": {
+ "title": "雲端供應商",
+ "description": "使用你自己的 API Key。"
+ },
+ "switchedLocal": {
+ "title": "本機執行",
+ "description": "轉錄在你的裝置上本機執行。"
+ },
+ "switchedSelfHosted": {
+ "title": "自架主機",
+ "description": "使用你自己的伺服器。"
}
},
"gpuDevice": {
@@ -1400,6 +1436,12 @@
"title": "Intelligence GPU",
"description": "用於本機 AI 處理的 GPU"
}
+ },
+ "selfHosted": {
+ "endpointUrl": "端點 URL",
+ "serverUrl": "伺服器 URL",
+ "apiKeyOptional": "API Key(選填)",
+ "lanHint": "音訊留在你的網路中 — 不會離開你的 LAN。"
}
},
"models": {
diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.ts
index ba6f43a3c..537f8bb8e 100644
--- a/src/services/ReasoningService.ts
+++ b/src/services/ReasoningService.ts
@@ -317,12 +317,16 @@ class ReasoningService extends BaseReasoningService {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 30000);
try {
+ const headers: Record<string, string> = {
+ "Content-Type": "application/json",
+ };
+ if (apiKey) {
+ headers["Authorization"] = `Bearer ${apiKey}`;
+ }
+
const res = await fetch(endpoint, {
method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${apiKey}`,
- },
+ headers,
body: JSON.stringify(requestBody),
signal: controller.signal,
});
@@ -433,35 +437,46 @@ class ReasoningService extends BaseReasoningService {
let result: string;
const startTime = Date.now();
+ const settings = getSettings();
+ const isLanReasoning =
+ settings.reasoningMode === "self-hosted" &&
+ settings.remoteReasoningType === "lan" &&
+ settings.remoteReasoningUrl;
+
logger.logReasoning("ROUTING_TO_PROVIDER", {
provider,
model,
+ isLanReasoning: !!isLanReasoning,
});
- switch (provider) {
- case "openai":
- result = await this.processWithOpenAI(text, trimmedModel, agentName, config);
- break;
- case "anthropic":
- result = await this.processWithAnthropic(text, trimmedModel, agentName, config);
- break;
- case "local":
- result = await this.processWithLocal(text, trimmedModel, agentName, config);
- break;
- case "gemini":
- result = await this.processWithGemini(text, trimmedModel, agentName, config);
- break;
- case "groq":
- result = await this.processWithGroq(text, model, agentName, config);
- break;
- case "openwhispr":
- result = await this.processWithOpenWhispr(text, model, agentName, config);
- break;
- case "custom":
- result = await this.processWithOpenAI(text, trimmedModel, agentName, config);
- break;
- default:
- throw new Error(`Unsupported reasoning provider: ${provider}`);
+ if (isLanReasoning) {
+ result = await this.processWithLan(text, agentName, config);
+ } else {
+ switch (provider) {
+ case "openai":
+ result = await this.processWithOpenAI(text, trimmedModel, agentName, config);
+ break;
+ case "anthropic":
+ result = await this.processWithAnthropic(text, trimmedModel, agentName, config);
+ break;
+ case "local":
+ result = await this.processWithLocal(text, trimmedModel, agentName, config);
+ break;
+ case "gemini":
+ result = await this.processWithGemini(text, trimmedModel, agentName, config);
+ break;
+ case "groq":
+ result = await this.processWithGroq(text, model, agentName, config);
+ break;
+ case "openwhispr":
+ result = await this.processWithOpenWhispr(text, model, agentName, config);
+ break;
+ case "custom":
+ result = await this.processWithOpenAI(text, trimmedModel, agentName, config);
+ break;
+ default:
+ throw new Error(`Unsupported reasoning provider: ${provider}`);
+ }
}
const processingTime = Date.now() - startTime;
@@ -1066,6 +1081,47 @@ class ReasoningService extends BaseReasoningService {
}
}
+ private async processWithLan(
+ text: string,
+ agentName: string | null = null,
+ config: ReasoningConfig = {}
+ ): Promise<string> {
+ const settings = getSettings();
+ const lanUrl = settings.remoteReasoningUrl.trim();
+
+ logger.logReasoning("LAN_START", { url: lanUrl, agentName });
+
+ if (this.isProcessing) {
+ throw new Error("Already processing a request");
+ }
+
+ this.isProcessing = true;
+
+ try {
+ const baseUrl = normalizeBaseUrl(lanUrl) || lanUrl;
+ const endpoint = buildApiUrl(baseUrl, "/v1/chat/completions");
+
+ return await this.callChatCompletionsApi(
+ endpoint,
+ "",
+ "default",
+ text,
+ agentName,
+ config,
+ "LAN"
+ );
+ } catch (error) {
+ logger.logReasoning("LAN_ERROR", {
+ url: lanUrl,
+ error: (error as Error).message,
+ errorType: (error as Error).name,
+ });
+ throw error;
+ } finally {
+ this.isProcessing = false;
+ }
+ }
+
private async processWithOpenWhispr(
text: string,
model: string,
@@ -1144,11 +1200,20 @@ class ReasoningService extends BaseReasoningService {
const cloudProviders = ["openai", "groq", "gemini", "anthropic", "custom"];
const isLocalProvider = !cloudProviders.includes(provider);
+ const settings = getSettings();
+ const isLanReasoning =
+ settings.reasoningMode === "self-hosted" &&
+ settings.remoteReasoningType === "lan" &&
+ settings.remoteReasoningUrl;
+
let endpoint: string;
let apiKey = "";
- if (isLocalProvider) {
- // Local model via llama.cpp server
+ if (isLanReasoning) {
+ const baseUrl =
+ normalizeBaseUrl(settings.remoteReasoningUrl.trim()) || settings.remoteReasoningUrl.trim();
+ endpoint = buildApiUrl(baseUrl, "/v1/chat/completions");
+ } else if (isLocalProvider) {
const serverResult = await window.electronAPI.llamaServerStart(model);
if (!serverResult.success || !serverResult.port) {
throw new Error(serverResult.error || "Failed to start local model server");
@@ -1176,7 +1241,7 @@ class ReasoningService extends BaseReasoningService {
}
const apiConfig = getOpenAiApiConfig(model);
- const useOldTokenParam = isLocalProvider || provider === "groq";
+ const useOldTokenParam = isLocalProvider || isLanReasoning || provider === "groq";
const requestBody: Record<string, unknown> = {
model,
@@ -1201,6 +1266,7 @@ class ReasoningService extends BaseReasoningService {
model,
provider,
isLocal: isLocalProvider,
+ isLan: !!isLanReasoning,
messageCount: messages.length,
});
@@ -1277,7 +1343,7 @@ class ReasoningService extends BaseReasoningService {
if (!content) continue;
// Strip Qwen3 <think> blocks from streamed output
- if (isLocalProvider) {
+ if (isLocalProvider || isLanReasoning) {
if (insideThinkBlock) {
const endIdx = content.indexOf("</think>");
if (endIdx !== -1) {
@@ -1325,7 +1391,13 @@ class ReasoningService extends BaseReasoningService {
const cloudProviders = ["openai", "groq", "gemini", "anthropic", "custom"];
const isLocalProvider = !cloudProviders.includes(provider);
- if (isLocalProvider && !tools) {
+ const settings = getSettings();
+ const isLanReasoning =
+ settings.reasoningMode === "self-hosted" &&
+ settings.remoteReasoningType === "lan" &&
+ settings.remoteReasoningUrl;
+
+ if ((isLocalProvider || isLanReasoning) && !tools) {
const contentGen = this.processTextStreaming(messages, model, provider, config);
for await (const text of contentGen) {
yield { type: "content", text };
@@ -1337,7 +1409,13 @@ class ReasoningService extends BaseReasoningService {
let apiKey = "";
let baseURL: string | undefined;
- if (isLocalProvider) {
+ if (isLanReasoning) {
+ const lanUrl = settings.remoteReasoningUrl.trim();
+ baseURL = normalizeBaseUrl(lanUrl) || lanUrl;
+ if (!baseURL.endsWith("/v1")) {
+ baseURL = buildApiUrl(baseURL, "/v1");
+ }
+ } else if (isLocalProvider) {
const serverResult = await window.electronAPI.llamaServerStart(model);
if (!serverResult.success || !serverResult.port) {
throw new Error(serverResult.error || "Failed to start local model server");
@@ -1350,7 +1428,7 @@ class ReasoningService extends BaseReasoningService {
}
const apiConfig = getOpenAiApiConfig(model);
- const aiProvider = isLocalProvider ? "local" : provider;
+ const aiProvider = isLocalProvider || isLanReasoning ? "local" : provider;
const aiModel = getAIModel(aiProvider, model, apiKey, baseURL);
const modelDef = getCloudModel(model);
@@ -1364,7 +1442,7 @@ class ReasoningService extends BaseReasoningService {
messageCount: messages.length,
});
- const useTemperature = isLocalProvider || apiConfig.supportsTemperature;
+ const useTemperature = isLocalProvider || isLanReasoning || apiConfig.supportsTemperature;
const result = streamText({
model: aiModel,
@@ -1585,6 +1663,15 @@ class ReasoningService extends BaseReasoningService {
}
const settings = getSettings();
+ if (
+ settings.reasoningMode === "self-hosted" &&
+ settings.remoteReasoningType === "lan" &&
+ settings.remoteReasoningUrl?.trim()
+ ) {
+ logger.logReasoning("API_KEY_CHECK", { lanReasoning: true });
+ return true;
+ }
+
if (settings.reasoningProvider === "custom" && settings.cloudReasoningBaseUrl?.trim()) {
logger.logReasoning("API_KEY_CHECK", {
customProvider: true,
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 228cc4f0b..392535f42 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -4,7 +4,7 @@ import i18n, { normalizeUiLanguage } from "../i18n";
import { hasStoredByokKey } from "../utils/byokDetection";
import { ensureAgentNameInDictionary } from "../utils/agentName";
import logger from "../utils/logger";
-import type { LocalTranscriptionProvider } from "../types/electron";
+import type { LocalTranscriptionProvider, InferenceMode, SelfHostedType } from "../types/electron";
import type { GoogleCalendarAccount } from "../types/calendar";
import type {
TranscriptionSettings,
@@ -84,6 +84,55 @@ function migratePreferredLanguage() {
migratePreferredLanguage();
+function migrateProviderSettings() {
+ if (!isBrowser) return;
+ if (localStorage.getItem("_providerSettingsMigrated") === "1") return;
+
+ const cloudMode = localStorage.getItem("cloudTranscriptionMode");
+ const useLocal = localStorage.getItem("useLocalWhisper") === "true";
+ const provider = localStorage.getItem("cloudTranscriptionProvider");
+
+ let transcriptionMode: InferenceMode = "openwhispr";
+ if (useLocal) {
+ transcriptionMode = "local";
+ } else if (cloudMode === "byok") {
+ transcriptionMode = provider === "custom" ? "self-hosted" : "providers";
+ }
+ localStorage.setItem("transcriptionMode", transcriptionMode);
+
+ if (provider === "custom" && cloudMode === "byok") {
+ localStorage.setItem("remoteTranscriptionType", "openai-compatible");
+ }
+
+ const reasoningMode = localStorage.getItem("cloudReasoningMode");
+ const reasoningProvider = localStorage.getItem("reasoningProvider");
+ let newReasoningMode: InferenceMode = "openwhispr";
+ if (reasoningMode === "byok") {
+ if (reasoningProvider === "custom") {
+ newReasoningMode = "self-hosted";
+ } else if (
+ reasoningProvider === "qwen" ||
+ reasoningProvider === "llama" ||
+ reasoningProvider === "mistral" ||
+ reasoningProvider === "openai-oss" ||
+ reasoningProvider === "gemma"
+ ) {
+ newReasoningMode = "local";
+ } else {
+ newReasoningMode = "providers";
+ }
+ }
+ localStorage.setItem("reasoningMode", newReasoningMode);
+
+ if (reasoningProvider === "custom" && reasoningMode === "byok") {
+ localStorage.setItem("remoteReasoningType", "openai-compatible");
+ }
+
+ localStorage.setItem("_providerSettingsMigrated", "1");
+}
+
+migrateProviderSettings();
+
export interface SettingsState
extends
TranscriptionSettings,
@@ -109,6 +158,20 @@ export interface SettingsState
noteFilesEnabled: boolean;
noteFilesPath: string;
+ transcriptionMode: InferenceMode;
+ remoteTranscriptionType: SelfHostedType;
+ remoteTranscriptionUrl: string;
+ reasoningMode: InferenceMode;
+ remoteReasoningType: SelfHostedType;
+ remoteReasoningUrl: string;
+
+ setTranscriptionMode: (mode: InferenceMode) => void;
+ setRemoteTranscriptionType: (type: SelfHostedType) => void;
+ setRemoteTranscriptionUrl: (url: string) => void;
+ setReasoningMode: (mode: InferenceMode) => void;
+ setRemoteReasoningType: (type: SelfHostedType) => void;
+ setRemoteReasoningUrl: (url: string) => void;
+
setUseLocalWhisper: (value: boolean) => void;
setWhisperModel: (value: string) => void;
setLocalTranscriptionProvider: (value: LocalTranscriptionProvider) => void;
@@ -317,6 +380,38 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
noteFilesPath: readString("noteFilesPath", ""),
isSignedIn: readBoolean("isSignedIn", false),
+ transcriptionMode: (() => {
+ const v = readString("transcriptionMode", "openwhispr");
+ if (v === "openwhispr" || v === "providers" || v === "local" || v === "self-hosted") return v;
+ return "openwhispr" as InferenceMode;
+ })(),
+ remoteTranscriptionType: (() => {
+ const v = readString("remoteTranscriptionType", "openai-compatible");
+ return v === "lan" ? "lan" : ("openai-compatible" as SelfHostedType);
+ })(),
+ remoteTranscriptionUrl: readString("remoteTranscriptionUrl", ""),
+ reasoningMode: (() => {
+ const v = readString("reasoningMode", "openwhispr");
+ if (v === "openwhispr" || v === "providers" || v === "local" || v === "self-hosted") return v;
+ return "openwhispr" as InferenceMode;
+ })(),
+ remoteReasoningType: (() => {
+ const v = readString("remoteReasoningType", "openai-compatible");
+ return v === "lan" ? "lan" : ("openai-compatible" as SelfHostedType);
+ })(),
+ remoteReasoningUrl: readString("remoteReasoningUrl", ""),
+
+ setTranscriptionMode: createStringSetter("transcriptionMode") as (mode: InferenceMode) => void,
+ setRemoteTranscriptionType: createStringSetter("remoteTranscriptionType") as (
+ type: SelfHostedType
+ ) => void,
+ setRemoteTranscriptionUrl: createStringSetter("remoteTranscriptionUrl"),
+ setReasoningMode: createStringSetter("reasoningMode") as (mode: InferenceMode) => void,
+ setRemoteReasoningType: createStringSetter("remoteReasoningType") as (
+ type: SelfHostedType
+ ) => void,
+ setRemoteReasoningUrl: createStringSetter("remoteReasoningUrl"),
+
agentModel: readString("agentModel", "openai/gpt-oss-120b"),
agentProvider: readString("agentProvider", "groq"),
agentKey: readString("agentKey", ""),
diff --git a/src/types/electron.ts b/src/types/electron.ts
index f6a17f9cd..5ad4ebdda 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1,5 +1,9 @@
export type LocalTranscriptionProvider = "whisper" | "nvidia";
+export type InferenceMode = "openwhispr" | "providers" | "local" | "self-hosted";
+
+export type SelfHostedType = "openai-compatible" | "lan";
+
export type TranscriptionStatus = "completed" | "failed" | "pending";
export interface TranscriptionItem {
@@ -350,6 +354,9 @@ declare global {
cloudTranscriptionBaseUrl?: string;
parakeetModel: string;
whisperModel: string;
+ transcriptionMode?: InferenceMode;
+ remoteTranscriptionType?: SelfHostedType;
+ remoteTranscriptionUrl?: string;
}
) => Promise<{ success: boolean; transcription?: TranscriptionItem; error?: string }>;
updateTranscriptionText: (
@@ -511,6 +518,10 @@ declare global {
// Whisper operations (whisper.cpp)
transcribeLocalWhisper: (audioBlob: Blob | ArrayBuffer, options?: any) => Promise<any>;
+ transcribeLanWhisper: (
+ audioBlob: Blob | ArrayBuffer,
+ options?: { url: string; language?: string; initialPrompt?: string }
+ ) => Promise<any>;
checkWhisperInstallation: () => Promise<WhisperCheckResult>;
downloadWhisperModel: (modelName: string) => Promise<WhisperModelResult>;
onWhisperDownloadProgress: (
@@ -1252,9 +1263,7 @@ declare global {
}>;
// Contacts
- searchContacts: (
- query: string
- ) => Promise<{
+ searchContacts: (query: string) => Promise<{
success: boolean;
contacts: Array<{ email: string; display_name: string | null }>;
}>;