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
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:
1 parent
044ce2ee60
commit
8f1dad53ab
5 files changed
+121
-8
No files matched your search
@@ -1414,7 +1414,10 @@ def suggest_progression_path(
|
||||
anchor_id = eid
|
||||
anchor_variant_id = step.get("variant_id")
|
||||
|
||||
if len(steps) < 2:
|
||||
stage_spec_count = len(roadmap_ctx.stage_specs or []) if roadmap_ctx else 0
|
||||
if roadmap_first and stage_spec_count >= 2:
|
||||
pass
|
||||
elif len(steps) < 2:
|
||||
raise HTTPException(
|
||||
status_code=422,
|
||||
detail="Zu wenig passende Übungen für einen Pfad (mindestens 2 Schritte). Ziel präzisieren oder max_steps senken.",
|
||||
@@ -1623,6 +1626,60 @@ def suggest_progression_path(
|
||||
roadmap_ctx=roadmap_ctx,
|
||||
max_steps=max_steps,
|
||||
)
|
||||
if body.include_ai_gap_fill:
|
||||
seen_offer_ids = {o.get("offer_id") for o in gap_fill_offers}
|
||||
for step in steps:
|
||||
if step.get("exercise_id") is not None:
|
||||
continue
|
||||
try:
|
||||
major_idx = int(step["roadmap_major_step_index"])
|
||||
except (TypeError, ValueError, KeyError):
|
||||
continue
|
||||
stage_spec = next(
|
||||
(
|
||||
s
|
||||
for s in (roadmap_ctx.stage_specs or [])
|
||||
if int(s.major_step_index) == major_idx
|
||||
),
|
||||
None,
|
||||
)
|
||||
if stage_spec is None:
|
||||
continue
|
||||
spec = {
|
||||
"source": "roadmap_unfilled",
|
||||
"insert_after_index": max(major_idx - 1, -1),
|
||||
"roadmap_major_step_index": major_idx,
|
||||
"phase": (step.get("roadmap_phase") or "vertiefung").strip().lower(),
|
||||
"title_hint": (stage_spec.learning_goal or step.get("title") or f"Slot {major_idx + 1}")[:120],
|
||||
"sketch": (stage_spec.learning_goal or "").strip(),
|
||||
"rationale": f"Slot {major_idx + 1} — keine passende Bibliotheks-Übung; KI-Entwurf für diese Stufe.",
|
||||
}
|
||||
offer = build_gap_fill_offer(
|
||||
spec=spec,
|
||||
steps=steps,
|
||||
goal_query=goal_query,
|
||||
brief=semantic_brief,
|
||||
proposal=None,
|
||||
roadmap_snapshot=_roadmap_gap_snapshot_for_spec(
|
||||
cur,
|
||||
roadmap_ctx,
|
||||
spec,
|
||||
goal_query=goal_query,
|
||||
semantic_brief=semantic_brief,
|
||||
),
|
||||
)
|
||||
if offer.get("offer_id") not in seen_offer_ids:
|
||||
gap_fill_offers.append(offer)
|
||||
seen_offer_ids.add(offer.get("offer_id"))
|
||||
|
||||
filled_library_steps = sum(1 for s in steps if s.get("exercise_id") is not None)
|
||||
match_summary = {
|
||||
"roadmap_first": roadmap_first,
|
||||
"library_matches": filled_library_steps,
|
||||
"slot_count": len(steps),
|
||||
"gap_fill_offer_count": len(gap_fill_offers),
|
||||
"roadmap_unfilled_count": len(roadmap_unfilled),
|
||||
}
|
||||
|
||||
target_profile_summary = path_target_profile.to_summary_dict(cur)
|
||||
retrieval_parts = ["profile_v1", "full_library", "path_builder", "semantics"]
|
||||
@@ -1667,6 +1724,7 @@ def suggest_progression_path(
|
||||
"roadmap_edited": roadmap_edited,
|
||||
"roadmap_unfilled_count": len(roadmap_unfilled),
|
||||
"path_skill_expectations": path_skill_expectations,
|
||||
"match_summary": match_summary,
|
||||
"retrieval_phase": "+".join(retrieval_parts),
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user