The audio filename is temp name

Created on 15 September 2024, 2 months ago

Problem/Motivation

When using the provider service textToSpeech() method, it saves the file in a random temp name. The method didn't use the second parameter $filename. existed but not used.

Proposed resolution

Using the $filename variable inside the getAsFileEntity() method.

Steps to reproduce

Use this code:

$prompt = "Test text";
$config = [
  "stability" => 0,
  "similarity_boost" => 0,
  "style" => 0,
  "use_speaker_boost" => 1,
];
$ai_provider = \Drupal::service('ai.provider')->createInstance('elevenlabs');
$ai_provider->setConfiguration($config);
$response = $ai_provider->textToSpeech($prompt, 'id_here', ["your_module_name"]);
$normalized = $response->getNormalized();
$file = $normalized[0]->getAsFileEntity("public://", "audio.mp3");
πŸ› Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡¦Saudi Arabia samaphp Riyadh, SA πŸ‡ΈπŸ‡¦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @samaphp
  • Status changed to Closed: won't fix 2 months ago
  • πŸ‡ΈπŸ‡¦Saudi Arabia samaphp Riyadh, SA πŸ‡ΈπŸ‡¦

    Sorry, the issue has been opened in the wrong project. it was solved in the dev branch of the AI module.

Production build 0.71.5 2024