Enhance Planning Exercise Profiles and Context Handling
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m14s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m14s
- Introduced new functions to generate skill profiles from exercise IDs, improving the ability to summarize skills for both units and sections. - Updated the planning target profile to incorporate section-specific exercise IDs, allowing for more granular skill tracking and context. - Enhanced the ExercisePickerModal and related pages to support section context, including titles, guidance notes, and exercise counts. - Implemented expectation mode handling in the planning target pipeline to differentiate between planning references and query-only scenarios. - Incremented version to 0.8.174 and updated changelog to reflect these enhancements in planning AI capabilities.
This commit is contained in:
1 parent
8e68261bc1
commit
04cc77d501
8 files changed
+361
-18
No files matched your search
@@ -293,11 +293,50 @@ def _profile_from_unit_occurrences(cur, unit_id: int) -> Dict[int, float]:
|
||||
return _skill_weights_from_profile(prof.get("skills") or [])
|
||||
|
||||
|
||||
def _profile_from_exercise_ids(cur, exercise_ids: Sequence[int]) -> Dict[int, float]:
|
||||
ids = [int(x) for x in exercise_ids if int(x) > 0]
|
||||
if not ids:
|
||||
return {}
|
||||
occ = [ExerciseOccurrence(exercise_id=eid) for eid in ids]
|
||||
prof = profile_for_occurrences(cur, occ, reference_max_by_skill=None)
|
||||
return _skill_weights_from_profile(prof.get("skills") or [])
|
||||
|
||||
|
||||
def skill_profile_summary_from_exercise_ids(
|
||||
cur,
|
||||
exercise_ids: Sequence[int],
|
||||
*,
|
||||
limit_skills: int = 8,
|
||||
) -> Dict[str, Any]:
|
||||
"""Kompaktes Fähigkeitenprofil für LLM-Kontext und UI."""
|
||||
ids = [int(x) for x in exercise_ids if int(x) > 0]
|
||||
if not ids:
|
||||
return {"exercise_count": 0, "skills": []}
|
||||
occ = [ExerciseOccurrence(exercise_id=eid) for eid in ids]
|
||||
prof = profile_for_occurrences(cur, occ, reference_max_by_skill=None)
|
||||
skills_out = prof.get("skills") or []
|
||||
top = sorted(skills_out, key=lambda s: -float(s.get("weight") or s.get("score") or 0))[:limit_skills]
|
||||
names = _load_skill_names(cur, [int(s["skill_id"]) for s in top if s.get("skill_id") is not None])
|
||||
return {
|
||||
"exercise_count": len(ids),
|
||||
"skills": [
|
||||
{
|
||||
"skill_id": int(s["skill_id"]),
|
||||
"name": names.get(int(s["skill_id"]), f"#{s['skill_id']}"),
|
||||
"weight": round(float(s.get("weight") or s.get("score") or 0), 3),
|
||||
}
|
||||
for s in top
|
||||
if s.get("skill_id") is not None
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def build_planning_target_profile(
|
||||
cur,
|
||||
*,
|
||||
unit: Dict[str, Any],
|
||||
planned_exercise_ids: Sequence[int],
|
||||
section_planned_exercise_ids: Optional[Sequence[int]] = None,
|
||||
anchor_exercise_id: Optional[int],
|
||||
intent: str,
|
||||
) -> PlanningTargetProfile:
|
||||
@@ -356,6 +395,13 @@ def build_planning_target_profile(
|
||||
if skill_plan:
|
||||
sources.append("current_unit_plan")
|
||||
|
||||
section_ids = [int(x) for x in (section_planned_exercise_ids or []) if int(x) > 0]
|
||||
if section_ids:
|
||||
section_skills = _profile_from_exercise_ids(cur, section_ids)
|
||||
if section_skills:
|
||||
skill_target = _merge_weight_maps(skill_target, section_skills, scale=1.0)
|
||||
sources.append("current_section_plan")
|
||||
|
||||
if anchor_exercise_id:
|
||||
anchor_profiles = load_exercise_match_profiles_bulk(cur, [int(anchor_exercise_id)])
|
||||
ap = anchor_profiles.get(int(anchor_exercise_id))
|
||||
|
||||
Reference in new issue
Block a user