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
refactor: remove redundant save buttons
Gabriel Steinb3c231e8c537
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 06ad1a8ae..591457084 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -14,11 +14,9 @@ import { useWhisper } from "../hooks/useWhisper";import { usePermissions } from "../hooks/usePermissions";import { useClipboard } from "../hooks/useClipboard";import { useUpdater } from "../hooks/useUpdater";-import { REASONING_PROVIDERS, getTranscriptionProviders } from "../models/ModelRegistry";+import { getTranscriptionProviders } from "../models/ModelRegistry";import { formatHotkeyLabel } from "../utils/hotkeys";-import LanguageSelector from "./ui/LanguageSelector";import PromptStudio from "./ui/PromptStudio";-import { API_ENDPOINTS } from "../config/constants";import ReasoningModelSelector from "./ReasoningModelSelector";import type { UpdateInfoResult } from "../types/electron";import { HotkeyInput } from "./ui/HotkeyInput";@@ -49,12 +47,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageuseLocalWhisper,whisperModel,allowOpenAIFallback,- allowLocalFallback,- fallbackWhisperModel,- preferredLanguage,cloudTranscriptionProvider,cloudTranscriptionModel,- cloudTranscriptionBaseUrl,cloudReasoningBaseUrl,useReasoningModel,reasoningModel,@@ -71,9 +65,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetUseLocalWhisper,setWhisperModel,setAllowOpenAIFallback,- setAllowLocalFallback,- setFallbackWhisperModel,- setPreferredLanguage,setCloudTranscriptionProvider,setCloudTranscriptionModel,setCloudTranscriptionBaseUrl,@@ -88,7 +79,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetDictationKey,updateTranscriptionSettings,updateReasoningSettings,- updateApiKeys,} = useSettings();const [currentVersion, setCurrentVersion] = useState<string>("");@@ -193,143 +183,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage};}, [installInitiated, showAlertDialog]);- const saveReasoningSettings = useCallback(async () => {- const normalizedReasoningBase = (cloudReasoningBaseUrl || "").trim();- setCloudReasoningBaseUrl(normalizedReasoningBase);-- updateReasoningSettings({- useReasoningModel,- reasoningModel,- cloudReasoningBaseUrl: normalizedReasoningBase,- });-- if (- (localReasoningProvider === "openai" || localReasoningProvider === "custom") &&- openaiApiKey- ) {- await window.electronAPI?.saveOpenAIKey(openaiApiKey);- }- if (localReasoningProvider === "anthropic" && anthropicApiKey) {- await window.electronAPI?.saveAnthropicKey(anthropicApiKey);- }- if (localReasoningProvider === "gemini" && geminiApiKey) {- await window.electronAPI?.saveGeminiKey(geminiApiKey);- }- if (localReasoningProvider === "groq" && groqApiKey) {- await window.electronAPI?.saveGroqKey(groqApiKey);- }-- const keysToSave: Partial<{- openaiApiKey: string;- anthropicApiKey: string;- geminiApiKey: string;- groqApiKey: string;- }> = {};- if (- (localReasoningProvider === "openai" || localReasoningProvider === "custom") &&- openaiApiKey.trim()- ) {- keysToSave.openaiApiKey = openaiApiKey;- }- if (localReasoningProvider === "anthropic" && anthropicApiKey.trim()) {- keysToSave.anthropicApiKey = anthropicApiKey;- }- if (localReasoningProvider === "gemini" && geminiApiKey.trim()) {- keysToSave.geminiApiKey = geminiApiKey;- }- if (localReasoningProvider === "groq" && groqApiKey.trim()) {- keysToSave.groqApiKey = groqApiKey;- }- updateApiKeys(keysToSave);-- localStorage.setItem("reasoningProvider", localReasoningProvider);-- const providerLabel =- localReasoningProvider === "custom"- ? "Custom"- : REASONING_PROVIDERS[localReasoningProvider as keyof typeof REASONING_PROVIDERS]?.name ||- localReasoningProvider;-- showAlertDialog({- title: "Reasoning Settings Saved",- description: `AI text enhancement ${useReasoningModel ? "enabled" : "disabled"} with ${- providerLabel- } ${reasoningModel}`,- });- }, [- useReasoningModel,- reasoningModel,- localReasoningProvider,- cloudReasoningBaseUrl,- openaiApiKey,- anthropicApiKey,- geminiApiKey,- groqApiKey,- setCloudReasoningBaseUrl,- updateReasoningSettings,- updateApiKeys,- showAlertDialog,- ]);-- const saveApiKey = useCallback(async () => {- try {- if (openaiApiKey) {- await window.electronAPI?.saveOpenAIKey(openaiApiKey);- }- if (anthropicApiKey) {- await window.electronAPI?.saveAnthropicKey(anthropicApiKey);- }- if (geminiApiKey) {- await window.electronAPI?.saveGeminiKey(geminiApiKey);- }-- updateApiKeys({ openaiApiKey, anthropicApiKey, geminiApiKey });- updateTranscriptionSettings({ allowLocalFallback, fallbackWhisperModel });-- try {- if (openaiApiKey) {- await window.electronAPI?.createProductionEnvFile(openaiApiKey);- }-- const savedKeys: string[] = [];- if (openaiApiKey) savedKeys.push("OpenAI");- if (anthropicApiKey) savedKeys.push("Anthropic");- if (geminiApiKey) savedKeys.push("Gemini");-- showAlertDialog({- title: "API Keys Saved",- description: `${savedKeys.join(", ")} API key${savedKeys.length > 1 ? "s" : ""} saved successfully! Your credentials have been securely recorded.${- allowLocalFallback ? " Local Whisper fallback is enabled." : ""- }`,- });- } catch (envError) {- showAlertDialog({- title: "API Key Saved",- description: `OpenAI API key saved successfully and will be available for transcription${- allowLocalFallback ? " with Local Whisper fallback enabled" : ""- }`,- });- }- } catch (error) {- console.error("Failed to save API key:", error);- updateApiKeys({ openaiApiKey });- updateTranscriptionSettings({ allowLocalFallback, fallbackWhisperModel });- showAlertDialog({- title: "API Key Saved",- description: "OpenAI API key saved to localStorage (fallback mode)",- });- }- }, [- openaiApiKey,- anthropicApiKey,- geminiApiKey,- allowLocalFallback,- fallbackWhisperModel,- updateApiKeys,- updateTranscriptionSettings,- showAlertDialog,- ]);-const resetAccessibilityPermissions = () => {const message = `🔄 RESET ACCESSIBILITY PERMISSIONS\n\nIf you've rebuilt or reinstalled OpenWhispr and automatic inscription isn't functioning, you may have obsolete permissions from the previous version.\n\n📋 STEP-BY-STEP RESTORATION:\n\n1️⃣ Open System Settings (or System Preferences)\n • macOS Ventura+: Apple Menu → System Settings\n • Older macOS: Apple Menu → System Preferences\n\n2️⃣ Navigate to Privacy & Security → Accessibility\n\n3️⃣ Look for obsolete OpenWhispr entries:\n • Any entries named "OpenWhispr"\n • Any entries named "Electron"\n • Any entries with unclear or generic names\n • Entries pointing to old application locations\n\n4️⃣ Remove ALL obsolete entries:\n • Select each old entry\n • Click the minus (-) button\n • Enter your password if prompted\n\n5️⃣ Add the current OpenWhispr:\n • Click the plus (+) button\n • Navigate to and select the CURRENT OpenWhispr app\n • Ensure the checkbox is ENABLED\n\n6️⃣ Restart OpenWhispr completely\n\n💡 This is very common during development when rebuilding applications!\n\nClick OK when you're ready to open System Settings.`;@@ -679,25 +532,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage</div><div className="space-y-3">- <Button- onClick={() => {- showConfirmDialog({- title: "Reset Onboarding",- description:- "Are you sure you want to reset the onboarding process? This will clear your setup and show the welcome flow again.",- onConfirm: () => {- localStorage.removeItem("onboardingCompleted");- window.location.reload();- },- variant: "destructive",- });- }}- variant="outline"- className="w-full text-amber-600 border-amber-300 hover:bg-amber-50 hover:border-amber-400"- >- <span className="mr-2">🔄</span>- Reset Onboarding- </Button><ButtononClick={() => {showConfirmDialog({@@ -803,42 +637,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetGroqApiKey={setGroqApiKey}variant="settings"/>-- <Button- onClick={() => {- const normalizedTranscriptionBase = (cloudTranscriptionBaseUrl || "").trim();- setCloudTranscriptionBaseUrl(normalizedTranscriptionBase);-- updateTranscriptionSettings({- useLocalWhisper,- whisperModel,- preferredLanguage,- cloudTranscriptionBaseUrl: normalizedTranscriptionBase,- });-- if (!useLocalWhisper && openaiApiKey.trim()) {- updateApiKeys({ openaiApiKey });- }-- const descriptionParts = [- `Transcription mode: ${useLocalWhisper ? "Local Whisper" : "Cloud"}.`,- `Language: ${preferredLanguage}.`,- ];-- if (!useLocalWhisper) {- const baseLabel = normalizedTranscriptionBase || API_ENDPOINTS.TRANSCRIPTION_BASE;- descriptionParts.push(`Endpoint: ${baseLabel}.`);- }-- showAlertDialog({- title: "Settings Saved",- description: descriptionParts.join(" "),- });- }}- className="w-full"- >- Save Transcription Settings- </Button></div>);@@ -876,10 +674,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetGroqApiKey={setGroqApiKey}showAlertDialog={showAlertDialog}/>-- <Button onClick={saveReasoningSettings} className="w-full">- Save AI Model Settings- </Button></div>);