feat: drop reflection_prompt type and flag cached micro-learnings

Remove the reflection_prompt micro-learning format end-to-end: type
config, tool definition, container case, selector tile, and the
ReflectionPrompt component file. The format wasn't pulling its weight as
a learning surface.

Add a Beschikbaar badge to selector tiles whose topic already has a
published micro-learning of that type, so users know which formats open
instantly instead of triggering a fresh generation. Cached records are
fetched once per topic via the new getExistingTypesForTopic helper, and
re-fetched after a generation returns so newly-created formats light up
without a manual refresh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
RaymondVerhoef
2026-05-26 13:41:20 +02:00
parent 9ea5d5444d
commit 84e7468841
5 changed files with 58 additions and 102 deletions

View File

@@ -418,15 +418,3 @@ export const EMIT_FLASHCARD_SET_TOOL = {
},
};
export const EMIT_REFLECTION_PROMPT_TOOL = {
name: 'emit_reflection_prompt',
description: 'Return an open-ended reflection question that asks the employee to connect the topic to their own professional experience, plus a model answer showing the expected depth and specificity.',
input_schema: {
type: 'object',
properties: {
prompt: { type: 'string', description: 'An open-ended question that cannot be answered with a fact. It must require the employee to think about their own context.' },
model_answer: { type: 'string', description: 'An example of a thoughtful, specific response (35 sentences). This is not a rubric — it illustrates depth.' },
},
required: ['prompt', 'model_answer'],
},
};

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.
@@ -126,6 +116,23 @@ export async function regenerateMicroLearning(topicId, type) {
return getOrGenerateMicroLearning(topicId, type);
}
/**
* Return the set of micro-learning types that already have a published
* record for the given topic. Used by the selector UI to flag formats
* that are ready to read instantly (no generation latency).
*/
export async function getExistingTypesForTopic(topicId) {
try {
const records = await pb.collection('micro_learnings').getFullList({
filter: `topic_id = "${topicId}" && status = "published"`,
fields: 'type',
});
return new Set(records.map((r) => r.type));
} catch {
return new Set();
}
}
/**
* Delete all cached micro learnings for a topic (all types).
*/