Enhance AI Gap Fill Logic and Progression Path Handling
Deploy Development / deploy (push) Successful in 49s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 15s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m14s

- Integrated `try_suggest_ai_stage_step` to suggest AI-generated gap fill steps based on user input, improving the automation of the planning process.
- Updated `_enrich_roadmap_unfilled_gap_offers` to conditionally include AI gap fill proposals, enhancing the offer generation logic.
- Implemented `_merge_gap_fill_offers_from_steps` to consolidate gap fill offers from various steps, ensuring a comprehensive list of available offers.
- Modified `ProgressionGraphEditor` to utilize the new merging logic for gap fill offers, improving the user experience in managing offers.
- Enhanced utility functions to streamline the collection and filtering of gap fill offers from API responses.
- Bumped version to reflect the new features and improvements.
This commit is contained in:
Lars committed 2026-06-13 08:36:53 +02:00
1 parent 3f130aa8ad
commit 89c6780294
3 files changed
+77 -22

No files matched your search

+41 -4
View File
@@ -47,6 +47,7 @@ from planning_exercise_path_ai_fill import (
apply_gap_fill_after_qa,
build_gap_fill_offer,
collect_gap_fill_specs,
try_suggest_ai_stage_step,
)
from planning_exercise_retrieval import run_multistage_planning_retrieval
from planning_exercise_semantics import (
@@ -1534,6 +1535,15 @@ def _enrich_roadmap_unfilled_gap_offers(
"KI-Entwurf für diese Stufe."
),
}
proposal = None
if body.include_ai_gap_fill:
proposal = try_suggest_ai_stage_step(
cur,
goal_query=goal_query,
brief=semantic_brief,
spec=spec,
steps=steps,
)
offer = build_gap_fill_offer(
spec=spec,
steps=steps,
@@ -2117,8 +2127,8 @@ def _run_evaluate_only_path_qa(
gap_specs,
goal_query=goal_query,
brief=semantic_brief,
include_ai_calls=False,
max_ai_proposals=0,
include_ai_calls=bool(body.include_ai_gap_fill),
max_ai_proposals=3,
auto_insert_proposals=False,
roadmap_snapshot=path_roadmap_snapshot,
)
@@ -2394,6 +2404,28 @@ def _evaluate_steps_for_compare_qa(
return suggest_progression_path(cur, tenant=tenant, body=eval_body)
def _merge_gap_fill_offers_from_steps(
steps: Sequence[Mapping[str, Any]],
offers: Sequence[Mapping[str, Any]],
) -> List[Dict[str, Any]]:
"""Gap-Angebote aus Schritt-gap_offer + Top-Level-Liste vereinigen."""
merged: List[Dict[str, Any]] = [dict(o) for o in offers or [] if isinstance(o, dict)]
seen = {o.get("offer_id") for o in merged if o.get("offer_id")}
for raw in steps or []:
if not isinstance(raw, dict):
continue
go = raw.get("gap_offer")
if not isinstance(go, dict):
continue
oid = go.get("offer_id")
if oid and oid in seen:
continue
if oid:
seen.add(oid)
merged.append(dict(go))
return merged
def _build_progression_compare_response(
baseline: Mapping[str, Any],
proposed: Mapping[str, Any],
@@ -2414,6 +2446,10 @@ def _build_progression_compare_response(
)
actionable_diffs = _actionable_slot_diffs(slot_diffs)
apply_steps = list(proposed_steps)
gap_fill_offers = _merge_gap_fill_offers_from_steps(
apply_steps,
proposed.get("gap_fill_offers") or [],
)
return {
**dict(proposed),
"comparison_mode": True,
@@ -2423,6 +2459,7 @@ def _build_progression_compare_response(
"proposed_steps_pipeline": proposed_steps,
"proposed_path_qa": fair_qa,
"proposed_path_qa_pipeline": pipeline_qa,
"gap_fill_offers": gap_fill_offers,
"slot_diffs": slot_diffs,
"slot_diffs_actionable": actionable_diffs,
"slot_diff_count": len(actionable_diffs),
@@ -2967,8 +3004,8 @@ def suggest_progression_path(
gap_specs,
goal_query=goal_query,
brief=semantic_brief,
include_ai_calls=False,
max_ai_proposals=0,
include_ai_calls=bool(body.include_ai_gap_fill),
max_ai_proposals=3,
auto_insert_proposals=False,
roadmap_snapshot=path_roadmap_snapshot,
)