Implement Server-Side AI Question Bank Generator, Adaptive Weakness Sampling 60/40, and Curriculum Studio One-Click Generation
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* CLI Tool: Generate & Seed Comprehensive AI Question Bank for any Unit
|
||||
* Usage:
|
||||
* php backend/scripts/generate_unit_question_bank.php --unit=grade_10/math_10/semester_1/unit_01 --course=1 --count=50
|
||||
*/
|
||||
|
||||
require_once dirname(__DIR__) . '/app/bootstrap.php';
|
||||
require_once dirname(__DIR__) . '/app/Services/AiQuestionBankGeneratorService.php';
|
||||
|
||||
use App\Services\AiQuestionBankGeneratorService;
|
||||
|
||||
$options = getopt('', ['unit:', 'course:', 'count:']);
|
||||
|
||||
$unit = $options['unit'] ?? 'grade_10/math_10/semester_1/unit_01';
|
||||
$courseId = isset($options['course']) ? (int)$options['course'] : 1;
|
||||
$count = isset($options['count']) ? (int)$options['count'] : 50;
|
||||
|
||||
echo "========================================================\n";
|
||||
echo "🚀 Saqel AI Question Bank Generator\n";
|
||||
echo "========================================================\n";
|
||||
echo "📁 Unit: {$unit}\n";
|
||||
echo "🎓 Course: {$courseId}\n";
|
||||
echo "🎯 Target: {$count} Questions\n";
|
||||
echo "--------------------------------------------------------\n";
|
||||
echo "⏳ Ingesting Markdown files and calling AI Engine...\n";
|
||||
|
||||
try {
|
||||
$result = AiQuestionBankGeneratorService::generateUnitQuestionBank($unit, $courseId, $count);
|
||||
echo "✅ Success!\n";
|
||||
echo "📌 Exam ID: {$result['exam_id']}\n";
|
||||
echo "📖 Unit Title: {$result['unit_title']}\n";
|
||||
echo "🔢 Total Bank: {$result['total_in_bank']} Questions Seeded into Database!\n";
|
||||
echo "========================================================\n";
|
||||
exit(0);
|
||||
} catch (\Throwable $e) {
|
||||
echo "❌ Error: " . $e->getMessage() . "\n";
|
||||
echo "Trace: " . $e->getTraceAsString() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user