feat: STEM Virtual Lab, English TTS companion, dynamic textbooks and zero-demo video fallback
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* CLI Tool: Generate Interactive HTML5 Canvas Lab Simulation
|
||||
* Usage:
|
||||
* php backend/scripts/generate_interactive_lab.php --lesson=grade_10/physics_10/semester_1/unit_01/lesson_01.md --subject=physics_10 --slug=vectors_lab
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../app/Core/Database.php';
|
||||
require_once __DIR__ . '/../app/Services/AiInteractiveLabGeneratorService.php';
|
||||
|
||||
$options = getopt('', ['lesson:', 'subject:', 'slug:']);
|
||||
$lesson = $options['lesson'] ?? '';
|
||||
$subject = $options['subject'] ?? 'physics_10';
|
||||
$slug = $options['slug'] ?? null;
|
||||
|
||||
if (empty($lesson)) {
|
||||
echo "❌ Error: --lesson parameter is required.\n";
|
||||
echo "Example: php generate_interactive_lab.php --lesson=grade_10/physics_10/semester_1/unit_01/lesson_01.md --subject=physics_10\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "🚀 Starting AI Interactive Lab Generation for: {$lesson}...\n";
|
||||
|
||||
try {
|
||||
$res = \App\Services\AiInteractiveLabGeneratorService::generateLabFromLesson($lesson, $subject, $slug);
|
||||
echo "✅ Success! Simulation generated successfully:\n";
|
||||
echo " - Simulation Slug: {$res['sim_slug']}\n";
|
||||
echo " - File Location: {$res['file_path']}\n";
|
||||
echo " - API Endpoint: {$res['url']}\n";
|
||||
echo " - Size: {$res['byte_size']} bytes\n";
|
||||
} catch (\Throwable $e) {
|
||||
echo "❌ Generation failed: " . $e->getMessage() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user