Add flag for enabling eleven labs voice dictation (#5095)
This commit is contained in:
@@ -22,7 +22,7 @@ import MentionPopover, { FileItemWithMatch } from './MentionPopover';
|
|||||||
import { useDictationSettings } from '../hooks/useDictationSettings';
|
import { useDictationSettings } from '../hooks/useDictationSettings';
|
||||||
import { useContextManager } from './context_management/ContextManager';
|
import { useContextManager } from './context_management/ContextManager';
|
||||||
import { useChatContext } from '../contexts/ChatContext';
|
import { useChatContext } from '../contexts/ChatContext';
|
||||||
import { COST_TRACKING_ENABLED } from '../updates';
|
import { COST_TRACKING_ENABLED, VOICE_DICTATION_ELEVENLABS_ENABLED } from '../updates';
|
||||||
import { CostTracker } from './bottom_menu/CostTracker';
|
import { CostTracker } from './bottom_menu/CostTracker';
|
||||||
import { DroppedFile, useFileDrop } from '../hooks/useFileDrop';
|
import { DroppedFile, useFileDrop } from '../hooks/useFileDrop';
|
||||||
import { Recipe } from '../recipe';
|
import { Recipe } from '../recipe';
|
||||||
@@ -1344,7 +1344,8 @@ export default function ChatInput({
|
|||||||
OpenAI API key is not configured. Set it up in <b>Settings</b> {'>'}{' '}
|
OpenAI API key is not configured. Set it up in <b>Settings</b> {'>'}{' '}
|
||||||
<b>Models.</b>
|
<b>Models.</b>
|
||||||
</p>
|
</p>
|
||||||
) : dictationSettings.provider === 'elevenlabs' ? (
|
) : VOICE_DICTATION_ELEVENLABS_ENABLED &&
|
||||||
|
dictationSettings.provider === 'elevenlabs' ? (
|
||||||
<p>
|
<p>
|
||||||
ElevenLabs API key is not configured. Set it up in <b>Settings</b> {'>'}{' '}
|
ElevenLabs API key is not configured. Set it up in <b>Settings</b> {'>'}{' '}
|
||||||
<b>Chat</b> {'>'} <b>Voice Dictation.</b>
|
<b>Chat</b> {'>'} <b>Voice Dictation.</b>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { DictationProvider } from '../../../hooks/useDictationSettings';
|
import { DictationProvider } from '../../../hooks/useDictationSettings';
|
||||||
|
import { VOICE_DICTATION_ELEVENLABS_ENABLED } from '../../../updates';
|
||||||
|
|
||||||
interface ProviderInfoProps {
|
interface ProviderInfoProps {
|
||||||
provider: DictationProvider;
|
provider: DictationProvider;
|
||||||
@@ -15,7 +16,7 @@ export const ProviderInfo = ({ provider }: ProviderInfoProps) => {
|
|||||||
configured in the Models section.
|
configured in the Models section.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{provider === 'elevenlabs' && (
|
{VOICE_DICTATION_ELEVENLABS_ENABLED && provider === 'elevenlabs' && (
|
||||||
<div>
|
<div>
|
||||||
<p className="text-xs text-text-muted">
|
<p className="text-xs text-text-muted">
|
||||||
Uses ElevenLabs speech-to-text API for high-quality transcription.
|
Uses ElevenLabs speech-to-text API for high-quality transcription.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { DictationProvider, DictationSettings } from '../../../hooks/useDictatio
|
|||||||
import { useConfig } from '../../ConfigContext';
|
import { useConfig } from '../../ConfigContext';
|
||||||
import { ElevenLabsKeyInput } from './ElevenLabsKeyInput';
|
import { ElevenLabsKeyInput } from './ElevenLabsKeyInput';
|
||||||
import { ProviderInfo } from './ProviderInfo';
|
import { ProviderInfo } from './ProviderInfo';
|
||||||
|
import { VOICE_DICTATION_ELEVENLABS_ENABLED } from '../../../updates';
|
||||||
|
|
||||||
interface ProviderSelectorProps {
|
interface ProviderSelectorProps {
|
||||||
settings: DictationSettings;
|
settings: DictationSettings;
|
||||||
@@ -85,26 +86,30 @@ export const ProviderSelector = ({ settings, onProviderChange }: ProviderSelecto
|
|||||||
<div className="absolute right-0 mt-1 w-48 bg-background-default border border-border-default rounded-md shadow-lg z-10">
|
<div className="absolute right-0 mt-1 w-48 bg-background-default border border-border-default rounded-md shadow-lg z-10">
|
||||||
<button
|
<button
|
||||||
onClick={() => handleProviderChange('openai')}
|
onClick={() => handleProviderChange('openai')}
|
||||||
className="w-full px-3 py-2 text-left text-sm transition-colors first:rounded-t-md hover:bg-background-subtle text-text-default"
|
className={`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-background-subtle text-text-default ${!VOICE_DICTATION_ELEVENLABS_ENABLED ? 'first:rounded-t-md last:rounded-b-md' : 'first:rounded-t-md'}`}
|
||||||
>
|
>
|
||||||
OpenAI Whisper
|
OpenAI Whisper
|
||||||
{!hasOpenAIKey && <span className="text-xs ml-1">(not configured)</span>}
|
{!hasOpenAIKey && <span className="text-xs ml-1">(not configured)</span>}
|
||||||
{settings.provider === 'openai' && <span className="float-right">✓</span>}
|
{settings.provider === 'openai' && <span className="float-right">✓</span>}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
{VOICE_DICTATION_ELEVENLABS_ENABLED && (
|
||||||
onClick={() => handleProviderChange('elevenlabs')}
|
<button
|
||||||
className="w-full px-3 py-2 text-left text-sm hover:bg-background-subtle transition-colors text-text-default last:rounded-b-md"
|
onClick={() => handleProviderChange('elevenlabs')}
|
||||||
>
|
className="w-full px-3 py-2 text-left text-sm hover:bg-background-subtle transition-colors text-text-default last:rounded-b-md"
|
||||||
ElevenLabs
|
>
|
||||||
{settings.provider === 'elevenlabs' && <span className="float-right">✓</span>}
|
ElevenLabs
|
||||||
</button>
|
{settings.provider === 'elevenlabs' && <span className="float-right">✓</span>}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{settings.provider === 'elevenlabs' && <ElevenLabsKeyInput />}
|
{VOICE_DICTATION_ELEVENLABS_ENABLED && settings.provider === 'elevenlabs' && (
|
||||||
|
<ElevenLabsKeyInput />
|
||||||
|
)}
|
||||||
|
|
||||||
<ProviderInfo provider={settings.provider} />
|
<ProviderInfo provider={settings.provider} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '../../../hooks/dictationConstants';
|
} from '../../../hooks/dictationConstants';
|
||||||
import { useConfig } from '../../ConfigContext';
|
import { useConfig } from '../../ConfigContext';
|
||||||
import { ProviderSelector } from './ProviderSelector';
|
import { ProviderSelector } from './ProviderSelector';
|
||||||
|
import { VOICE_DICTATION_ELEVENLABS_ENABLED } from '../../../updates';
|
||||||
|
|
||||||
export const VoiceDictationToggle = () => {
|
export const VoiceDictationToggle = () => {
|
||||||
const [settings, setSettings] = useState<DictationSettings>({
|
const [settings, setSettings] = useState<DictationSettings>({
|
||||||
@@ -24,6 +25,15 @@ export const VoiceDictationToggle = () => {
|
|||||||
if (savedSettings) {
|
if (savedSettings) {
|
||||||
const parsed = JSON.parse(savedSettings);
|
const parsed = JSON.parse(savedSettings);
|
||||||
loadedSettings = parsed;
|
loadedSettings = parsed;
|
||||||
|
|
||||||
|
// If ElevenLabs is disabled and user has it selected, reset to OpenAI
|
||||||
|
if (!VOICE_DICTATION_ELEVENLABS_ENABLED && loadedSettings.provider === 'elevenlabs') {
|
||||||
|
loadedSettings = {
|
||||||
|
...loadedSettings,
|
||||||
|
provider: 'openai',
|
||||||
|
};
|
||||||
|
localStorage.setItem(DICTATION_SETTINGS_KEY, JSON.stringify(loadedSettings));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
loadedSettings = await getDefaultDictationSettings(getProviders);
|
loadedSettings = await getDefaultDictationSettings(getProviders);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ export const UPDATES_ENABLED = true;
|
|||||||
export const COST_TRACKING_ENABLED = true;
|
export const COST_TRACKING_ENABLED = true;
|
||||||
export const ANNOUNCEMENTS_ENABLED = false;
|
export const ANNOUNCEMENTS_ENABLED = false;
|
||||||
export const CONFIGURATION_ENABLED = true;
|
export const CONFIGURATION_ENABLED = true;
|
||||||
|
export const VOICE_DICTATION_ELEVENLABS_ENABLED = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user