Add Gap Offer Handling and UI Enhancements in Progression Graph Components
Deploy Development / deploy (push) Successful in 46s
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 1m18s

- Implemented `_build_evaluate_empty_slot_gap_specs` function to generate gap offer specifications for unfilled roadmap slots in evaluate-only mode.
- Enhanced `ProgressionFindingsPanel` to display AI offers for empty slots and gaps, improving user interaction and clarity.
- Updated `ProgressionGraphEditor` and `ProgressionSlotCard` components to support new functionalities for managing slots and offers.
- Refactored utility functions in `progressionGraphDraft.js` to streamline slot management and offer handling.
- Incremented application version to reflect these updates.
This commit is contained in:
Lars committed 2026-06-10 15:34:37 +02:00
1 parent 97efe66306
commit c1bf9279ad
7 files changed
+914 -206

No files matched your search

+62
View File
@@ -668,6 +668,47 @@ def _evaluate_steps_from_payload(
return steps
def _build_evaluate_empty_slot_gap_specs(
steps: List[Dict[str, Any]],
*,
goal_query: str,
) -> List[Dict[str, Any]]:
"""Gap-Angebote für leere Roadmap-Slots im evaluate_only-Modus."""
specs: List[Dict[str, Any]] = []
for step in steps:
if step.get("exercise_id") is not None:
continue
major_idx = step.get("roadmap_major_step_index")
if major_idx is None:
continue
try:
roadmap_idx = int(major_idx)
except (TypeError, ValueError):
continue
phase = (step.get("roadmap_phase") or "vertiefung").strip().lower()
learning_goal = (step.get("roadmap_learning_goal") or step.get("title") or "").strip()
title_hint = learning_goal[:120] if learning_goal else f"Slot {roadmap_idx + 1}"
specs.append(
{
"source": "roadmap_unfilled",
"insert_after_index": max(roadmap_idx - 1, -1),
"gap": {
"expected_phase": phase,
"roadmap_major_step_index": roadmap_idx,
"learning_goal": learning_goal,
},
"phase": phase,
"title_hint": title_hint,
"sketch": learning_goal or title_hint,
"rationale": (
f"Slot {roadmap_idx + 1} ohne Übung — KI-Entwurf für diese Roadmap-Stufe."
),
"roadmap_major_step_index": roadmap_idx,
}
)
return specs[:8]
def _run_evaluate_only_path_qa(
cur,
*,
@@ -728,6 +769,27 @@ def _run_evaluate_only_path_qa(
brief=semantic_brief,
goal_query=goal_query,
)
empty_slot_specs = _build_evaluate_empty_slot_gap_specs(
steps,
goal_query=goal_query,
)
seen_spec_keys = {
(
s.get("source"),
s.get("roadmap_major_step_index"),
s.get("insert_after_index"),
)
for s in gap_specs
}
for spec in empty_slot_specs:
key = (
spec.get("source"),
spec.get("roadmap_major_step_index"),
spec.get("insert_after_index"),
)
if key not in seen_spec_keys:
gap_specs.append(spec)
seen_spec_keys.add(key)
path_roadmap_snapshot = None
if roadmap_ctx:
path_roadmap_snapshot = build_progression_gap_snapshot(
@@ -2,7 +2,7 @@
from __future__ import annotations
import json
from typing import Any, Dict, Optional
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field, field_validator
@@ -34,3 +34,26 @@ def test_normalize_planning_roadmap_with_progression_roadmap():
def test_normalize_rejects_invalid_type():
with pytest.raises(ValueError, match="JSON-Objekt"):
normalize_planning_roadmap_payload("not-json")
def test_normalize_slot_contents():
out = normalize_planning_roadmap_payload(
{
"goal_query": "Gerade-Tritt",
"max_steps": 3,
"slot_contents": [
{
"major_step_index": 0,
"primary": {"kind": "library", "exercise_id": 12, "title": "Grundstellung"},
"siblings": [],
},
{
"major_step_index": 1,
"primary": {"kind": "proposal", "title": "KI-Entwurf", "proposal_key": "p1"},
"siblings": [],
},
],
}
)
assert len(out["slot_contents"]) == 2
assert out["slot_contents"][1]["primary"]["kind"] == "proposal"