Update Saqel Platform: 2026-09-08 23:35:48

This commit is contained in:
Hamza-Ayed
2026-09-08 23:35:48 +03:00
parent 90487a42ad
commit 41493f5dd6
11 changed files with 19 additions and 19 deletions
@@ -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), '"\' ');
}
}
@@ -112,7 +112,7 @@ class AiLessonEnhancerService
private static function callGemini(string $prompt): ?array
{
$apiKey = Env::get('GEMINI_API_KEY') ?: getenv('GEMINI_API_KEY');
$apiKey = Env::get('GEMINI_KEY') ?: getenv('GEMINI_KEY');
if (!$apiKey) {
$apiKey = Env::get('GOOGLE_API_KEY') ?: getenv('GOOGLE_API_KEY');
}
@@ -245,7 +245,7 @@ class AiQuestionBankGeneratorService
*/
private static function callGemini(string $prompt): ?array
{
$apiKey = Env::get('GEMINI_API_KEY') ?: getenv('GEMINI_API_KEY');
$apiKey = Env::get('GEMINI_KEY') ?: getenv('GEMINI_KEY');
if (!$apiKey) {
$apiKey = Env::get('GOOGLE_API_KEY') ?: getenv('GOOGLE_API_KEY');
}
@@ -29,7 +29,7 @@ class AiVideoAnalyzerService
*/
private static function nextGeminiApiKey(): string
{
$raw = trim((string)(getenv('GEMINI_API_KEYS') ?: getenv('GEMINI_API_KEY') ?: ''));
$raw = trim((string)(getenv('GEMINI_API_KEYS') ?: getenv('GEMINI_KEY') ?: ''));
$keys = array_values(array_filter(array_map('trim', explode(',', $raw))));
if (empty($keys)) {
return '';
@@ -59,7 +59,7 @@ class AiVideoGeneratorService
private static function callGemini(string $prompt): ?array
{
$apiKey = Env::get('GEMINI_API_KEY');
$apiKey = Env::get('GEMINI_KEY');
if (!$apiKey) return null;
$model = Env::get('GEMINI_MODEL') ?: 'gemini-flash-lite-latest';
@@ -15,7 +15,7 @@ class CurriculumExtractorService
$fileNameClean = trim(preg_replace('/\.[^.]+$/u', '', $fileName));
// Try AI Structuring with Gemini 2.0 Flash
$geminiKey = Env::get('GEMINI_API_KEY') ?: getenv('GEMINI_API_KEY');
$geminiKey = Env::get('GEMINI_KEY') ?: getenv('GEMINI_KEY');
if (!empty($geminiKey) && !empty($rawText)) {
$aiStructure = self::callGeminiStructurer($fileName, $rawText, $geminiKey);
if (!empty($aiStructure['units']) && !empty($aiStructure['subject_name'])) {