Enhance Roadmap Slot Matching and Off-Topic Detection
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 36s
Test Suite / playwright-tests (push) Successful in 1m23s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 36s
Test Suite / playwright-tests (push) Successful in 1m23s
- Introduced `auto_rematch_after_qa` parameter in `ProgressionPathSuggestRequest` to enable automatic rematching after quality assurance checks. - Refactored roadmap slot matching logic to improve clarity and functionality, renaming `_build_steps_roadmap_first` to `_match_roadmap_slot`. - Added `_with_roadmap_major_index` utility to streamline off-topic step detection by incorporating roadmap major step indices. - Enhanced off-topic detection logic to utilize the new utility for improved clarity in identifying mismatches and exclusions. - Incremented application version to reflect these updates.
This commit is contained in:
1 parent
a152218c45
commit
1d94c2ebf1
4 files changed
+635
-173
No files matched your search
@@ -398,6 +398,16 @@ def apply_llm_path_reorder(
|
||||
_OFF_TOPIC_SEMANTIC_MAX = 0.10
|
||||
|
||||
|
||||
def _with_roadmap_major_index(
|
||||
step: Mapping[str, Any],
|
||||
entry: Dict[str, Any],
|
||||
) -> Dict[str, Any]:
|
||||
midx = step.get("roadmap_major_step_index")
|
||||
if midx is not None:
|
||||
entry["roadmap_major_step_index"] = int(midx)
|
||||
return entry
|
||||
|
||||
|
||||
def detect_off_topic_steps(
|
||||
cur,
|
||||
steps: Sequence[Mapping[str, Any]],
|
||||
@@ -425,15 +435,18 @@ def detect_off_topic_steps(
|
||||
step_anti = list(step.get("roadmap_anti_patterns") or []) + path_anti
|
||||
if step_anti and _blob_matches_stage_excludes(blob, step_anti):
|
||||
off_topic.append(
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": 0.0,
|
||||
"expected_phase": (step.get("roadmap_phase") or "").strip().lower() or None,
|
||||
"issue": "path_exclude",
|
||||
"reasons": ["Widerspricht Pfad-Ausschlüssen (z. B. Kumite)"],
|
||||
}
|
||||
_with_roadmap_major_index(
|
||||
step,
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": 0.0,
|
||||
"expected_phase": (step.get("roadmap_phase") or "").strip().lower() or None,
|
||||
"issue": "path_exclude",
|
||||
"reasons": ["Widerspricht Pfad-Ausschlüssen (z. B. Kumite)"],
|
||||
},
|
||||
)
|
||||
)
|
||||
continue
|
||||
primary = (brief.primary_topic or "").strip()
|
||||
@@ -450,15 +463,18 @@ def detect_off_topic_steps(
|
||||
relaxed=False,
|
||||
):
|
||||
off_topic.append(
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": 0.0,
|
||||
"expected_phase": (step.get("roadmap_phase") or "").strip().lower() or None,
|
||||
"issue": "technique_scope",
|
||||
"reasons": [f"Passt nicht zur Haupttechnik „{primary}“"],
|
||||
}
|
||||
_with_roadmap_major_index(
|
||||
step,
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": 0.0,
|
||||
"expected_phase": (step.get("roadmap_phase") or "").strip().lower() or None,
|
||||
"issue": "technique_scope",
|
||||
"reasons": [f"Passt nicht zur Haupttechnik „{primary}“"],
|
||||
},
|
||||
)
|
||||
)
|
||||
continue
|
||||
stage_goal = (step.get("roadmap_learning_goal") or "").strip()
|
||||
@@ -488,16 +504,19 @@ def detect_off_topic_steps(
|
||||
anti_patterns=stage_anti or None,
|
||||
):
|
||||
off_topic.append(
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": round(sem, 4),
|
||||
"expected_phase": phase,
|
||||
"issue": "stage_mismatch",
|
||||
"roadmap_learning_goal": stage_goal,
|
||||
"reasons": sem_reasons[:3],
|
||||
}
|
||||
_with_roadmap_major_index(
|
||||
step,
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": round(sem, 4),
|
||||
"expected_phase": phase,
|
||||
"issue": "stage_mismatch",
|
||||
"roadmap_learning_goal": stage_goal,
|
||||
"reasons": sem_reasons[:3],
|
||||
},
|
||||
)
|
||||
)
|
||||
continue
|
||||
if exercise_passes_path_semantic_gate(
|
||||
@@ -512,15 +531,18 @@ def detect_off_topic_steps(
|
||||
if sem > _OFF_TOPIC_SEMANTIC_MAX:
|
||||
continue
|
||||
off_topic.append(
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": round(sem, 4),
|
||||
"expected_phase": phase,
|
||||
"issue": "off_topic",
|
||||
"reasons": sem_reasons[:3],
|
||||
}
|
||||
_with_roadmap_major_index(
|
||||
step,
|
||||
{
|
||||
"step_index": idx,
|
||||
"exercise_id": int(step["exercise_id"]),
|
||||
"title": step.get("title") or bundle["title"],
|
||||
"semantic_score": round(sem, 4),
|
||||
"expected_phase": phase,
|
||||
"issue": "off_topic",
|
||||
"reasons": sem_reasons[:3],
|
||||
},
|
||||
)
|
||||
)
|
||||
return off_topic
|
||||
|
||||
|
||||
Reference in new issue
Block a user