Update Saqel Platform: 2026-09-08 23:35:48
This commit is contained in:
@@ -48,7 +48,7 @@ class AiInteractiveLabGeneratorService
|
||||
|
||||
$apiKey = self::resolveGeminiKey();
|
||||
if (!$apiKey) {
|
||||
throw new \RuntimeException("مفتاح Gemini API غير مهيأ (GEMINI_API_KEY).");
|
||||
throw new \RuntimeException("مفتاح Gemini API غير مهيأ (GEMINI_KEY).");
|
||||
}
|
||||
|
||||
$prompt = self::buildSimulationPrompt($lessonContent, $subjectSlug, $simSlug);
|
||||
@@ -204,15 +204,15 @@ PROMPT;
|
||||
|
||||
private static function resolveGeminiKey(): ?string
|
||||
{
|
||||
if (!empty($_ENV['GEMINI_API_KEY'])) return $_ENV['GEMINI_API_KEY'];
|
||||
if (!empty(getenv('GEMINI_API_KEY'))) return getenv('GEMINI_API_KEY');
|
||||
if (!empty($_ENV['GEMINI_KEY'])) return $_ENV['GEMINI_KEY'];
|
||||
if (!empty(getenv('GEMINI_KEY'))) return getenv('GEMINI_KEY');
|
||||
|
||||
// Check backend/.env
|
||||
$envPath = __DIR__ . '/../../.env';
|
||||
if (file_exists($envPath)) {
|
||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (str_starts_with(trim($line), 'GEMINI_API_KEY=')) {
|
||||
if (str_starts_with(trim($line), 'GEMINI_KEY=')) {
|
||||
return trim(substr(trim($line), 15), '"\' ');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user