Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat: unify agent mode settings with four-mode inference selector
Gabriel Stein643909628127
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex d60a6b284..405803b49 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -76,7 +76,8 @@ import { useToast } from "./ui/Toast";import { useTheme } from "../hooks/useTheme";import type { GpuDevice, LocalTranscriptionProvider, InferenceMode } from "../types/electron";import logger from "../utils/logger";-import { SettingsRow } from "./ui/SettingsSection";+import { SettingsRow, InferenceModeSelector } from "./ui/SettingsSection";+import type { InferenceModeOption } from "./ui/SettingsSection";import { useSettingsLayout } from "./ui/SidebarModal";import { useUsage } from "../hooks/useUsage";import { cn } from "./lib/utils";@@ -161,79 +162,6 @@ function SectionHeader({ title, description }: { title: string; description?: st);}-interface InferenceModeOption {- id: InferenceMode;- label: string;- description: string;- icon: React.ReactNode;-}--function InferenceModeSelector({- modes,- activeMode,- onSelect,-}: {- modes: InferenceModeOption[];- activeMode: InferenceMode;- onSelect: (mode: InferenceMode) => void;-}) {- const { t } = useTranslation();-- return (- <SettingsPanel>- {modes.map((mode) => {- const isActive = activeMode === mode.id;- return (- <SettingsPanelRow key={mode.id}>- <button- onClick={() => onSelect(mode.id)}- 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 ${- isActive- ? "bg-primary/10 dark:bg-primary/15"- : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"- }`}- >- <div- className={`transition-colors ${isActive ? "text-primary" : "text-muted-foreground"}`}- >- {mode.icon}- </div>- </div>- <div className="flex-1 min-w-0">- <div className="flex items-center gap-2">- <span className="text-xs font-medium text-foreground">{mode.label}</span>- {isActive && (- <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">{mode.description}</p>- </div>- <div- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${- isActive- ? "border-primary bg-primary"- : "border-border-hover dark:border-border-subtle"- }`}- >- {isActive && (- <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>- );- })}- </SettingsPanel>- );-}-interface TranscriptionSectionProps {isSignedIn: boolean;cloudTranscriptionMode: string;@@ -308,12 +236,7 @@ function TranscriptionSection({}: TranscriptionSectionProps) {const { t } = useTranslation();- const transcriptionModes: {- id: InferenceMode;- label: string;- description: string;- icon: React.ReactNode;- }[] = [+ const transcriptionModes: InferenceModeOption[] = [{id: "openwhispr",label: t("settingsPage.transcription.modes.openwhispr"),@@ -506,12 +429,7 @@ function AiModelsSection({}: AiModelsSectionProps) {const { t } = useTranslation();- const aiModes: {- id: InferenceMode;- label: string;- description: string;- icon: React.ReactNode;- }[] = [+ const aiModes: InferenceModeOption[] = [{id: "openwhispr",label: t("settingsPage.aiModels.modes.openwhispr"),diff --git a/src/components/chat/useChatStreaming.ts b/src/components/chat/useChatStreaming.tsindex ee99bff30..0760f860c 100644--- a/src/components/chat/useChatStreaming.ts+++ b/src/components/chat/useChatStreaming.ts@@ -94,7 +94,9 @@ export function useChatStreaming({setAgentState("thinking");const settings = getSettings();- const isCloudAgent = settings.isSignedIn && settings.cloudAgentMode === "openwhispr";+ const agentMode = settings.agentInferenceMode || "openwhispr";+ const isCloudAgent = agentMode === "openwhispr" && settings.isSignedIn;+ const isLanAgent = agentMode === "self-hosted" && !!settings.remoteAgentUrl;const isLocalProvider = !["openai", "groq", "custom", "anthropic", "gemini"].includes(settings.agentProvider);@@ -187,7 +189,7 @@ export function useChatStreaming({llmMessages,settings.agentModel,settings.agentProvider,- { systemPrompt },+ { systemPrompt, lanUrl: isLanAgent ? settings.remoteAgentUrl : undefined },aiTools);}diff --git a/src/components/settings/AgentModeSettings.tsx b/src/components/settings/AgentModeSettings.tsxindex 794564c6a..37f879768 100644--- a/src/components/settings/AgentModeSettings.tsx+++ b/src/components/settings/AgentModeSettings.tsx@@ -1,12 +1,21 @@import { useCallback } from "react";import { useTranslation } from "react-i18next";-import { Cloud, Key } from "lucide-react";+import { Cloud, Key, Cpu, Network } from "lucide-react";import { useSettingsStore } from "../../stores/settingsStore";import { HotkeyInput } from "../ui/HotkeyInput";import { Toggle } from "../ui/toggle";-import { SettingsRow, SettingsPanel, SettingsPanelRow, SectionHeader } from "../ui/SettingsSection";+import {+ SettingsRow,+ SettingsPanel,+ SettingsPanelRow,+ SectionHeader,+ InferenceModeSelector,+} from "../ui/SettingsSection";+import type { InferenceModeOption } from "../ui/SettingsSection";import ReasoningModelSelector from "../ReasoningModelSelector";+import SelfHostedPanel from "../SelfHostedPanel";import { validateHotkeyForSlot } from "../../utils/hotkeyValidation";+import type { InferenceMode } from "../../types/electron";export default function AgentModeSettings() {const { t } = useTranslation();@@ -25,6 +34,10 @@ export default function AgentModeSettings() {setAgentSystemPrompt,cloudAgentMode,setCloudAgentMode,+ agentInferenceMode,+ setAgentInferenceMode,+ remoteAgentUrl,+ setRemoteAgentUrl,isSignedIn,openaiApiKey,setOpenaiApiKey,@@ -40,9 +53,6 @@ export default function AgentModeSettings() {setCloudReasoningBaseUrl,} = useSettingsStore();- const isCloudMode = isSignedIn && cloudAgentMode === "openwhispr";- const isCustomMode = cloudAgentMode === "byok";-const validateAgentHotkey = useCallback((hotkey: string) =>validateHotkeyForSlot(@@ -56,6 +66,64 @@ export default function AgentModeSettings() {[dictationKey, meetingKey, t]);+ const agentModes: InferenceModeOption[] = [+ {+ id: "openwhispr",+ label: t("agentMode.settings.modes.openwhispr"),+ description: t("agentMode.settings.modes.openwhisprDesc"),+ icon: <Cloud className="w-4 h-4" />,+ },+ {+ id: "providers",+ label: t("agentMode.settings.modes.providers"),+ description: t("agentMode.settings.modes.providersDesc"),+ icon: <Key className="w-4 h-4" />,+ },+ {+ id: "local",+ label: t("agentMode.settings.modes.local"),+ description: t("agentMode.settings.modes.localDesc"),+ icon: <Cpu className="w-4 h-4" />,+ },+ {+ id: "self-hosted",+ label: t("agentMode.settings.modes.selfHosted"),+ description: t("agentMode.settings.modes.selfHostedDesc"),+ icon: <Network className="w-4 h-4" />,+ },+ ];++ const handleAgentModeSelect = (mode: InferenceMode) => {+ if (mode === agentInferenceMode) return;+ setAgentInferenceMode(mode);+ setCloudAgentMode(mode === "openwhispr" ? "openwhispr" : "byok");+ if (mode === "openwhispr" || mode === "self-hosted") {+ window.electronAPI?.llamaServerStop?.();+ }+ };++ const renderModelSelector = (mode?: "cloud" | "local") => (+ <ReasoningModelSelector+ reasoningModel={agentModel}+ setReasoningModel={setAgentModel}+ localReasoningProvider={agentProvider}+ setLocalReasoningProvider={setAgentProvider}+ 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-6"><SectionHeader@@ -63,7 +131,6 @@ export default function AgentModeSettings() {description={t("agentMode.settings.description")}/>- {/* Enable/Disable */}<SettingsPanel><SettingsPanelRow><SettingsRow@@ -77,7 +144,6 @@ export default function AgentModeSettings() {{agentEnabled && (<>- {/* Agent Hotkey */}<div><SectionHeadertitle={t("agentMode.settings.hotkey")}@@ -86,141 +152,29 @@ export default function AgentModeSettings() {<HotkeyInput value={agentKey} onChange={setAgentKey} validate={validateAgentHotkey} /></div>- {/* Cloud / BYOK toggle */}- {isSignedIn && (- <SettingsPanel>- <SettingsPanelRow>- <button- onClick={() => {- if (!isCloudMode) setCloudAgentMode("openwhispr");- }}- 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("agentMode.settings.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("agentMode.settings.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) setCloudAgentMode("byok");- }}- 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("agentMode.settings.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("agentMode.settings.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>- )}-- {/* Model selector — shown when Custom Setup is active or not signed in */}- {(isCustomMode || !isSignedIn) && (- <div>- <SectionHeader- title={t("agentMode.settings.model")}- description={t("agentMode.settings.modelDescription")}+ {isSignedIn ? (+ <>+ <InferenceModeSelector+ modes={agentModes}+ activeMode={agentInferenceMode}+ onSelect={handleAgentModeSelect}/>- <ReasoningModelSelector- reasoningModel={agentModel}- setReasoningModel={setAgentModel}- localReasoningProvider={agentProvider}- setLocalReasoningProvider={setAgentProvider}- cloudReasoningBaseUrl={cloudReasoningBaseUrl}- setCloudReasoningBaseUrl={setCloudReasoningBaseUrl}- openaiApiKey={openaiApiKey}- setOpenaiApiKey={setOpenaiApiKey}- anthropicApiKey={anthropicApiKey}- setAnthropicApiKey={setAnthropicApiKey}- geminiApiKey={geminiApiKey}- setGeminiApiKey={setGeminiApiKey}- groqApiKey={groqApiKey}- setGroqApiKey={setGroqApiKey}- customReasoningApiKey={customReasoningApiKey}- setCustomReasoningApiKey={setCustomReasoningApiKey}- />- </div>++ {agentInferenceMode === "providers" && renderModelSelector("cloud")}+ {agentInferenceMode === "local" && renderModelSelector("local")}++ {agentInferenceMode === "self-hosted" && (+ <SelfHostedPanel+ service="reasoning"+ url={remoteAgentUrl}+ onUrlChange={setRemoteAgentUrl}+ />+ )}+ </>+ ) : (+ renderModelSelector())}- {/* Custom System Prompt */}<div><SectionHeadertitle={t("agentMode.settings.systemPrompt")}diff --git a/src/components/ui/SettingsSection.tsx b/src/components/ui/SettingsSection.tsxindex daf4c9e9a..bc0e44f2e 100644--- a/src/components/ui/SettingsSection.tsx+++ b/src/components/ui/SettingsSection.tsx@@ -1,5 +1,7 @@import React from "react";+import { useTranslation } from "react-i18next";import { useSettingsLayout } from "./SidebarModal";+import type { InferenceMode } from "../../types/electron";interface SettingsSectionProps {title: string;@@ -126,3 +128,76 @@ export function SectionHeader({ title, description }: { title: string; descripti</div>);}++export interface InferenceModeOption {+ id: InferenceMode;+ label: string;+ description: string;+ icon: React.ReactNode;+}++export function InferenceModeSelector({+ modes,+ activeMode,+ onSelect,+}: {+ modes: InferenceModeOption[];+ activeMode: InferenceMode;+ onSelect: (mode: InferenceMode) => void;+}) {+ const { t } = useTranslation();++ return (+ <SettingsPanel>+ {modes.map((mode) => {+ const isActive = activeMode === mode.id;+ return (+ <SettingsPanelRow key={mode.id}>+ <button+ onClick={() => onSelect(mode.id)}+ 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 ${+ isActive+ ? "bg-primary/10 dark:bg-primary/15"+ : "bg-muted/60 dark:bg-surface-raised group-hover:bg-muted dark:group-hover:bg-surface-3"+ }`}+ >+ <div+ className={`transition-colors ${isActive ? "text-primary" : "text-muted-foreground"}`}+ >+ {mode.icon}+ </div>+ </div>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2">+ <span className="text-xs font-medium text-foreground">{mode.label}</span>+ {isActive && (+ <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">{mode.description}</p>+ </div>+ <div+ className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${+ isActive+ ? "border-primary bg-primary"+ : "border-border-hover dark:border-border-subtle"+ }`}+ >+ {isActive && (+ <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>+ );+ })}+ </SettingsPanel>+ );+}diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 61d7b3ac9..454ed7168 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -75,6 +75,8 @@ export interface AgentModeSettings {agentSystemPrompt: string;agentEnabled: boolean;cloudAgentMode: string;+ agentInferenceMode: InferenceMode;+ remoteAgentUrl: string;}function useSettingsInternal() {diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 4c28f49ea..860aa2464 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "System-Prompt","systemPromptDescription": "Benutzerdefinierte Anweisungen für den Agenten","systemPromptPlaceholder": "Benutzerdefinierten System-Prompt eingeben...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Cloud-Anbieter",+ "local": "Lokal",+ "selfHosted": "Selbst gehostet",+ "openwhisprDesc": "Funktioniert sofort. Keine Einrichtung nötig.",+ "providersDesc": "Eigenen API-Schlüssel verwenden.",+ "localDesc": "Modelle auf dem Gerät. Vollständig privat.",+ "selfHostedDesc": "Eigener Server in Ihrem Netzwerk."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "OpenWhisprs Cloud-KI für Agent-Unterhaltungen verwenden","customSetup": "Eigene Konfiguration (BYOK)",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 4dcca2f6d..be01adf76 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1996,6 +1996,16 @@"systemPrompt": "System Prompt","systemPromptDescription": "Custom instructions for the agent","systemPromptPlaceholder": "Enter custom system prompt...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Cloud Providers",+ "local": "Local",+ "selfHosted": "Self-Hosted",+ "openwhisprDesc": "Just works. No setup needed.",+ "providersDesc": "Bring your own API key.",+ "localDesc": "On-device models. Fully private.",+ "selfHostedDesc": "Your own server on your network."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Use OpenWhispr's cloud AI for agent conversations","customSetup": "Custom Setup (BYOK)",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex f26c6a6cc..e8a68c541 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "Prompt del Sistema","systemPromptDescription": "Instrucciones personalizadas para el agente","systemPromptPlaceholder": "Introduce un prompt de sistema personalizado...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Proveedores Cloud",+ "local": "Local",+ "selfHosted": "Autoalojado",+ "openwhisprDesc": "Funciona de inmediato. Sin configuración.",+ "providersDesc": "Trae tu propia clave API.",+ "localDesc": "Modelos en el dispositivo. Totalmente privado.",+ "selfHostedDesc": "Tu propio servidor en tu red."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Usar la IA en la nube de OpenWhispr para conversaciones del agente","customSetup": "Configuración personalizada (BYOK)",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 7c2e9e29a..d382bd25a 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "Prompt système","systemPromptDescription": "Instructions personnalisées pour l'agent","systemPromptPlaceholder": "Entrez un prompt système personnalisé...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Fournisseurs Cloud",+ "local": "Local",+ "selfHosted": "Auto-hébergé",+ "openwhisprDesc": "Fonctionne directement. Aucune configuration.",+ "providersDesc": "Apportez votre propre clé API.",+ "localDesc": "Modèles sur l'appareil. Entièrement privé.",+ "selfHostedDesc": "Votre propre serveur sur votre réseau."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Utiliser l'IA cloud d'OpenWhispr pour les conversations agent","customSetup": "Configuration personnalisée (BYOK)",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 64343c7e2..62df92534 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "Prompt di Sistema","systemPromptDescription": "Istruzioni personalizzate per l'agente","systemPromptPlaceholder": "Inserisci un prompt di sistema personalizzato...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Provider Cloud",+ "local": "Locale",+ "selfHosted": "Self-Hosted",+ "openwhisprDesc": "Funziona subito. Nessuna configurazione.",+ "providersDesc": "Porta la tua chiave API.",+ "localDesc": "Modelli sul dispositivo. Completamente privato.",+ "selfHostedDesc": "Il tuo server sulla tua rete."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Usa l'IA cloud di OpenWhispr per le conversazioni agente","customSetup": "Configurazione personalizzata (BYOK)",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 18361b3fc..a78e03fae 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "システムプロンプト","systemPromptDescription": "エージェントへのカスタム指示","systemPromptPlaceholder": "カスタムシステムプロンプトを入力...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "クラウドプロバイダー",+ "local": "ローカル",+ "selfHosted": "セルフホスト",+ "openwhisprDesc": "設定不要ですぐに使えます。",+ "providersDesc": "独自のAPIキーを使用。",+ "localDesc": "デバイス上のモデル。完全プライベート。",+ "selfHostedDesc": "ネットワーク上の自分のサーバー。"+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "OpenWhisprのクラウドAIをエージェント会話に使用する","customSetup": "カスタム設定 (BYOK)",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 68f0fe55b..5c9bda30c 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "Prompt do Sistema","systemPromptDescription": "Instruções personalizadas para o agente","systemPromptPlaceholder": "Digite um prompt de sistema personalizado...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Provedores Cloud",+ "local": "Local",+ "selfHosted": "Auto-hospedado",+ "openwhisprDesc": "Funciona de imediato. Sem configuração.",+ "providersDesc": "Traga sua própria chave API.",+ "localDesc": "Modelos no dispositivo. Totalmente privado.",+ "selfHostedDesc": "Seu próprio servidor na sua rede."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Usar a IA na nuvem da OpenWhispr para conversas do agente","customSetup": "Configuração personalizada (BYOK)",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 9d57f8ef2..3a79cc175 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1948,6 +1948,16 @@"systemPrompt": "Системный промпт","systemPromptDescription": "Пользовательские инструкции для агента","systemPromptPlaceholder": "Введите пользовательский системный промпт...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "Облачные провайдеры",+ "local": "Локально",+ "selfHosted": "Свой сервер",+ "openwhisprDesc": "Просто работает. Настройка не нужна.",+ "providersDesc": "Свой API-ключ.",+ "localDesc": "Модели на устройстве. Полная приватность.",+ "selfHostedDesc": "Ваш сервер в вашей сети."+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "Использовать облачный ИИ OpenWhispr для разговоров с агентом","customSetup": "Своя настройка (BYOK)",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 1efd51aef..b8787588b 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1943,6 +1943,16 @@"systemPrompt": "系统提示词","systemPromptDescription": "助手的自定义指令","systemPromptPlaceholder": "输入自定义系统提示词...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "云服务商",+ "local": "本地",+ "selfHosted": "自托管",+ "openwhisprDesc": "开箱即用,无需设置。",+ "providersDesc": "使用自己的 API 密钥。",+ "localDesc": "设备端模型,完全私密。",+ "selfHostedDesc": "你自己网络上的服务器。"+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "使用 OpenWhispr 的云端 AI 进行助手对话","customSetup": "自定义配置 (BYOK)",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex d9751cdf6..4b5be5070 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1943,6 +1943,16 @@"systemPrompt": "系統提示詞","systemPromptDescription": "助手的自訂指令","systemPromptPlaceholder": "輸入自訂系統提示詞...",+ "modes": {+ "openwhispr": "OpenWhispr",+ "providers": "雲端供應商",+ "local": "本機",+ "selfHosted": "自架主機",+ "openwhisprDesc": "即開即用,無需設定。",+ "providersDesc": "使用自己的 API 金鑰。",+ "localDesc": "裝置端模型,完全私密。",+ "selfHostedDesc": "你自己網路上的伺服器。"+ },"openwhisprCloud": "OpenWhispr Cloud","openwhisprCloudDescription": "使用 OpenWhispr 的雲端 AI 進行助手對話","customSetup": "自訂配置 (BYOK)",diff --git a/src/services/BaseReasoningService.ts b/src/services/BaseReasoningService.tsindex 67c794005..fafcb0786 100644--- a/src/services/BaseReasoningService.ts+++ b/src/services/BaseReasoningService.ts@@ -6,6 +6,7 @@ export interface ReasoningConfig {temperature?: number;contextSize?: number;systemPrompt?: string;+ lanUrl?: string;}export abstract class BaseReasoningService {diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex 1304e36a1..13f829cc8 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -446,7 +446,7 @@ class ReasoningService extends BaseReasoningService {let result: string;const startTime = Date.now();- const isLanReasoning = this.isLanReasoningMode();+ const isLanReasoning = !!config.lanUrl || this.isLanReasoningMode();logger.logReasoning("ROUTING_TO_PROVIDER", {provider,@@ -1092,7 +1092,7 @@ class ReasoningService extends BaseReasoningService {config: ReasoningConfig = {}): Promise<string> {const settings = getSettings();- const lanUrl = settings.remoteReasoningUrl.trim();+ const lanUrl = (config.lanUrl || settings.remoteReasoningUrl).trim();logger.logReasoning("LAN_START", { url: lanUrl, agentName });@@ -1206,14 +1206,15 @@ class ReasoningService extends BaseReasoningService {const isLocalProvider = !cloudProviders.includes(provider);const settings = getSettings();- const isLanReasoning = this.isLanReasoningMode();+ const lanOverride = config.lanUrl?.trim();+ const isLanReasoning = !!lanOverride || this.isLanReasoningMode();let endpoint: string;let apiKey = "";if (isLanReasoning) {- const baseUrl =- normalizeBaseUrl(settings.remoteReasoningUrl.trim()) || settings.remoteReasoningUrl.trim();+ const rawUrl = lanOverride || settings.remoteReasoningUrl.trim();+ const baseUrl = normalizeBaseUrl(rawUrl) || rawUrl;endpoint = buildApiUrl(baseUrl, "/v1/chat/completions");} else if (isLocalProvider) {const serverResult = await window.electronAPI.llamaServerStart(model);@@ -1394,7 +1395,8 @@ class ReasoningService extends BaseReasoningService {const isLocalProvider = !cloudProviders.includes(provider);const settings = getSettings();- const isLanReasoning = this.isLanReasoningMode();+ const lanOverride = config.lanUrl?.trim();+ const isLanReasoning = !!lanOverride || this.isLanReasoningMode();if ((isLocalProvider || isLanReasoning) && !tools) {const contentGen = this.processTextStreaming(messages, model, provider, config);@@ -1409,8 +1411,8 @@ class ReasoningService extends BaseReasoningService {let baseURL: string | undefined;if (isLanReasoning) {- const lanUrl = settings.remoteReasoningUrl.trim();- baseURL = normalizeBaseUrl(lanUrl) || lanUrl;+ const rawUrl = lanOverride || settings.remoteReasoningUrl.trim();+ baseURL = normalizeBaseUrl(rawUrl) || rawUrl;if (!baseURL.endsWith("/v1")) {baseURL = buildApiUrl(baseURL, "/v1");}diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex 38e76e046..0eeb0e66b 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -133,6 +133,31 @@ function migrateProviderSettings() {migrateProviderSettings();+function migrateAgentMode() {+ if (!isBrowser) return;+ if (localStorage.getItem("_agentModeMigrated") === "1") return;++ const cloudAgentMode = localStorage.getItem("cloudAgentMode");+ const agentProvider = localStorage.getItem("agentProvider");++ let agentInferenceMode: InferenceMode = "openwhispr";+ if (cloudAgentMode === "byok") {+ const localProviders = ["qwen", "llama", "mistral", "openai-oss", "gemma"];+ if (agentProvider === "custom") {+ agentInferenceMode = "self-hosted";+ } else if (agentProvider && localProviders.includes(agentProvider)) {+ agentInferenceMode = "local";+ } else {+ agentInferenceMode = "providers";+ }+ }+ localStorage.setItem("agentInferenceMode", agentInferenceMode);++ localStorage.setItem("_agentModeMigrated", "1");+}++migrateAgentMode();+export interface SettingsStateextendsTranscriptionSettings,@@ -232,6 +257,8 @@ export interface SettingsStatesetAgentSystemPrompt: (value: string) => void;setAgentEnabled: (value: boolean) => void;setCloudAgentMode: (value: string) => void;+ setAgentInferenceMode: (mode: InferenceMode) => void;+ setRemoteAgentUrl: (url: string) => void;updateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => void;updateReasoningSettings: (settings: Partial<ReasoningSettings>) => void;@@ -418,6 +445,12 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({agentSystemPrompt: readString("agentSystemPrompt", ""),agentEnabled: readBoolean("agentEnabled", true),cloudAgentMode: readString("cloudAgentMode", "openwhispr"),+ agentInferenceMode: (() => {+ const v = readString("agentInferenceMode", "openwhispr");+ if (v === "openwhispr" || v === "providers" || v === "local" || v === "self-hosted") return v;+ return "openwhispr" as InferenceMode;+ })(),+ remoteAgentUrl: readString("remoteAgentUrl", ""),setUseLocalWhisper: createBooleanSetter("useLocalWhisper"),setWhisperModel: createStringSetter("whisperModel"),@@ -654,6 +687,8 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({setAgentSystemPrompt: createStringSetter("agentSystemPrompt"),setAgentEnabled: createBooleanSetter("agentEnabled"),setCloudAgentMode: createStringSetter("cloudAgentMode"),+ setAgentInferenceMode: createStringSetter("agentInferenceMode") as (mode: InferenceMode) => void,+ setRemoteAgentUrl: createStringSetter("remoteAgentUrl"),updateTranscriptionSettings: (settings: Partial<TranscriptionSettings>) => {const s = useSettingsStore.getState();