feat: Update Curriculum Studio with AI Assets panel to manually generate and input NotebookLM assets
This commit is contained in:
@@ -156,6 +156,31 @@ class CurriculumService
|
||||
return "# محتوى المنهاج\nالمحتوى المعتمد للمنهاج الرسمي.";
|
||||
}
|
||||
|
||||
public static function saveLessonAiAssets(string $relativePath, array $assets): bool
|
||||
{
|
||||
self::ensureStorage();
|
||||
$baseName = preg_replace('/\.md$/i', '', ltrim($relativePath, '/'));
|
||||
$jsonPath = self::$storagePath . '/' . $baseName . '_ai_assets.json';
|
||||
|
||||
$dir = dirname($jsonPath);
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
return file_put_contents($jsonPath, json_encode($assets, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)) !== false;
|
||||
}
|
||||
|
||||
public static function getLessonAiAssets(string $relativePath): array
|
||||
{
|
||||
self::ensureStorage();
|
||||
$baseName = preg_replace('/\.md$/i', '', ltrim($relativePath, '/'));
|
||||
$jsonPath = self::$storagePath . '/' . $baseName . '_ai_assets.json';
|
||||
|
||||
if (file_exists($jsonPath)) {
|
||||
return json_decode(file_get_contents($jsonPath), true) ?: [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast Keyword Search across All Markdown Files
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user