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: allow usrs to retain their settings on pro
Gabriel Stein2470316505d6
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex c1be697dc..4996d08d4 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -9,6 +9,7 @@ import {RefreshCw,Loader2,Sparkles,+ Cloud,X,} from "lucide-react";import SettingsModal, { SettingsSectionType } from "./SettingsModal";@@ -22,6 +23,7 @@ import { useHotkey } from "../hooks/useHotkey";import { useToast } from "./ui/Toast";import { useUpdater } from "../hooks/useUpdater";import { useSettings } from "../hooks/useSettings";+import { useAuth } from "../hooks/useAuth";import {useTranscriptions,initializeTranscriptions,@@ -39,9 +41,12 @@ export default function ControlPanel() {const hasShownUpgradePrompt = useRef(false);const [settingsSection, setSettingsSection] = useState<SettingsSectionType | undefined>();const [aiCTADismissed, setAiCTADismissed] = useState(false);+ const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);+ const cloudMigrationProcessed = useRef(false);const { hotkey } = useHotkey();const { toast } = useToast();- const { useReasoningModel } = useSettings();+ const { useReasoningModel, setUseLocalWhisper, setCloudTranscriptionMode } = useSettings();+ const { isSignedIn, isLoaded: authLoaded } = useAuth();// Use centralized updater hook to prevent EventEmitter memory leaksconst {@@ -113,6 +118,20 @@ export default function ControlPanel() {};}, [toast]);+ // Switch existing users to OpenWhispr Cloud after account creation+ useEffect(() => {+ if (!authLoaded || !isSignedIn || cloudMigrationProcessed.current) return;+ const isPending = localStorage.getItem("pendingCloudMigration") === "true";+ const alreadyShown = localStorage.getItem("cloudMigrationShown") === "true";+ if (!isPending || alreadyShown) return;++ cloudMigrationProcessed.current = true;+ setUseLocalWhisper(false);+ setCloudTranscriptionMode("openwhispr");+ localStorage.removeItem("pendingCloudMigration");+ setShowCloudMigrationBanner(true);+ }, [authLoaded, isSignedIn, setUseLocalWhisper, setCloudTranscriptionMode]);+const loadTranscriptions = async () => {try {setIsLoading(true);@@ -363,6 +382,47 @@ export default function ControlPanel() {)}</div>+ {/* Cloud Migration Notice */}+ {showCloudMigrationBanner && (+ <div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">+ <button+ onClick={() => {+ setShowCloudMigrationBanner(false);+ localStorage.setItem("cloudMigrationShown", "true");+ }}+ className="absolute top-2 right-2 p-1 rounded-sm text-muted-foreground hover:text-foreground hover:bg-black/5 dark:hover:bg-white/5 transition-colors"+ >+ <X size={14} />+ </button>+ <div className="flex items-start gap-3 pr-6">+ <div className="shrink-0 w-8 h-8 rounded-md bg-primary/10 dark:bg-primary/20 flex items-center justify-center">+ <Cloud size={16} className="text-primary" />+ </div>+ <div className="flex-1 min-w-0">+ <p className="text-[13px] font-medium text-foreground mb-0.5">+ Welcome to OpenWhispr Pro+ </p>+ <p className="text-[12px] text-muted-foreground mb-2">+ Your 7-day free trial is active! We've switched your transcription to OpenWhispr Cloud for faster, more accurate results. Your previous settings are saved — switch back anytime in Settings.+ </p>+ <Button+ variant="default"+ size="sm"+ className="h-7 text-[11px]"+ onClick={() => {+ setShowCloudMigrationBanner(false);+ localStorage.setItem("cloudMigrationShown", "true");+ setSettingsSection("transcription");+ setShowSettings(true);+ }}+ >+ View Settings+ </Button>+ </div>+ </div>+ </div>+ )}+{/* AI Enhancement CTA */}{!useReasoningModel && !aiCTADismissed && (<div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3">diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 6464e9ea1..6a51fcc33 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -16,7 +16,6 @@ import {Monitor,Cloud,Key,- ChevronDown,Sparkles,} from "lucide-react";import { useAuth } from "../hooks/useAuth";@@ -172,22 +171,17 @@ function TranscriptionSection({setCloudTranscriptionBaseUrl,toast,}: TranscriptionSectionProps) {- const [advancedOpen, setAdvancedOpen] = useState(false);-- // Determine if we're in "advanced" mode (BYOK or local)- const isAdvancedMode = cloudTranscriptionMode === "byok" || useLocalWhisper;-- // When user is signed in and using OpenWhispr Cloud, keep it simple+ const isCustomMode = cloudTranscriptionMode === "byok" || useLocalWhisper;const isCloudMode = isSignedIn && cloudTranscriptionMode === "openwhispr" && !useLocalWhisper;return (- <div className="space-y-5">+ <div className="space-y-4"><SectionHeadertitle="Speech to Text"description="Choose how OpenWhispr transcribes your voice"/>- {/* Primary option: OpenWhispr Cloud */}+ {/* Mode selector */}{isSignedIn && (<SettingsPanel><SettingsPanelRow>@@ -197,7 +191,6 @@ function TranscriptionSection({setCloudTranscriptionMode("openwhispr");setUseLocalWhisper(false);updateTranscriptionSettings({ useLocalWhisper: false });- setAdvancedOpen(false);toast({title: "Switched to OpenWhispr Cloud",description: "Transcription will use OpenWhispr's cloud service.",@@ -249,135 +242,335 @@ function TranscriptionSection({</div></button></SettingsPanelRow>+ <SettingsPanelRow>+ <button+ onClick={() => {+ if (!isCustomMode) {+ setCloudTranscriptionMode("byok");+ setUseLocalWhisper(false);+ updateTranscriptionSettings({ useLocalWhisper: false });+ toast({+ title: "Switched to Custom Setup",+ description: "Configure your own provider and API key.",+ 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-[12px] font-medium text-foreground">Custom Setup</span>+ {isCustomMode && (+ <span className="text-[10px] font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">+ Active+ </span>+ )}+ </div>+ <p className="text-[11px] text-muted-foreground/80 mt-0.5">+ Use your own provider and API key.+ </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>)}- {/* Advanced section */}- <div>- <button- onClick={() => setAdvancedOpen(!advancedOpen)}- className="flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground hover:text-foreground transition-colors cursor-pointer mb-3"- >- <ChevronDown- className={`w-3.5 h-3.5 transition-transform duration-200 ${- advancedOpen || isAdvancedMode ? "rotate-0" : "-rotate-90"- }`}- />- Advanced- {isAdvancedMode && (- <span className="text-[10px] font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm ml-1">- Active- </span>- )}- </button>+ {/* 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}+ customTranscriptionApiKey={customTranscriptionApiKey}+ setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}+ cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}+ setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}+ variant="settings"+ />+ )}+ </div>+ );+}- {(advancedOpen || isAdvancedMode) && (- <div className="space-y-3">- {isSignedIn && (- <SettingsPanel>- <SettingsPanelRow>- <button- onClick={() => {- if (cloudTranscriptionMode !== "byok" || useLocalWhisper) {- setCloudTranscriptionMode("byok");- setUseLocalWhisper(false);- updateTranscriptionSettings({ useLocalWhisper: false });- toast({- title: "Switched to Bring Your Own Key",- description: "You'll need to provide your own API key for transcription.",- variant: "success",- duration: 3000,- });- }- }}- className="w-full flex items-center gap-3 text-left cursor-pointer group"+// ── AI Models section (extracted for clarity) ───────────────────────++interface AiModelsSectionProps {+ isSignedIn: boolean;+ cloudReasoningMode: string;+ setCloudReasoningMode: (mode: string) => void;+ useReasoningModel: boolean;+ setUseReasoningModel: (value: boolean) => void;+ reasoningModel: string;+ setReasoningModel: (model: string) => void;+ reasoningProvider: string;+ setReasoningProvider: (provider: string) => void;+ cloudReasoningBaseUrl: string;+ setCloudReasoningBaseUrl: (url: string) => void;+ openaiApiKey: string;+ setOpenaiApiKey: (key: string) => void;+ anthropicApiKey: string;+ setAnthropicApiKey: (key: string) => void;+ geminiApiKey: string;+ setGeminiApiKey: (key: string) => void;+ groqApiKey: string;+ setGroqApiKey: (key: string) => void;+ customReasoningApiKey: string;+ setCustomReasoningApiKey: (key: string) => void;+ showAlertDialog: (dialog: { title: string; description: string }) => void;+ toast: (opts: {+ title: string;+ description: string;+ variant?: string;+ duration?: number;+ }) => void;+}++function AiModelsSection({+ isSignedIn,+ cloudReasoningMode,+ setCloudReasoningMode,+ useReasoningModel,+ setUseReasoningModel,+ reasoningModel,+ setReasoningModel,+ reasoningProvider,+ setReasoningProvider,+ cloudReasoningBaseUrl,+ setCloudReasoningBaseUrl,+ openaiApiKey,+ setOpenaiApiKey,+ anthropicApiKey,+ setAnthropicApiKey,+ geminiApiKey,+ setGeminiApiKey,+ groqApiKey,+ setGroqApiKey,+ customReasoningApiKey,+ setCustomReasoningApiKey,+ showAlertDialog,+ toast,+}: AiModelsSectionProps) {+ const isCustomMode = cloudReasoningMode === "byok";+ const isCloudMode = isSignedIn && cloudReasoningMode === "openwhispr";++ return (+ <div className="space-y-4">+ <SectionHeader+ title="AI Text Enhancement"+ description="Clean up transcriptions, handle commands, and fix errors while preserving your tone."+ />++ {/* Enable toggle — always at top */}+ <SettingsPanel>+ <SettingsPanelRow>+ <SettingsRow label="Enable text cleanup" description="AI improves transcription quality">+ <Toggle+ checked={useReasoningModel}+ onChange={setUseReasoningModel}+ />+ </SettingsRow>+ </SettingsPanelRow>+ </SettingsPanel>++ {useReasoningModel && (+ <>+ {/* Mode selector */}+ {isSignedIn && (+ <SettingsPanel>+ <SettingsPanelRow>+ <button+ onClick={() => {+ if (!isCloudMode) {+ setCloudReasoningMode("openwhispr");+ toast({+ title: "Switched to OpenWhispr Cloud",+ description: "AI text enhancement will use OpenWhispr's cloud service.",+ 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"+ }`}>- <div- className={`w-8 h-8 rounded-md flex items-center justify-center shrink-0 transition-colors ${- cloudTranscriptionMode === "byok" && !useLocalWhisper- ? "bg-accent/10 dark:bg-accent/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"}`}- >- <Key- className={`w-4 h-4 transition-colors ${- cloudTranscriptionMode === "byok" && !useLocalWhisper- ? "text-accent"- : "text-muted-foreground"- }`}- />- </div>- <div className="flex-1 min-w-0">- <div className="flex items-center gap-2">- <span className="text-[12px] font-medium text-foreground">- Bring Your Own Key+ />+ </div>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2">+ <span className="text-[12px] font-medium text-foreground">OpenWhispr Cloud</span>+ {isCloudMode && (+ <span className="text-[10px] font-medium text-primary bg-primary/10 dark:bg-primary/15 px-1.5 py-px rounded-sm">+ Active</span>- {cloudTranscriptionMode === "byok" && !useLocalWhisper && (- <span className="text-[10px] font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">- Active- </span>- )}- </div>- <p className="text-[11px] text-muted-foreground/80 mt-0.5">- Use your own API key. No usage limits.- </p>+ )}</div>- <div- className={`w-4 h-4 rounded-full border-2 shrink-0 transition-colors ${- cloudTranscriptionMode === "byok" && !useLocalWhisper- ? "border-accent bg-accent"- : "border-border-hover dark:border-border-subtle"+ <p className="text-[11px] text-muted-foreground/80 mt-0.5">+ Just works. No configuration needed.+ </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: "Switched to Custom Setup",+ description: "Configure your own provider and API key.",+ 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"}`}- >- {cloudTranscriptionMode === "byok" && !useLocalWhisper && (- <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>+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-2">+ <span className="text-[12px] font-medium text-foreground">Custom Setup</span>+ {isCustomMode && (+ <span className="text-[10px] font-medium text-accent bg-accent/10 dark:bg-accent/15 px-1.5 py-px rounded-sm">+ Active+ </span>)}</div>- </button>- </SettingsPanelRow>- </SettingsPanel>- )}+ <p className="text-[11px] text-muted-foreground/80 mt-0.5">+ Use your own provider and API key.+ </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>+ )}- <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");- }- }}+ {/* Custom Setup model picker — shown when Custom Setup is active or not signed in */}+ {(isCustomMode || !isSignedIn) && (+ <ReasoningModelSelector+ useReasoningModel={useReasoningModel}+ setUseReasoningModel={setUseReasoningModel}+ 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}- customTranscriptionApiKey={customTranscriptionApiKey}- setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}- cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}- setCloudTranscriptionBaseUrl={setCloudTranscriptionBaseUrl}- variant="settings"+ customReasoningApiKey={customReasoningApiKey}+ setCustomReasoningApiKey={setCustomReasoningApiKey}+ showAlertDialog={showAlertDialog}/>- </div>- )}- </div>+ )}+ </>+ )}</div>);}@@ -443,6 +636,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageupdateReasoningSettings,cloudTranscriptionMode,setCloudTranscriptionMode,+ cloudReasoningMode,+ setCloudReasoningMode,cloudBackupEnabled,setCloudBackupEnabled,telemetryEnabled,@@ -933,6 +1128,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage</div><ButtononClick={() => {+ localStorage.setItem("pendingCloudMigration", "true");localStorage.removeItem("onboardingCompleted");localStorage.setItem("onboardingCurrentStep", "0");window.location.reload();@@ -1409,53 +1605,34 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage// ───────────────────────────────────────────────────case "aiModels":return (- <div className="space-y-5">- <SectionHeader- title="AI Text Enhancement"- description='Configure how AI models clean up and format your transcriptions. Handles commands like "scratch that", creates proper lists, and fixes errors while preserving your natural tone.'- />-- {isSignedIn && cloudTranscriptionMode === "openwhispr" ? (- <SettingsPanel>- <SettingsPanelRow>- <SettingsRow label="Clean up transcriptions" description="Powered by OpenWhispr">- <Toggle- checked={useReasoningModel}- onChange={(value) => {- setUseReasoningModel(value);- updateReasoningSettings({ useReasoningModel: value });- }}- />- </SettingsRow>- </SettingsPanelRow>- </SettingsPanel>- ) : (- <ReasoningModelSelector- useReasoningModel={useReasoningModel}- setUseReasoningModel={(value) => {- setUseReasoningModel(value);- updateReasoningSettings({ useReasoningModel: value });- }}- setCloudReasoningBaseUrl={setCloudReasoningBaseUrl}- cloudReasoningBaseUrl={cloudReasoningBaseUrl}- reasoningModel={reasoningModel}- setReasoningModel={setReasoningModel}- localReasoningProvider={reasoningProvider}- setLocalReasoningProvider={setReasoningProvider}- openaiApiKey={openaiApiKey}- setOpenaiApiKey={setOpenaiApiKey}- anthropicApiKey={anthropicApiKey}- setAnthropicApiKey={setAnthropicApiKey}- geminiApiKey={geminiApiKey}- setGeminiApiKey={setGeminiApiKey}- groqApiKey={groqApiKey}- setGroqApiKey={setGroqApiKey}- customReasoningApiKey={customReasoningApiKey}- setCustomReasoningApiKey={setCustomReasoningApiKey}- showAlertDialog={showAlertDialog}- />- )}- </div>+ <AiModelsSection+ isSignedIn={isSignedIn ?? false}+ cloudReasoningMode={cloudReasoningMode}+ setCloudReasoningMode={setCloudReasoningMode}+ useReasoningModel={useReasoningModel}+ setUseReasoningModel={(value) => {+ setUseReasoningModel(value);+ updateReasoningSettings({ useReasoningModel: value });+ }}+ reasoningModel={reasoningModel}+ setReasoningModel={setReasoningModel}+ reasoningProvider={reasoningProvider}+ setReasoningProvider={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}+ showAlertDialog={showAlertDialog}+ toast={toast}+ />);// ───────────────────────────────────────────────────diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 8576b958f..f93220814 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -1037,9 +1037,9 @@ class AudioManager {if (useReasoningModel && processedText) {const reasoningStart = performance.now();const agentName = localStorage.getItem("agentName") || "";- const cloudTranscriptionMode = localStorage.getItem("cloudTranscriptionMode") || "openwhispr";+ const cloudReasoningMode = localStorage.getItem("cloudReasoningMode") || "openwhispr";- if (cloudTranscriptionMode === "openwhispr") {+ if (cloudReasoningMode === "openwhispr") {const reasonResult = await withSessionRefresh(async () => {const res = await window.electronAPI.cloudReason(processedText, {agentName,@@ -1057,6 +1057,14 @@ class AudioManager {if (reasonResult.success) {processedText = reasonResult.text;}+ } else {+ const reasoningModel = localStorage.getItem("reasoningModel") || "";+ if (reasoningModel) {+ const result = await this.processWithReasoningModel(processedText, reasoningModel, agentName);+ if (result) {+ processedText = result;+ }+ }}timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);}@@ -1933,34 +1941,50 @@ class AudioManager {if (useReasoningModel && finalText) {const reasoningStart = performance.now();const agentName = localStorage.getItem("agentName") || "";+ const cloudReasoningMode = localStorage.getItem("cloudReasoningMode") || "openwhispr";try {- const reasonResult = await withSessionRefresh(async () => {- const res = await window.electronAPI.cloudReason(finalText, {- agentName,- customDictionary: this.getCustomDictionaryArray(),- language: localStorage.getItem("preferredLanguage") || "auto",+ if (cloudReasoningMode === "openwhispr") {+ const reasonResult = await withSessionRefresh(async () => {+ const res = await window.electronAPI.cloudReason(finalText, {+ agentName,+ customDictionary: this.getCustomDictionaryArray(),+ language: localStorage.getItem("preferredLanguage") || "auto",+ });+ if (!res.success) {+ const err = new Error(res.error || "Cloud reasoning failed");+ err.code = res.code;+ throw err;+ }+ return res;});- if (!res.success) {- const err = new Error(res.error || "Cloud reasoning failed");- err.code = res.code;- throw err;++ if (reasonResult.success && reasonResult.text) {+ finalText = reasonResult.text;}- return res;- });- if (reasonResult.success && reasonResult.text) {- finalText = reasonResult.text;+ logger.info(+ "Streaming reasoning complete",+ {+ reasoningDurationMs: Math.round(performance.now() - reasoningStart),+ model: reasonResult.model,+ },+ "streaming"+ );+ } else {+ const reasoningModel = localStorage.getItem("reasoningModel") || "";+ if (reasoningModel) {+ const result = await this.processWithReasoningModel(finalText, reasoningModel, agentName);+ if (result) {+ finalText = result;+ }+ logger.info(+ "Streaming BYOK reasoning complete",+ { reasoningDurationMs: Math.round(performance.now() - reasoningStart) },+ "streaming"+ );+ }}-- logger.info(- "Streaming reasoning complete",- {- reasoningDurationMs: Math.round(performance.now() - reasoningStart),- model: reasonResult.model,- },- "streaming"- );} catch (reasonError) {logger.error("Streaming reasoning failed, using raw text",diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 7d3c1d9ca..f68f0370d 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -28,6 +28,7 @@ export interface ReasoningSettings {reasoningModel: string;reasoningProvider: string;cloudReasoningBaseUrl?: string;+ cloudReasoningMode: string;}export interface HotkeySettings {@@ -154,6 +155,15 @@ export function useSettings() {});+ const [cloudReasoningMode, setCloudReasoningMode] = useLocalStorage(+ "cloudReasoningMode",+ "openwhispr",+ {+ serialize: String,+ deserialize: String,+ }+ );+// Custom dictionary for improving transcription of specific wordsconst [customDictionary, setCustomDictionaryRaw] = useLocalStorage<string[]>("customDictionary",@@ -568,8 +578,10 @@ export function useSettings() {setReasoningProvider(settings.reasoningProvider);if (settings.cloudReasoningBaseUrl !== undefined)setCloudReasoningBaseUrl(settings.cloudReasoningBaseUrl);+ if (settings.cloudReasoningMode !== undefined)+ setCloudReasoningMode(settings.cloudReasoningMode);},- [setUseReasoningModel, setReasoningModel, setReasoningProvider, setCloudReasoningBaseUrl]+ [setUseReasoningModel, setReasoningModel, setReasoningProvider, setCloudReasoningBaseUrl, setCloudReasoningMode]);const updateApiKeys = useCallback(@@ -596,6 +608,7 @@ export function useSettings() {cloudTranscriptionBaseUrl,cloudReasoningBaseUrl,cloudTranscriptionMode,+ cloudReasoningMode,customDictionary,assemblyAiStreaming,setAssemblyAiStreaming,@@ -621,6 +634,7 @@ export function useSettings() {setCloudTranscriptionBaseUrl,setCloudReasoningBaseUrl,setCloudTranscriptionMode,+ setCloudReasoningMode,setCustomDictionary,setUseReasoningModel,setReasoningModel,diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.tsindex eddfcf83c..79d3531f8 100644--- a/src/models/ModelRegistry.ts+++ b/src/models/ModelRegistry.ts@@ -245,7 +245,7 @@ export function getReasoningModelLabel(modelId: string): string {export function getModelProvider(modelId: string): string {// When in OpenWhispr cloud mode, route reasoning through the cloud APIif (typeof localStorage !== "undefined") {- const cloudMode = localStorage.getItem("cloudTranscriptionMode");+ const cloudMode = localStorage.getItem("cloudReasoningMode");const isSignedIn = localStorage.getItem("isSignedIn") === "true";if (cloudMode === "openwhispr" && isSignedIn) {return "openwhispr";