Fix: Change default ElevenLabs fallback voice to standard pre-made voice Antoni (ErXwobaYiN019PkySvjV) to support free accounts

This commit is contained in:
Hamza-Ayed
2026-05-22 23:12:48 +03:00
parent 2aa8862f77
commit 1941a61e82

View File

@@ -43,10 +43,10 @@ class GeminiService
*/
public static function getElevenLabsVoiceId(?string $configuredVoiceId = null): string
{
$voiceIdSource = !empty($configuredVoiceId) ? $configuredVoiceId : (getenv('ELEVENLABS_VOICE_ID') ?: 'pNInz6obpgDQGcFmaJgB');
$voiceIdSource = !empty($configuredVoiceId) ? $configuredVoiceId : (getenv('ELEVENLABS_VOICE_ID') ?: 'ErXwobaYiN019PkySvjV');
$voiceIds = array_filter(array_map('trim', explode(',', $voiceIdSource)));
if (empty($voiceIds)) {
return 'pNInz6obpgDQGcFmaJgB';
return 'ErXwobaYiN019PkySvjV';
}
return $voiceIds[array_rand($voiceIds)];
}
@@ -420,7 +420,7 @@ class GeminiService
): ?array {
// Use ElevenLabs if the API Key is provided
if (!empty($elApiKey)) {
$voiceId = !empty($elVoiceId) ? $elVoiceId : 'pNInz6obpgDQGcFmaJgB'; // Default to Adam
$voiceId = !empty($elVoiceId) ? $elVoiceId : 'ErXwobaYiN019PkySvjV'; // Default to Antoni
$audioData = self::generateAudioResponseWithElevenLabs($elApiKey, $userMessage, $voiceId);
if ($audioData) {
return $audioData;