Enhance Progression Path Suggestion with Planning Catalog Context Integration
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m16s

- Introduced `planning_catalog_context` to `ProgressionPathSuggestRequest` for improved handling of catalog-related data during path suggestions.
- Implemented `_resolve_planning_catalog_context` to retrieve and validate the planning catalog context, enhancing the robustness of the suggestion process.
- Updated `_build_path_target_profile` to incorporate catalog context, enriching target profiles with relevant planning data.
- Enhanced frontend components in `ProgressionGraphEditor` to manage and display planning catalog context, including new selection options for focus areas, style directions, training types, and target groups.
- Added utility functions for parsing and transforming planning catalog context data for API interactions.
- Bumped version to 0.8.233 to reflect the new features and improvements.
This commit is contained in:
Lars committed 2026-06-12 10:16:55 +02:00
1 parent a4e73c830f
commit 6ab2f20f08
8 files changed
+441 -8

No files matched your search

+52 -2
View File
@@ -16,6 +16,13 @@ from tenant_context import (
library_content_visibility_for_progression_graph_sql,
library_content_visibility_sql,
)
from planning_catalog_context import (
ProgressionPlanningCatalogContext,
catalog_context_has_items,
enrich_target_from_planning_text_blobs,
load_catalog_context_from_graph_row,
merge_catalog_context_into_target,
)
from planning_exercise_profiles import PlanningTargetProfile
from planning_path_qa_pipeline import run_multistage_path_qa
from planning_path_rematch import (
@@ -133,6 +140,27 @@ class ProgressionPathSuggestRequest(BaseModel):
roadmap_notes: Optional[str] = Field(default=None, max_length=2000)
progression_graph_id: Optional[int] = Field(default=None, ge=1)
exercise_kind_any: Optional[List[str]] = None
planning_catalog_context: Optional[ProgressionPlanningCatalogContext] = None
def _resolve_planning_catalog_context(
cur,
body: ProgressionPathSuggestRequest,
) -> Optional[ProgressionPlanningCatalogContext]:
"""Request-Kontext oder gespeichertes Graph-Artefakt."""
if body.planning_catalog_context and catalog_context_has_items(body.planning_catalog_context):
return body.planning_catalog_context
gid = body.progression_graph_id
if not gid or int(gid) < 1:
return None
cur.execute(
"SELECT planning_roadmap FROM exercise_progression_graphs WHERE id = %s",
(int(gid),),
)
row = cur.fetchone()
if not row:
return None
return load_catalog_context_from_graph_row(row.get("planning_roadmap"))
def _roadmap_gap_snapshot_for_spec(
@@ -308,8 +336,12 @@ def _build_path_target_profile(
goal_query: str,
semantic_brief: PlanningSemanticBrief,
include_llm_intent: bool,
start_situation: Optional[str] = None,
target_state: Optional[str] = None,
roadmap_notes: Optional[str] = None,
catalog_context: Optional[ProgressionPlanningCatalogContext] = None,
) -> Tuple[PlanningTargetProfile, Dict[str, Any], str]:
"""Einmaliges Erwartungsprofil für den gesamten Pfad (Query + Semantik + Skills)."""
"""Einmaliges Erwartungsprofil für den gesamten Pfad (Query + Semantik + Katalog)."""
empty_unit = {
"id": None,
"framework_slot_id": None,
@@ -345,6 +377,20 @@ def _build_path_target_profile(
)
skill_weights = resolve_semantic_skill_weights(cur, semantic_brief)
target = enrich_target_with_semantic_expectations(target, skill_weights=skill_weights)
target = enrich_target_from_planning_text_blobs(
cur,
target,
goal_query,
start_situation,
target_state,
roadmap_notes,
)
if catalog_context and catalog_context_has_items(catalog_context):
target = merge_catalog_context_into_target(
target,
catalog_context,
emphasis="replace",
)
return target, query_intent_summary, intent
@@ -1051,7 +1097,7 @@ def _stage_validation_context_for_spec(
or ""
).strip()
path_tech_excludes = list(semantic_brief.exclude_phrases or [])
if path_primary:
if path_primary and semantic_brief.topic_type == "technique":
from planning_exercise_semantics import technique_sibling_excludes
for item in technique_sibling_excludes(path_primary):
@@ -2239,6 +2285,10 @@ def suggest_progression_path(
goal_query=goal_query,
semantic_brief=semantic_brief,
include_llm_intent=body.include_llm_intent,
start_situation=body.start_situation,
target_state=body.target_state,
roadmap_notes=body.roadmap_notes,
catalog_context=_resolve_planning_catalog_context(cur, body),
)
path_skill_expectations: Optional[Dict[str, Any]] = None
if roadmap_ctx and roadmap_ctx.goal_analysis: