Skip to content

Commit

Permalink
🚸 (elevenLabs) Only show text-to-speech compatible models
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 5, 2024
1 parent 14022fe commit 022a320
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/forge/blocks/elevenlabs/actions/convertTextToSpeech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}),
Expand Down Expand Up @@ -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: [],
},
Expand Down
1 change: 1 addition & 0 deletions packages/forge/blocks/elevenlabs/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export type VoicesResponse = {
export type ModelsResponse = {
model_id: string
name: string
can_do_text_to_speech: boolean
}[]

0 comments on commit 022a320

Please sign in to comment.