feat: implement micro learning generation service with cached LLM content delivery and UI components
This commit is contained in:
@@ -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 (3–5 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) {
|
||||
|
||||
Reference in New Issue
Block a user