Enhance Planning Context with Progression Gap Snapshot and Start/Target Analysis
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Successful in 1m13s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Successful in 1m13s
- Introduced `build_progression_gap_snapshot` function to create a compact roadmap context for gap exercises, integrating start situation, target state, and stage specifications. - Updated `build_gap_fill_goal_text` to include roadmap snapshot details, enhancing the context for AI-generated exercises. - Enhanced `ProgressionPathSuggestRequest` and related components to support new structured inputs for start/target analysis, improving user experience and AI suggestions. - Incremented application version to 0.8.212 to reflect these changes.
This commit is contained in:
1 parent
fad1058d54
commit
f2650dac57
11 files changed
+505
-25
No files matched your search
@@ -12,7 +12,8 @@ from ai_prompt_job import run_exercise_form_ai_suggestion
|
||||
from exercise_ai import strip_html_to_plain
|
||||
|
||||
from planning_exercise_path_qa import find_step_pair_index
|
||||
from planning_exercise_semantics import PlanningSemanticBrief
|
||||
from planning_exercise_form_context import build_progression_gap_snapshot
|
||||
from planning_exercise_semantics import PlanningSemanticBrief, brief_to_summary_dict
|
||||
|
||||
_logger = logging.getLogger("shinkan.planning_exercise_path_ai_fill")
|
||||
|
||||
@@ -265,27 +266,62 @@ def build_gap_fill_goal_text(
|
||||
spec: Mapping[str, Any],
|
||||
step_a: Optional[Mapping[str, Any]] = None,
|
||||
step_b: Optional[Mapping[str, Any]] = None,
|
||||
roadmap_snapshot: Optional[Mapping[str, Any]] = None,
|
||||
) -> str:
|
||||
"""Ausführlicher Zieltext für KI-Neuanlage aus dem Pfad-Kontext."""
|
||||
"""Ausführlicher Zieltext für KI-Neuanlage aus Pfad-, Roadmap- und Stufen-Kontext."""
|
||||
topic = (brief.primary_topic or "Technik").strip()
|
||||
phase = spec.get("phase") or "vertiefung"
|
||||
from_title = (step_a or {}).get("title") or spec.get("from_title") or "vorherigem Schritt"
|
||||
to_title = (step_b or {}).get("title") or spec.get("to_title") or "nächstem Schritt"
|
||||
arc = ", ".join(brief.development_arc or []) or "einstieg → grundlage → vertiefung → anwendung → perfektion"
|
||||
snap = dict(roadmap_snapshot or {})
|
||||
if not snap:
|
||||
snap = build_progression_gap_snapshot(semantic_brief=brief_to_summary_dict(brief))
|
||||
|
||||
parts = [
|
||||
f"Planungsziel (gesamter Pfad): {goal_query}",
|
||||
f"Hauptthema: {topic}",
|
||||
f"Entwicklungsphase dieser Übung: {phase}",
|
||||
f"Erwarteter Entwicklungsbogen: {arc}",
|
||||
f"Einordnung: didaktische Zwischenstufe zwischen „{from_title}“ und „{to_title}“.",
|
||||
f"Hauptthema: {snap.get('primary_topic') or topic}",
|
||||
]
|
||||
if snap.get("start_situation"):
|
||||
parts.append(f"Voraussetzung / Ausgangslage (Progression): {snap['start_situation']}")
|
||||
if snap.get("target_state"):
|
||||
parts.append(f"Gesamtziel der Progression: {snap['target_state']}")
|
||||
if snap.get("roadmap_notes"):
|
||||
parts.append(f"Ergänzender Kontext: {snap['roadmap_notes']}")
|
||||
stage_goal = snap.get("stage_learning_goal") or spec.get("title_hint")
|
||||
if stage_goal:
|
||||
parts.append(f"Lernziel dieser Roadmap-Stufe: {stage_goal}")
|
||||
parts.extend(
|
||||
[
|
||||
f"Entwicklungsphase dieser Übung: {snap.get('stage_phase') or phase}",
|
||||
f"Erwarteter Entwicklungsbogen: {arc}",
|
||||
f"Einordnung: didaktische Zwischenstufe zwischen „{from_title}“ und „{to_title}“.",
|
||||
]
|
||||
)
|
||||
if snap.get("stage_load_profile"):
|
||||
parts.append(f"Belastungsschwerpunkte: {', '.join(snap['stage_load_profile'])}")
|
||||
if snap.get("stage_success_criteria"):
|
||||
parts.append(
|
||||
"Erfolgskriterien dieser Stufe: "
|
||||
+ "; ".join(str(x) for x in snap["stage_success_criteria"][:4])
|
||||
)
|
||||
if snap.get("stage_anti_patterns"):
|
||||
parts.append(
|
||||
"Vermeiden: " + "; ".join(str(x) for x in snap["stage_anti_patterns"][:3])
|
||||
)
|
||||
if snap.get("skill_hints"):
|
||||
parts.append(
|
||||
"Fähigkeiten-/Fokus-Hinweise: "
|
||||
+ "; ".join(str(x) for x in snap["skill_hints"][:4])
|
||||
)
|
||||
if spec.get("rationale"):
|
||||
parts.append(f"Qualitätsprüfung: {spec['rationale']}")
|
||||
if spec.get("sketch"):
|
||||
parts.append(f"Skizze: {spec['sketch']}")
|
||||
parts.append(
|
||||
"Die Übung muss einen klaren, trainierbaren Bezug zum Hauptthema haben — "
|
||||
"keine generische Kraftübung ohne Technikbezug. Konkrete Durchführung, Ziel und Trainerhinweise ausformulieren."
|
||||
"Die Übung muss die Stufe didaktisch erfüllen: klare Voraussetzungen, messbares Stufenziel, "
|
||||
"Bezug zum Gesamtpfad — keine generische Kraftübung ohne Technikbezug. "
|
||||
"Konkrete Durchführung, Ziel und Trainerhinweise ausformulieren."
|
||||
)
|
||||
return "\n\n".join(parts)[:8000]
|
||||
|
||||
@@ -297,6 +333,7 @@ def build_gap_fill_offer(
|
||||
goal_query: str = "",
|
||||
brief: Optional[PlanningSemanticBrief] = None,
|
||||
proposal: Optional[Mapping[str, Any]] = None,
|
||||
roadmap_snapshot: Optional[Mapping[str, Any]] = None,
|
||||
) -> Dict[str, Any]:
|
||||
idx = int(spec.get("insert_after_index") or 0)
|
||||
offer_id = f"{spec.get('source')}-{idx}-{uuid.uuid4().hex[:8]}"
|
||||
@@ -310,6 +347,7 @@ def build_gap_fill_offer(
|
||||
spec=spec,
|
||||
step_a=step_a,
|
||||
step_b=step_b,
|
||||
roadmap_snapshot=roadmap_snapshot,
|
||||
)
|
||||
offer: Dict[str, Any] = {
|
||||
"offer_id": offer_id,
|
||||
@@ -345,6 +383,7 @@ def apply_gap_fill_after_qa(
|
||||
include_ai_calls: bool = True,
|
||||
max_ai_proposals: int = 3,
|
||||
auto_insert_proposals: bool = False,
|
||||
roadmap_snapshot: Optional[Mapping[str, Any]] = None,
|
||||
) -> Tuple[List[Dict[str, Any]], List[Dict[str, Any]], List[Dict[str, Any]]]:
|
||||
"""
|
||||
Erzeugt gap_fill_offers für die UI; optional KI-Vorschläge einfügen.
|
||||
@@ -370,6 +409,7 @@ def apply_gap_fill_after_qa(
|
||||
goal_query=goal_query,
|
||||
brief=brief,
|
||||
proposal=None,
|
||||
roadmap_snapshot=roadmap_snapshot,
|
||||
)
|
||||
offers.append(offer)
|
||||
continue
|
||||
@@ -397,6 +437,7 @@ def apply_gap_fill_after_qa(
|
||||
goal_query=goal_query,
|
||||
brief=brief,
|
||||
proposal=proposal,
|
||||
roadmap_snapshot=roadmap_snapshot,
|
||||
)
|
||||
offers.append(offer)
|
||||
|
||||
|
||||
Reference in new issue
Block a user