Enhance Progression Path Suggestion Logic and UI Feedback
Test Suite / pytest-backend (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m18s
Deploy Development / deploy (push) Successful in 44s

- Updated `suggest_progression_path` to include AI-generated gap fill offers when exercises are missing, improving the relevance of suggested paths.
- Introduced a match summary to provide insights on library matches and gap fill offers, enhancing user feedback in the `ProgressionGraphEditor`.
- Refined the `pick_best_path_hit` function to ensure proper handling of roadmap stage matches based on primary topics.
- Added tests to validate the new gap fill offer logic and match summary functionality, ensuring robustness in path suggestion features.
This commit is contained in:
Lars committed 2026-06-11 11:17:53 +02:00
1 parent 044ce2ee60
commit 8f1dad53ab
5 files changed
+121 -8

No files matched your search

@@ -71,6 +71,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
const [busy, setBusy] = useState(false)
const [loadErr, setLoadErr] = useState('')
const [actionErr, setActionErr] = useState('')
const [matchNotice, setMatchNotice] = useState('')
const [pickContext, setPickContext] = useState(null)
const [pathQa, setPathQa] = useState(null)
const [gapFillOffers, setGapFillOffers] = useState([])
@@ -396,6 +397,7 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
}
setMatching(true)
setActionErr('')
setMatchNotice('')
try {
const synced = syncProgressionRoadmapFromSlots(draft)
const override = majorStepsToOverridePayload(synced.slots)
@@ -427,6 +429,21 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
setTargetSummary(res?.target_profile_summary || null)
setPathQa(res?.path_qa || null)
setGapFillOffers(remainingOffers)
const ms = res?.match_summary
if (ms) {
setMatchNotice(
`Match: ${ms.library_matches ?? 0}/${ms.slot_count ?? '?'} Slots aus Bibliothek, ${ms.gap_fill_offer_count ?? 0} KI-Angebote.`,
)
}
try {
await saveProgressionGraphDraft(api, graphId, {
...matched,
lastFindings: res?.path_qa || null,
})
setDraft((prev) => (prev ? { ...prev, dirty: false } : prev))
} catch (saveErr) {
console.warn('Match-Artefakt konnte nicht gespeichert werden', saveErr)
}
} catch (e) {
setActionErr(e.message || 'Übungs-Match fehlgeschlagen')
} finally {
@@ -868,6 +885,9 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
{busy ? 'Speichern…' : 'Graph speichern'}
</button>
</div>
{matchNotice ? (
<p style={{ margin: '8px 0 0', fontSize: '11px', color: 'var(--accent-dark)' }}>{matchNotice}</p>
) : null}
{draft.dirty ? (
<p style={{ margin: '8px 0 0', fontSize: '11px', color: 'var(--accent-dark)' }}>
Ungespeicherte Änderungen
+12 -6
View File
@@ -245,7 +245,7 @@ export function filterGapOffersForUnfilledSlots(draft, offers) {
if (idx == null || idx < 0 || idx >= (draft?.slots?.length || 0)) return true
const p = draft.slots[idx]?.primary
if (p?.kind === 'library' && p.exerciseId != null) return false
if (p?.kind === 'proposal') return false
if (p?.kind === 'proposal' && p.aiSuggestion) return false
return true
})
}
@@ -407,13 +407,13 @@ export function majorStepsToOverridePayload(rows) {
major_steps: indexed.map((row) => ({
index: row.index,
phase: row.phase || 'vertiefung',
learning_goal: row.learning_goal.trim(),
learning_goal: (row.learning_goal || '').trim(),
consolidates: row.consolidates || [],
rationale: row.rationale || '',
})),
stage_specs: indexed.map((row, i) => ({
major_step_index: i,
learning_goal: row.learning_goal.trim(),
learning_goal: (row.learning_goal || '').trim(),
load_profile: Array.isArray(row.load_profile) ? row.load_profile : [],
exercise_type: (row.exercise_type || '').trim(),
success_criteria: Array.isArray(row.success_criteria) ? row.success_criteria : [],
@@ -521,9 +521,12 @@ function buildSlotsFromSources({ majorSteps, slotContents, primaryChain, sibling
? slotContents.find((s) => Number(s.major_step_index) === i)
: null
const hasSavedSlotContents = Array.isArray(slotContents) && slotContents.length > 0
let primary = saved?.primary
? slotExerciseFromApi(saved.primary)
: chainNodeToLibrary(primaryChain?.nodes?.[i])
: hasSavedSlotContents
? emptySlotExercise()
: chainNodeToLibrary(primaryChain?.nodes?.[i])
if (primary.kind === 'empty' && saved?.primary) {
primary = slotExerciseFromApi(saved.primary)
@@ -760,7 +763,10 @@ export function applyMatchStepsToSlots(draft, apiSteps) {
touchedMajors.add(idx)
const isProposal = Boolean(step.is_ai_proposal) || step.exercise_id == null
if (isProposal) {
const hasAiPayload = Boolean(step.ai_suggestion) || Boolean(step.proposal_key)
if (isProposal && !hasAiPayload) {
nextSlots[idx].primary = emptySlotExercise()
} else if (isProposal) {
nextSlots[idx].primary = proposalSlotExercise({
title: step.title || nextSlots[idx].learning_goal,
proposalKey: step.proposal_key,
@@ -804,7 +810,7 @@ export function applyGapOffersFromResponse(draft, res, { replaceOffTopicSlots =
offer?.replace_step_index != null
if (!isOffTopicReplace) {
if (primary?.kind === 'library' && primary.exerciseId != null) continue
if (primary?.kind === 'proposal') continue
if (primary?.kind === 'proposal' && primary.aiSuggestion) continue
}
next = applyGapOfferToSlot(next, idx, offer)