handleSelection(key)}
- >
-
-
-
+ {TYPES.map(({ key, label, description, icon: Icon }) => {
+ const exists = existingTypes[key];
+ return (
+
handleSelection(key)}
+ >
+ {exists && (
+
+
+ Generated
+
+ )}
+
-
{label}
+
{description}
-
{description}
-
- ))}
+ );
+ })}
);
diff --git a/src/hooks/useMicroLearnings.js b/src/hooks/useMicroLearnings.js
index c55dfd6..c0f4ff7 100644
--- a/src/hooks/useMicroLearnings.js
+++ b/src/hooks/useMicroLearnings.js
@@ -1,4 +1,4 @@
-import { getOrGenerateMicroLearning, regenerateMicroLearning } from '../lib/microLearningService';
+import { getOrGenerateMicroLearning, regenerateMicroLearning, getExistingTypes } from '../lib/microLearningService';
export function useMicroLearnings() {
/**
@@ -16,5 +16,13 @@ export function useMicroLearnings() {
return regenerateMicroLearning(topicId, type);
};
- return { getOrGenerate, regenerate };
+ /**
+ * Check which micro learning types already exist for a given topic.
+ * Returns { concept_explainer: true, scenario_quiz: false, ... }
+ */
+ const checkExistingTypes = async (topicId) => {
+ return getExistingTypes(topicId);
+ };
+
+ return { getOrGenerate, regenerate, checkExistingTypes };
}
diff --git a/src/lib/microLearningService.js b/src/lib/microLearningService.js
index d76e522..1633e2f 100644
--- a/src/lib/microLearningService.js
+++ b/src/lib/microLearningService.js
@@ -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) {