Implement Stage Learning Goal Features in Planning Exercise
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 43s
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 1m13s

- Added `semantic_brief_for_stage` function to enhance semantic briefs with stage learning goals for improved roadmap matching.
- Introduced `exercise_passes_stage_learning_goal_gate` to validate exercises against stage learning goals, enhancing relevance checks.
- Updated path retrieval and scoring logic to incorporate stage learning goals, allowing for more nuanced exercise selection.
- Enhanced UI to indicate weak matches with stage learning goals, improving user feedback on exercise relevance.
- Incremented application version to reflect these updates.
This commit is contained in:
Lars committed 2026-06-10 16:39:17 +02:00
1 parent 48d51c07c5
commit 18547613ea
8 files changed
+339 -44

No files matched your search

+22 -2
View File
@@ -17,6 +17,7 @@ from planning_exercise_profiles import (
from planning_exercise_semantics import (
PlanningSemanticBrief,
exercise_passes_path_semantic_gate,
exercise_passes_stage_learning_goal_gate,
score_exercise_semantic_relevance,
)
@@ -200,6 +201,8 @@ def rank_visible_library_hits(
semantic_brief = semantic_brief_raw
step_phase = pack.get("path_step_phase")
path_mode = pack.get("context_mode") == "progression_path"
stage_learning_goal = (pack.get("stage_learning_goal") or "").strip()
roadmap_stage_match = bool(pack.get("roadmap_stage_match"))
last_planned_skills: Set[int] = set()
planned_ids = pack.get("planned_exercise_ids") or []
@@ -279,6 +282,8 @@ def rank_visible_library_hits(
step_phase=step_phase,
)
score_penalty = 0.0
stage_match_reason: Optional[str] = None
if (
path_mode
and semantic_brief
@@ -293,8 +298,21 @@ def rank_visible_library_hits(
)
):
score_penalty = 0.42
else:
score_penalty = 0.0
if roadmap_stage_match and stage_learning_goal:
title_s = str(row.get("title") or "")
summary_s = str(row.get("summary") or "")
goal_s = goals_by_ex.get(eid, "")
if exercise_passes_stage_learning_goal_gate(
learning_goal=stage_learning_goal,
title=title_s,
summary=summary_s,
goal=goal_s,
semantic_score=semantic_score,
):
score_penalty = max(0.0, score_penalty - 0.08)
stage_match_reason = "Passt zum Stufen-Lernziel"
else:
score_penalty += 0.35
score = (
weights.get("semantic", 0.0) * semantic_score
@@ -309,6 +327,8 @@ def rank_visible_library_hits(
)
reasons: List[str] = []
if stage_match_reason:
reasons.append(stage_match_reason)
if semantic_score >= 0.35 and semantic_reasons:
for sr in semantic_reasons:
if sr not in reasons: