Enhance Progression Path Suggestion with Stage Specification Refinement
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m16s
- Introduced `auto_refine_stage_spec` to `ProgressionPathSuggestRequest`, enabling optional refinement of stage specifications during the rematch process. - Updated `_run_roadmap_rematch_loop` to incorporate stage specification refinements, logging changes for better tracking of adjustments made during rematching. - Enhanced `suggest_progression_path` to include refine logs in the output, providing clearer insights into the refinement process. - Added utility functions for formatting refine log entries, improving the display of refinement actions in the frontend components. - Updated frontend components to display refine logs, enhancing user feedback on stage specification adjustments during progression analysis. - Bumped version to 0.8.227 to reflect the new features and improvements.
This commit is contained in:
1 parent
de9fdf3ac0
commit
f36a747efa
7 files changed
+417
-4
No files matched your search
@@ -23,6 +23,7 @@ from planning_path_rematch import (
|
||||
prune_stripped_after_rematch,
|
||||
rematch_roadmap_slots,
|
||||
)
|
||||
from planning_path_refine_stage import apply_stage_spec_refinements, collect_refine_stage_targets
|
||||
from planning_stage_context import build_contextualized_stage_goal, resolve_path_start_target
|
||||
from planning_exercise_path_qa import (
|
||||
apply_llm_path_reorder,
|
||||
@@ -108,6 +109,7 @@ class ProgressionPathSuggestRequest(BaseModel):
|
||||
include_llm_intent: bool = True
|
||||
include_path_qa: bool = True
|
||||
auto_rematch_after_qa: bool = True
|
||||
auto_refine_stage_spec: bool = True
|
||||
max_rematch_rounds: int = Field(default=2, ge=0, le=3)
|
||||
include_llm_path_qa: bool = True
|
||||
include_path_reorder: bool = True
|
||||
@@ -1268,9 +1270,11 @@ def _run_roadmap_rematch_loop(
|
||||
List[Dict[str, Any]],
|
||||
int,
|
||||
List[Tuple[int, StageSpecArtifact]],
|
||||
List[Dict[str, Any]],
|
||||
]:
|
||||
"""Phase A/B: Rematch-Schleife aus Strip, unfilled Slots und optimization_hints."""
|
||||
"""Phase A/B/C: Rematch-Schleife mit optionaler Stufen-Spec-Verfeinerung."""
|
||||
rematch_log: List[Dict[str, Any]] = []
|
||||
refine_log: List[Dict[str, Any]] = []
|
||||
rematch_rounds = 0
|
||||
max_rounds = int(body.max_rematch_rounds or 0)
|
||||
if not body.auto_rematch_after_qa or max_rounds <= 0 or not roadmap_ctx.stage_specs:
|
||||
@@ -1280,7 +1284,15 @@ def _run_roadmap_rematch_loop(
|
||||
brief=semantic_brief,
|
||||
goal_query=goal_query,
|
||||
)
|
||||
return steps, rematch_log, stripped_off_topic, off_topic_steps, rematch_rounds, roadmap_unfilled
|
||||
return (
|
||||
steps,
|
||||
rematch_log,
|
||||
stripped_off_topic,
|
||||
off_topic_steps,
|
||||
rematch_rounds,
|
||||
roadmap_unfilled,
|
||||
refine_log,
|
||||
)
|
||||
|
||||
current_stripped = list(stripped_off_topic or [])
|
||||
use_initial_off_topic = not current_stripped
|
||||
@@ -1297,6 +1309,20 @@ def _run_roadmap_rematch_loop(
|
||||
)
|
||||
optimization_hints = list(mini_qa.get("optimization_hints") or [])
|
||||
|
||||
if body.auto_refine_stage_spec:
|
||||
_, round_refine = apply_stage_spec_refinements(
|
||||
roadmap_ctx,
|
||||
optimization_hints=optimization_hints,
|
||||
off_topic_steps=off_topic_steps if round_idx > 0 else off_topic_before_strip,
|
||||
goal_query=goal_query,
|
||||
semantic_brief=semantic_brief,
|
||||
)
|
||||
if round_refine:
|
||||
for entry in round_refine:
|
||||
tagged = dict(entry)
|
||||
tagged["round"] = rematch_rounds + 1
|
||||
refine_log.append(tagged)
|
||||
|
||||
slot_indices, rematch_reasons = collect_rematch_slot_indices(
|
||||
stripped_off_topic=current_stripped if round_idx == 0 else [],
|
||||
off_topic_steps=off_topic_before_strip if round_idx == 0 and use_initial_off_topic else [],
|
||||
@@ -1304,6 +1330,16 @@ def _run_roadmap_rematch_loop(
|
||||
stage_specs=roadmap_ctx.stage_specs,
|
||||
roadmap_unfilled=roadmap_unfilled,
|
||||
)
|
||||
if body.auto_refine_stage_spec:
|
||||
refine_targets = collect_refine_stage_targets(
|
||||
optimization_hints=optimization_hints,
|
||||
off_topic_steps=off_topic_steps if round_idx > 0 else off_topic_before_strip,
|
||||
stage_specs=roadmap_ctx.stage_specs,
|
||||
)
|
||||
for midx in refine_targets:
|
||||
slot_indices.add(int(midx))
|
||||
if int(midx) not in rematch_reasons:
|
||||
rematch_reasons[int(midx)] = "refine_stage_spec"
|
||||
if not slot_indices:
|
||||
break
|
||||
|
||||
@@ -1358,6 +1394,7 @@ def _run_roadmap_rematch_loop(
|
||||
off_topic_steps,
|
||||
rematch_rounds,
|
||||
roadmap_unfilled,
|
||||
refine_log,
|
||||
)
|
||||
|
||||
|
||||
@@ -1967,6 +2004,7 @@ def suggest_progression_path(
|
||||
off_topic_steps: List[Dict[str, Any]] = []
|
||||
stripped_off_topic: List[Dict[str, Any]] = []
|
||||
rematch_log: List[Dict[str, Any]] = []
|
||||
refine_log: List[Dict[str, Any]] = []
|
||||
rematch_rounds = 0
|
||||
llm_qa: Optional[Dict[str, Any]] = None
|
||||
llm_qa_applied = False
|
||||
@@ -2062,6 +2100,7 @@ def suggest_progression_path(
|
||||
rematch_off_topic,
|
||||
rematch_rounds,
|
||||
roadmap_unfilled,
|
||||
refine_log,
|
||||
) = _run_roadmap_rematch_loop(
|
||||
cur,
|
||||
tenant=tenant,
|
||||
@@ -2162,6 +2201,10 @@ def suggest_progression_path(
|
||||
path_qa["rematch_applied"] = True
|
||||
path_qa["rematch_log"] = rematch_log
|
||||
path_qa["rematch_rounds"] = rematch_rounds
|
||||
if refine_log:
|
||||
path_qa["refine_applied"] = True
|
||||
path_qa["refine_log"] = refine_log
|
||||
path_qa["refine_count"] = len(refine_log)
|
||||
|
||||
if roadmap_first and roadmap_ctx is not None:
|
||||
steps = _normalize_roadmap_steps_coverage(
|
||||
@@ -2261,6 +2304,8 @@ def suggest_progression_path(
|
||||
retrieval_parts.append("roadmap_unfilled")
|
||||
if rematch_log:
|
||||
retrieval_parts.append("path_rematch")
|
||||
if refine_log:
|
||||
retrieval_parts.append("stage_spec_refine")
|
||||
|
||||
return {
|
||||
"goal_query": goal_query,
|
||||
|
||||
Reference in new issue
Block a user