Feature: Load balanced API keys and voice registration responses for Company 1
This commit is contained in:
@@ -358,7 +358,8 @@ class WhatsAppController extends BaseController
|
||||
$replyText = $rule['ai_prompt']; // Under keyword rules, ai_prompt stores the predefined static reply
|
||||
}
|
||||
} elseif ($rule['trigger_type'] === 'gemini_ai') {
|
||||
$apiKey = $rule['gemini_api_key'] ?: getenv('GEMINI_API_KEY');
|
||||
$configuredGeminiKey = ($rule && !empty($rule['gemini_api_key'])) ? $rule['gemini_api_key'] : null;
|
||||
$apiKey = \App\Services\GeminiService::getGeminiApiKey($configuredGeminiKey);
|
||||
if (empty($apiKey)) {
|
||||
error_log("[Chatbot Warning] Gemini API Key is not set globally or for company " . $session['company_id']);
|
||||
return;
|
||||
@@ -399,8 +400,11 @@ class WhatsAppController extends BaseController
|
||||
if (strpos($mimeType, ';') !== false) {
|
||||
$mimeType = trim(explode(';', $mimeType)[0]);
|
||||
}
|
||||
$elApiKey = !empty($rule['elevenlabs_api_key']) ? $rule['elevenlabs_api_key'] : (getenv('ELEVENLABS_API_KEY') ?: null);
|
||||
$elVoiceId = !empty($rule['elevenlabs_voice_id']) ? $rule['elevenlabs_voice_id'] : (getenv('ELEVENLABS_VOICE_ID') ?: null);
|
||||
$configuredElKey = !empty($rule['elevenlabs_api_key']) ? $rule['elevenlabs_api_key'] : null;
|
||||
$elApiKey = \App\Services\GeminiService::getElevenLabsApiKey($configuredElKey);
|
||||
|
||||
$configuredVoiceId = !empty($rule['elevenlabs_voice_id']) ? $rule['elevenlabs_voice_id'] : null;
|
||||
$elVoiceId = \App\Services\GeminiService::getElevenLabsVoiceId($configuredVoiceId);
|
||||
|
||||
// Try generating native audio response first
|
||||
$audioResponse = \App\Services\GeminiService::generateAudioResponseFromAudio(
|
||||
|
||||
Reference in New Issue
Block a user