fix: attribute descriptive review gaps to the named evidence target

This commit is contained in:
2026-10-17 20:44:50 +08:00
parent 14cef5c929
commit 5a6e5d47a0
2 changed files with 35 additions and 1 deletions
+7 -1
View File
@@ -1,4 +1,5 @@
from concurrent.futures import ThreadPoolExecutor, as_completed
import re
from sqlalchemy import and_, or_, select, update
@@ -258,8 +259,13 @@ def _score_criterion(db, batch, project, criterion, client, *, retriever, multi_
if result.score is None:
# The retrieval found body pages but the model judged them insufficient.
score.status, score.error = STATUS_NEEDS_REVIEW, "模型认为现有正文证据不足以判断该项,转教师复核。"
# Models normally write "误差分析(t1):缺少…", not just the bare
# label. Attribute those explanations to their target instead of marking
# every target as missing. Unknown explanations remain conservative.
declined = [target for target in targets if target["use"] == USE_CONTENT and
(not result.missing_evidence or target["label"] in result.missing_evidence)]
any(target["label"] in note or re.search(
r"(?<![A-Za-z0-9_])" + re.escape(target["target_id"]) + r"(?![A-Za-z0-9_])", note)
for note in result.missing_evidence)]
_record_evidence_gaps(score, declined or [target for target in targets if target["use"] == USE_CONTENT])
for gap in score.evidence_gaps:
gap["reason"] = result.reason