2
0

🚸 (elevenLabs) Only show text-to-speech compatible models

This commit is contained in:
Baptiste Arnaud
2024-03-05 09:50:33 +01:00
parent 14022fe92f
commit 022a320e7e
2 changed files with 9 additions and 6 deletions

View File

@ -17,12 +17,12 @@ export const convertTextToSpeech = createAction({
}),
voiceId: option.string.layout({
fetcher: 'fetchVoices',
label: 'Voice ID',
label: 'Voice',
placeholder: 'Select a voice',
}),
modelId: option.string.layout({
fetcher: 'fetchModels',
label: 'Model ID',
label: 'Model',
placeholder: 'Select a model',
defaultValue: 'eleven_monolingual_v1',
}),
@ -64,10 +64,12 @@ export const convertTextToSpeech = createAction({
})
.json<ModelsResponse>()
return response.map((model) => ({
value: model.model_id,
label: model.name,
}))
return response
.filter((model) => model.can_do_text_to_speech)
.map((model) => ({
value: model.model_id,
label: model.name,
}))
},
dependencies: [],
},

View File

@ -8,4 +8,5 @@ export type VoicesResponse = {
export type ModelsResponse = {
model_id: string
name: string
can_do_text_to_speech: boolean
}[]