Feature: Load balanced API keys and voice registration responses for Company 1
This commit is contained in:
@@ -108,12 +108,12 @@ class ChatbotController extends BaseController
|
||||
|
||||
// 4. Retrieve the Gemini API key (custom or system default)
|
||||
$rules = ChatbotRule::findAllByCompany($request->company_id);
|
||||
$apiKey = null;
|
||||
$configuredKey = null;
|
||||
if (!empty($rules) && !empty($rules[0]['gemini_api_key'])) {
|
||||
$apiKey = $rules[0]['gemini_api_key'];
|
||||
$configuredKey = $rules[0]['gemini_api_key'];
|
||||
}
|
||||
|
||||
$apiKey = $apiKey ?: getenv('GEMINI_API_KEY');
|
||||
$apiKey = \App\Services\GeminiService::getGeminiApiKey($configuredKey);
|
||||
|
||||
if (empty($apiKey)) {
|
||||
$response->status(500)->json(['status' => 'error', 'message' => 'Gemini API Key is not configured in the system']);
|
||||
|
||||
Reference in New Issue
Block a user