Implement verified curriculum, video review, watch sessions, ledger safeguards, and remove demo data
This commit is contained in:
@@ -201,6 +201,16 @@ class AiVideoAnalyzerService
|
||||
// Perform Gemini AI or Curriculum-grounded Analysis
|
||||
$analysisResult = self::generateAnalysis($lessonTitle, $duration, $curriculum);
|
||||
|
||||
if (($analysisResult['status'] ?? '') === 'needs_evidence_review') {
|
||||
return [
|
||||
'status' => 'needs_evidence_review',
|
||||
'lesson_id' => $lessonId,
|
||||
'message' => 'لا يمكن نشر فصول أو أسئلة للفيديو من دون تفريغ زمني ومراجعة تربوية مرتبطة بالدرس.',
|
||||
'timeline_chapters' => [],
|
||||
'checkpoints_count' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
// 1. Save Timeline Chapters to lessons table
|
||||
if (!empty($analysisResult['timeline_chapters'])) {
|
||||
Database::query(
|
||||
@@ -407,6 +417,15 @@ class AiVideoAnalyzerService
|
||||
*/
|
||||
private static function generateAnalysis(string $lessonTitle, int $duration, array $curriculum): array
|
||||
{
|
||||
// This legacy signature receives neither a timestamped transcript nor
|
||||
// the approved Markdown version. It must never create publishable
|
||||
// video claims, even when an AI key happens to be configured.
|
||||
return [
|
||||
'timeline_chapters' => [],
|
||||
'socratic_checkpoints' => [],
|
||||
'status' => 'needs_evidence_review',
|
||||
];
|
||||
|
||||
$geminiKey = self::nextGeminiApiKey();
|
||||
|
||||
if (!empty($geminiKey)) {
|
||||
@@ -482,8 +501,14 @@ class AiVideoAnalyzerService
|
||||
}
|
||||
}
|
||||
|
||||
// High-Precision Curriculum Grounded Engine (Offline / Safe Fallback)
|
||||
return self::buildGroundedCurriculumAnalysis($lessonTitle, $duration, $curriculum);
|
||||
// A title and curriculum outline do not prove what appears at a given
|
||||
// moment in the video. Do not publish chapters or questions without
|
||||
// transcript evidence and a successful review workflow.
|
||||
return [
|
||||
'timeline_chapters' => [],
|
||||
'socratic_checkpoints' => [],
|
||||
'status' => 'needs_evidence_review',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user