From 38b6d5498d288dc3340e2a960cf5d0c75e350ce3 Mon Sep 17 00:00:00 2001 From: sit002 Date: Tue, 2 Dec 2025 14:19:10 +0800 Subject: [PATCH] fix: calculate total from criteria scores instead of trusting LLM LLM sometimes returns inconsistent total values. Now we always compute total = sum(criteria.score) for accuracy. --- .autograde/llm_grade.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.autograde/llm_grade.py b/.autograde/llm_grade.py index f9aea73..af0b3a6 100644 --- a/.autograde/llm_grade.py +++ b/.autograde/llm_grade.py @@ -169,6 +169,12 @@ def main(): "confidence": 0.0 } + # 重新计算 total(不信任 LLM 返回的 total,使用各项得分之和) + criteria = resp.get("criteria", []) + if criteria: + calculated_total = sum(float(c.get("score", 0)) for c in criteria) + resp["total"] = round(calculated_total, 2) + # 边界带自动送审 try: rubric_data = json.loads(rubric_text)