Update Saqel Platform: 2026-09-04 02:04:43
This commit is contained in:
@@ -479,5 +479,69 @@ class CurriculumController
|
||||
}
|
||||
return "## ملخص الوحدة والنتاجات التعليمية المقررة\n\n### 1. الأهداف العامة للمادة\n- استيعاب المفاهيم والمصطلحات الأساسية وفق المنهاج الوزاري المعتمد.\n- التدرب على حل النماذج والتطبيقات العملية والأسئلة الوزارية.\n- التحقق من اكتساب المهارات من خلال بنك الأسئلة التكيفي والمختبر.";
|
||||
}
|
||||
|
||||
/**
|
||||
* استرجاع محتوى المختبر التفاعلي الذكي (أمثلة الكتاب الوزاري + 10 تدريبات ذكاء اصطناعي)
|
||||
* يقرأ مباشرة من الملف المخبوز المسبق أو قاعدة البيانات بأقصى سرعة
|
||||
* GET /api/curriculum/interactive-lab
|
||||
*/
|
||||
public function getInteractiveLab(Request $request, Response $response): void
|
||||
{
|
||||
$file = (string) $request->getQuery('file', '');
|
||||
$subject = (string) $request->getQuery('subject', 'arabic_10');
|
||||
$topic = (string) $request->getQuery('topic', 'inna_and_sisters');
|
||||
|
||||
// 1. Check if companion file exists
|
||||
if (!empty($file)) {
|
||||
$cachedLab = CurriculumService::getLessonLabData($file);
|
||||
if (!empty($cachedLab)) {
|
||||
$response->json([
|
||||
'status' => 'success',
|
||||
'source' => 'prebaked_companion_file',
|
||||
'data' => $cachedLab
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Otherwise serve and bake on-the-fly
|
||||
$data = \App\Services\AiHumanitiesLabGeneratorService::getLabContent($subject, $topic);
|
||||
if (!empty($file)) {
|
||||
CurriculumService::saveLessonLabData($file, $data);
|
||||
}
|
||||
|
||||
$response->json([
|
||||
'status' => 'success',
|
||||
'source' => 'generated_and_cached',
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* بناء وتجهيز أصول المختبر التفاعلي مسبقاً وحفظها في المنهاج وقاعدة البيانات بنقرة واحدة من الاستوديو
|
||||
* POST /api/curriculum/bake-lab
|
||||
*/
|
||||
public function bakeInteractiveLab(Request $request, Response $response): void
|
||||
{
|
||||
$body = $request->getBody();
|
||||
$file = $body['file'] ?? '';
|
||||
$subject = $body['subject'] ?? 'arabic_10';
|
||||
$topic = $body['topic'] ?? basename($file, '.md');
|
||||
|
||||
if (empty($file)) {
|
||||
$response->status(400)->json(['status' => 'error', 'message' => 'مسار ملف الدرس مطلوب']);
|
||||
return;
|
||||
}
|
||||
|
||||
$content = CurriculumService::getLessonMarkdown($file);
|
||||
$labData = \App\Services\AiHumanitiesLabGeneratorService::bakeLessonLab($file, $subject, $topic, $content);
|
||||
|
||||
$response->json([
|
||||
'status' => 'success',
|
||||
'message' => 'تم بناء وتثبيت المختبر التفاعلي كأصل ثابت في ملفات المنهاج وقاعدة البيانات بنجاح',
|
||||
'file' => $file,
|
||||
'lab_data' => $labData
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user