fix: include matching body sections despite nonempty semantic recall

This commit is contained in:
2026-10-17 20:15:54 +08:00
parent eb8c545090
commit 93ff9c8c8d
3 changed files with 46 additions and 4 deletions
+7 -1
View File
@@ -100,11 +100,17 @@ def _body_navigator(db, *, course_version_id, project_id, category):
label = normalize_heading(target.get("label") or "")
if not label:
return []
# A rubric often says simply "计划", while the actual section is future
# work. Expand only this concept; headings still have to exist in body text.
labels = [label]
plan_terms = ("计划", "后续改进", "后续工作", "未来工作", "下一阶段", "下一步")
if any(term in label for term in plan_terms):
labels.extend(plan_terms)
candidates = []
for heading, places in headings.items():
if not heading:
continue
if heading.startswith(label) or label.startswith(heading) or label in heading or heading in label:
if any(term in heading or heading in term for term in labels):
candidates.extend(places)
if not candidates:
return []