feat: implement micro learning generation service with cached LLM content delivery and UI components
All checks were successful
On Push to Main / test (push) Successful in 32s
On Push to Main / publish (push) Successful in 1m2s
On Push to Main / deploy-dev (push) Successful in 1m32s

This commit is contained in:
RaymondVerhoef
2026-05-25 22:14:00 +02:00
parent 7164317908
commit f16438c1bc
4 changed files with 70 additions and 38 deletions

View File

@@ -15,7 +15,6 @@ import {
EMIT_CONCEPT_EXPLAINER_TOOL,
EMIT_SCENARIO_QUIZ_TOOL,
EMIT_FLASHCARD_SET_TOOL,
EMIT_REFLECTION_PROMPT_TOOL,
} from './llmTools';
import * as db from './db';
@@ -53,15 +52,6 @@ Mix three question types:
- Relationships: "How does X relate to Y?"
Keep answers concise — one or two sentences maximum.`,
},
reflection_prompt: {
tool: EMIT_REFLECTION_PROMPT_TOOL,
tier: 'fast',
maxTokens: 1024,
instructions: `Generate a reflection prompt.
The question must be open-ended and cannot be answered with a fact.
It must require the employee to think about their own professional context — their team, their role, their past experience.
The model answer should show depth and specificity (35 sentences). It is not a rubric — it is an example of thoughtful reflection.`,
},
};
const SYSTEM_PROMPT = `You are an expert learning content writer for Respellion, an internal IT company.
@@ -145,6 +135,21 @@ export async function deleteAllForTopic(topicId) {
}
}
// ── Public helpers ────────────────────────────────────────────────────────────
/**
* Check which micro learning types already exist for a given topic.
* Returns an object like { concept_explainer: true, scenario_quiz: false, ... }
*/
export async function getExistingTypes(topicId) {
const types = Object.keys(MICRO_LEARNING_TYPES);
const result = {};
for (const type of types) {
result[type] = !!(await findExisting(topicId, type));
}
return result;
}
// ── Internal helpers ──────────────────────────────────────────────────────────
async function findExisting(topicId, type) {