feat: implement learning module page with AI-generated content and feedback workflow
This commit is contained in:
@@ -23,9 +23,7 @@ const CONTENT_SCHEMA_SLIDES = `{
|
||||
]
|
||||
}`;
|
||||
|
||||
const CONTENT_SCHEMA_PODCAST = `{
|
||||
"podcastScript": "A natural spoken script of approx. 300 words summarizing the topic as a podcast episode."
|
||||
}`;
|
||||
|
||||
|
||||
const CONTENT_SCHEMA_INFOGRAPHIC = `{
|
||||
"infographic": {
|
||||
@@ -45,7 +43,6 @@ const CONTENT_SCHEMA_INFOGRAPHIC = `{
|
||||
const CONTENT_SCHEMA_ALL = `{
|
||||
"article": ${CONTENT_SCHEMA_ARTICLE.replace(/^\{|\}$/g, '').trim()},
|
||||
"slides": ${CONTENT_SCHEMA_SLIDES.replace(/^\{|\}$/g, '').trim()},
|
||||
"podcastScript": "A natural spoken script of approx. 300 words summarizing the topic as a podcast episode.",
|
||||
"infographic": ${CONTENT_SCHEMA_INFOGRAPHIC.replace(/^\{|\}$/g, '').trim()}
|
||||
}`;
|
||||
|
||||
@@ -83,10 +80,7 @@ export async function generateLearningContent(topic, force = false, selectedType
|
||||
if (!force) {
|
||||
cached = await db.getContent(topic.id);
|
||||
if (cached) {
|
||||
if (selectedType === 'podcast' && cached.podcastScript) {
|
||||
console.log(`[Learn] Cache hit for topic: ${topic.id} (podcast)`);
|
||||
return cached;
|
||||
} else if (selectedType !== 'podcast' && cached[selectedType]) {
|
||||
if (cached[selectedType]) {
|
||||
console.log(`[Learn] Cache hit for topic: ${topic.id} (${selectedType})`);
|
||||
return cached;
|
||||
}
|
||||
@@ -104,9 +98,6 @@ export async function generateLearningContent(topic, force = false, selectedType
|
||||
} else if (selectedType === 'slides') {
|
||||
schema = CONTENT_SCHEMA_SLIDES;
|
||||
instructions = 'Provide at least 4 slides.';
|
||||
} else if (selectedType === 'podcast') {
|
||||
schema = CONTENT_SCHEMA_PODCAST;
|
||||
instructions = 'Provide a natural spoken script.';
|
||||
} else if (selectedType === 'infographic') {
|
||||
schema = CONTENT_SCHEMA_INFOGRAPHIC;
|
||||
instructions = 'Provide at least 3 stats, and 3-5 steps in the infographic.';
|
||||
|
||||
Reference in New Issue
Block a user