fix: retain chat compatibility with lightweight score results

This commit is contained in:
2026-10-18 12:21:42 +08:00
parent aa825231ba
commit 93bcd2d5b9
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -93,6 +93,7 @@ def test_get_scores_pages_projects_and_criteria(db, monkeypatch):
assert first_page["count"] == 2 and len(first_page["results"]) == 1 assert first_page["count"] == 2 and len(first_page["results"]) == 1
assert first_page["results"][0]["project_id"] == first.id assert first_page["results"][0]["project_id"] == first.id
assert len(first_page["results"][0]["rows"]) == 6 assert len(first_page["results"][0]["rows"]) == 6
assert first_page["results"][0]["rows"][0]["status_label"] == "模型已评分"
assert first_page["next_criterion_offset"] == 6 and first_page["next_project_offset"] == 1 assert first_page["next_criterion_offset"] == 6 and first_page["next_project_offset"] == 1
assert first_page["citations"][0]["url"] is None assert first_page["citations"][0]["url"] is None
assert first_page["citations"][0]["image_url"] is None assert first_page["citations"][0]["image_url"] is None
+2 -2
View File
@@ -9,7 +9,7 @@ from sqlalchemy import select
from .actions import prepare, require_scope from .actions import prepare, require_scope
from .evidence import CONTENT_ALLOWED, STRUCTURE_ALLOWED from .evidence import CONTENT_ALLOWED, STRUCTURE_ALLOWED
from .exports import batch_projects, page_type_label, project_result from .exports import batch_projects, criterion_status_label, page_type_label, project_result
from .knowledge_pages import page_links from .knowledge_pages import page_links
from .models import (Conversation, Course, CourseVersion, IndexTask, KnowledgeChunk, KnowledgeDocument, KnowledgePage, from .models import (Conversation, Course, CourseVersion, IndexTask, KnowledgeChunk, KnowledgeDocument, KnowledgePage,
Project, RubricVersion, ScoringBatch, Student, SubmissionFile) Project, RubricVersion, ScoringBatch, Student, SubmissionFile)
@@ -384,7 +384,7 @@ def scores(db, convo, args, _user):
"max_score": row["criterion"]["max_score"], "score_id": row["score_id"], "max_score": row["criterion"]["max_score"], "score_id": row["score_id"],
"model_score": row["model_score"], "teacher_score": row["teacher_score"], "model_score": row["model_score"], "teacher_score": row["teacher_score"],
"final_score": row["final_score"], "status": row["status"], "final_score": row["final_score"], "status": row["status"],
"status_label": row["status_label"], "status_label": row.get("status_label") or criterion_status_label(row["status"], row.get("error") or ""),
"error": str(row["error"] or "")[:300], "error": str(row["error"] or "")[:300],
# Which body targets still lack evidence, so the answer can # Which body targets still lack evidence, so the answer can
# explain a review item instead of reporting a score. # explain a review item instead of reporting a score.