mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
Fix voice dictation provider selection bug (#3862)
This commit is contained in:
@@ -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() {
|
||||
</div>
|
||||
<div className="relative">
|
||||
<button
|
||||
onClick={() => setShowProviderDropdown(!showProviderDropdown)}
|
||||
onClick={handleDropdownToggle}
|
||||
className="flex items-center gap-2 px-3 py-1.5 text-sm border border-borderSubtle rounded-md hover:border-borderStandard transition-colors text-textStandard bg-background-default"
|
||||
>
|
||||
{getProviderLabel(settings.provider)}
|
||||
@@ -182,12 +199,7 @@ export default function DictationSection() {
|
||||
<div className="absolute right-0 mt-1 w-48 bg-background-default border border-borderStandard rounded-md shadow-lg z-10">
|
||||
<button
|
||||
onClick={() => handleProviderChange('openai')}
|
||||
disabled={!hasOpenAIKey}
|
||||
className={`w-full px-3 py-2 text-left text-sm transition-colors first:rounded-t-md ${
|
||||
hasOpenAIKey
|
||||
? 'hover:bg-bgSubtle text-textStandard'
|
||||
: 'text-textSubtle cursor-not-allowed'
|
||||
}`}
|
||||
className="w-full px-3 py-2 text-left text-sm transition-colors first:rounded-t-md hover:bg-bgSubtle text-textStandard"
|
||||
>
|
||||
OpenAI Whisper
|
||||
{!hasOpenAIKey && <span className="text-xs ml-1">(not configured)</span>}
|
||||
|
||||
Reference in New Issue
Block a user