feat: implement learning module page with AI-generated content and feedback workflow
All checks were successful
On Push to Main / test (push) Successful in 29s
On Push to Main / publish (push) Successful in 58s
On Push to Main / deploy-dev (push) Successful in 1m34s

This commit is contained in:
RaymondVerhoef
2026-05-17 17:53:09 +02:00
parent 5b37c04588
commit 5659ff6726
4 changed files with 6 additions and 78 deletions

View File

@@ -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.';