From 580b451e44ddca25ec0bc636b71789bf11627bb2 Mon Sep 17 00:00:00 2001 From: Joshua Swigut <62301576+JJSwigut@users.noreply.github.com> Date: Wed, 6 Aug 2025 11:37:41 -0400 Subject: [PATCH] Fix voice dictation provider selection bug (#3862) --- .../settings/dictation/DictationSection.tsx | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ui/desktop/src/components/settings/dictation/DictationSection.tsx b/ui/desktop/src/components/settings/dictation/DictationSection.tsx index 8802240743..f80cbe85c2 100644 --- a/ui/desktop/src/components/settings/dictation/DictationSection.tsx +++ b/ui/desktop/src/components/settings/dictation/DictationSection.tsx @@ -97,6 +97,23 @@ export default function DictationSection() { checkOpenAIKey(); }, [getProviders]); + const handleDropdownToggle = async () => { + const newShowState = !showProviderDropdown; + setShowProviderDropdown(newShowState); + + if (newShowState) { + try { + const providers = await getProviders(true); + const openAIProvider = providers.find((p) => p.name === 'openai'); + const isConfigured = !!openAIProvider?.is_configured; + setHasOpenAIKey(isConfigured); + } catch (error) { + console.error('Error checking OpenAI configuration:', error); + setHasOpenAIKey(false); + } + } + }; + const saveSettings = (newSettings: DictationSettings) => { setSettings(newSettings); localStorage.setItem(DICTATION_SETTINGS_KEY, JSON.stringify(newSettings)); @@ -171,7 +188,7 @@ export default function DictationSection() {