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

- 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:
Lars committed 2026-05-22 23:00:31 +02:00
1 parent 8e68261bc1
commit 04cc77d501
8 files changed
+361 -18

No files matched your search

+28 -9
View File
@@ -224,14 +224,19 @@ def build_planning_target_with_query_pipeline(
*,
unit: Dict[str, Any],
planned_exercise_ids: List[int],
section_planned_exercise_ids: Optional[List[int]] = None,
anchor_exercise_id: Optional[int],
query: Optional[str],
heuristic_intent: str,
include_llm_intent: bool,
context_summary: Mapping[str, Any],
has_planning_reference: bool = True,
) -> Tuple[PlanningTargetProfile, str, str, Dict[str, Any]]:
"""
Returns: target_profile, resolved_intent, scenario_kind, query_intent_summary dict
Ohne Planungsbezug (keine Übungen/Anker/Rahmen): Erwartungsprofil primär aus Suchtext (query_only).
Mit Planungsbezug: hybrid aus Plan + optional Query-Overlay.
"""
scenario = classify_planning_scenario(query, heuristic_intent)
resolved_intent = heuristic_intent
@@ -239,13 +244,18 @@ def build_planning_target_with_query_pipeline(
parsed: Optional[PlanningQueryIntentParsed] = None
resolved_skills: List[Dict[str, Any]] = []
base = build_planning_target_profile(
cur,
unit=unit,
planned_exercise_ids=planned_exercise_ids,
anchor_exercise_id=anchor_exercise_id,
intent=heuristic_intent,
)
if has_planning_reference:
base = build_planning_target_profile(
cur,
unit=unit,
planned_exercise_ids=planned_exercise_ids,
section_planned_exercise_ids=section_planned_exercise_ids or [],
anchor_exercise_id=anchor_exercise_id,
intent=heuristic_intent,
)
else:
base = PlanningTargetProfile(sources=["query_only"])
base_summary = base.to_summary_dict(cur)
if should_run_llm_intent_pipeline(query, scenario, include_llm_intent=include_llm_intent):
@@ -273,6 +283,11 @@ def build_planning_target_with_query_pipeline(
focus, style, tt, tg, skills, resolved_skills = resolve_query_intent_catalog_ids(cur, parsed)
if focus or style or tt or tg or skills:
overlay_scenario = scenario
overlay_emphasis = parsed.emphasis
if not has_planning_reference:
overlay_scenario = SCENARIO_FREE_SEARCH
overlay_emphasis = "replace"
target = merge_query_overlay_into_target(
base,
focus=focus,
@@ -280,9 +295,12 @@ def build_planning_target_with_query_pipeline(
tt=tt,
tg=tg,
skills=skills,
emphasis=parsed.emphasis,
scenario=scenario,
emphasis=overlay_emphasis,
scenario=overlay_scenario,
)
elif not has_planning_reference and _normalize_query(query):
# Kein LLM, aber Freitext: leichtes Profil bleibt leer — Retrieval nutzt Volltext
target = PlanningTargetProfile(sources=["query_only"])
query_intent_summary: Dict[str, Any] = {
"scenario": scenario,
@@ -293,6 +311,7 @@ def build_planning_target_with_query_pipeline(
"rationale": (parsed.rationale if parsed else None),
"skill_hints_resolved": resolved_skills,
"requires_partner": parsed.requires_partner if parsed else None,
"expectation_mode": "planning_hybrid" if has_planning_reference else "query_only",
}
return target, resolved_intent, scenario, query_intent_summary