Implement Phase B Enhancements for Planning Exercise Profiles
Test Suite / playwright-tests (push) Waiting to run
Deploy Development / deploy (push) Successful in 42s
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) Has been cancelled

- Added support for section guidance notes and titles in the planning target profile, enabling richer context for exercise suggestions.
- Introduced deterministic text-to-catalog signal mapping, allowing for improved integration of planning text signals into the exercise retrieval process.
- Implemented a partner-related filter in exercise retrieval, enhancing the relevance of suggested exercises based on user intent.
- Updated the retrieval phase to account for text signals, improving the accuracy of exercise recommendations.
- Incremented version to 0.8.181 and updated changelog to reflect these significant enhancements in planning AI capabilities.
This commit is contained in:
Lars committed 2026-05-23 10:26:03 +02:00
1 parent 46fae3da33
commit a0a891e550
8 files changed
+328 -4

No files matched your search

+17 -1
View File
@@ -17,6 +17,17 @@ from planning_exercise_profiles import (
_MAX_LIBRARY_ROWS = 8000
_PROFILE_LOAD_BATCH = 400
_PARTNER_TEXT_MARKERS = ("partner", "paar", "paarweise", "zu zweit")
def _exercise_looks_partner_related(row: Mapping[str, Any]) -> bool:
parts = [
str(row.get("method_archetype") or ""),
str(row.get("title") or ""),
str(row.get("summary") or ""),
]
blob = " ".join(parts).lower()
return any(m in blob for m in _PARTNER_TEXT_MARKERS)
def _skill_jaccard(a: Set[int], b: Set[int]) -> float:
@@ -72,7 +83,7 @@ def fetch_all_visible_exercise_rows(
params.extend(ek_filtered)
sql = f"""
SELECT e.id, e.title, e.summary,
SELECT e.id, e.title, e.summary, e.method_archetype,
(
SELECT fa.name FROM exercise_focus_areas efa
JOIN focus_areas fa ON fa.id = efa.focus_area_id
@@ -139,6 +150,7 @@ def rank_visible_library_hits(
anchor_skills = set(pack.get("anchor_skill_ids") or [])
anchor_id = pack.get("anchor_exercise_id")
progression_notes = pack.get("progression_edge_notes") or {}
requires_partner = pack.get("requires_partner")
last_planned_skills: Set[int] = set()
planned_ids = pack.get("planned_exercise_ids") or []
@@ -154,6 +166,10 @@ def rank_visible_library_hits(
eid = int(row["id"])
if anchor_id and eid == int(anchor_id):
continue
if requires_partner is True and not _exercise_looks_partner_related(row):
continue
if requires_partner is False and _exercise_looks_partner_related(row):
continue
cand_rows.append(row)
cand_ids = [int(r["id"]) for r in cand_rows]