Skip to content

Commit

Permalink
Update voice dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Sep 20, 2023
1 parent 48dcdaa commit e86a83a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/elevenlabs/useVoiceDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function VoicesDropdown(props: {
isValidKey: boolean,
isLoadingVoices: boolean,
isErrorVoices: boolean,
disabled?: boolean,
voices: VoiceSchema[],
voiceId: string | null,
setVoiceId: (voiceId: string) => void,
Expand All @@ -28,7 +29,7 @@ function VoicesDropdown(props: {
return (
<Select
value={props.voiceId} onChange={handleVoiceChange}
variant='outlined'
variant='outlined' disabled={props.disabled}
// color={props.isErrorVoices ? 'danger' : undefined}
placeholder={props.isErrorVoices ? 'Issue loading voices' : props.isValidKey ? 'Select a voice' : 'Enter valid API Key'}
startDecorator={<RecordVoiceOverIcon />}
Expand All @@ -49,7 +50,7 @@ function VoicesDropdown(props: {
}


export function useVoiceDropdown(autoSpeak: boolean) {
export function useVoiceDropdown(autoSpeak: boolean, disabled?: boolean) {

// external state
const { apiKey, voiceId } = useElevenlabsStore(state => ({
Expand Down Expand Up @@ -78,11 +79,11 @@ export function useVoiceDropdown(autoSpeak: boolean) {

const voicesDropdown = React.useMemo(() =>
<VoicesDropdown
isValidKey={isValidKey} isLoadingVoices={isLoading} isErrorVoices={isError}
isValidKey={isValidKey} isLoadingVoices={isLoading} isErrorVoices={isError} disabled={disabled}
voices={data?.voices || []}
voiceId={voiceId} setVoiceId={(voiceId) => useElevenlabsStore.getState().setElevenLabsVoiceId(voiceId)}
/>,
[data?.voices, isError, isLoading, isValidKey, voiceId],
[data?.voices, disabled, isError, isLoading, isValidKey, voiceId],
);

return {
Expand Down

1 comment on commit e86a83a

@vercel
Copy link

@vercel vercel bot commented on e86a83a Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

big-agi – ./

big-agi-git-main-enricoros.vercel.app
big-agi-enricoros.vercel.app
get.big-agi.com

Please sign in to comment.