Feature: Load balanced API keys and voice registration responses for Company 1

This commit is contained in:
Hamza-Ayed
2026-05-22 23:09:38 +03:00
parent 9a2cf94b86
commit 2aa8862f77
6 changed files with 103 additions and 13 deletions

View File

@@ -169,7 +169,8 @@ EOT
// Check if user requests postponement/delay (only if already started and not finished)
if ($step !== 'start' && $step !== 'finished' && !empty($text)) {
$rule = ChatbotRule::findActiveForRule($companyId);
$apiKey = ($rule && !empty($rule['gemini_api_key'])) ? $rule['gemini_api_key'] : getenv('GEMINI_API_KEY');
$configuredGeminiKey = ($rule && !empty($rule['gemini_api_key'])) ? $rule['gemini_api_key'] : null;
$apiKey = GeminiService::getGeminiApiKey($configuredGeminiKey);
if (!empty($apiKey)) {
$postponeData = $this->detectPostponement($text, $apiKey);
if ($postponeData !== null) {
@@ -366,7 +367,8 @@ EOT
$companyId = $context['company_id'] ?? 1;
$rule = ChatbotRule::findActiveForRule($companyId);
$apiKey = ($rule && !empty($rule['gemini_api_key'])) ? $rule['gemini_api_key'] : getenv('GEMINI_API_KEY');
$configuredGeminiKey = ($rule && !empty($rule['gemini_api_key'])) ? $rule['gemini_api_key'] : null;
$apiKey = GeminiService::getGeminiApiKey($configuredGeminiKey);
if (empty($apiKey)) {
error_log("[DriverRegistrationFlow] Gemini API key not configured.");