Generate with AI fails with real text-to-speech providers
Problem/Motivation
Generate with AI on the spoken disclaimer page fails with every real text-to-speech provider. Tests passed because they use a fake provider.
Steps to reproduce
- Install drupal/ai and drupal/elevenlabs, set ElevenLabs as the default text-to-speech provider.
- On Media > Spoken disclaimer, press Generate with AI.
- Error: "The AI module has no textToSpeech()".
Proposed resolution
ai.providerreturns aProviderProxy, which forwards calls through__call().method_exists()is false on it, so check withis_callable().- Pass the provider's default configuration. ElevenLabs needs a voice and has no default: use the first voice it offers.
Choosing the voice per language is a separate feature.
Remaining tasks
- Fix and a kernel test with a provider behind a
__call()proxy - Check with ElevenLabs on the test site
Part of #80 (closed).
AI Compliance
🤖 Generated with the help of an LLM, reviewed and approved by me before posting.
Edited by Giorgio Alfredo Pagano