fix: link score citations to their source text pages
This commit is contained in:
@@ -83,7 +83,7 @@ def test_get_scores_pages_projects_and_criteria(db, monkeypatch):
|
||||
"rows": [{"criterion": {"criterion_id": f"C{index}", "name": f"评分项{index}", "max_score": 10},
|
||||
"score_id": index, "model_score": 8, "teacher_score": None, "final_score": 8,
|
||||
"status": "scored", "error": "", "evidence": [{"page": index + 1,
|
||||
"quote": "证据" * 200, "document": "报告.pdf",
|
||||
"quote": "证据" * 200, "document": "报告.pdf", "document_id": index + 100,
|
||||
"image_url": f"/api/assets/{item.id}/1" if index == 0 else None}]}
|
||||
for index in range(14)]}
|
||||
|
||||
@@ -95,6 +95,7 @@ def test_get_scores_pages_projects_and_criteria(db, monkeypatch):
|
||||
assert first_page["next_criterion_offset"] == 6 and first_page["next_project_offset"] == 1
|
||||
assert first_page["citations"][0]["url"] == f"/?page=scores&batch_id={created['id']}&project_id={first.id}"
|
||||
assert first_page["citations"][0]["image_url"] == f"/api/assets/{first.id}/1"
|
||||
assert first_page["citations"][0]["text_url"] == "/api/knowledge/documents/100/pages/1"
|
||||
assert first_page["citations"][1]["url"] == first_page["citations"][0]["url"]
|
||||
assert first_page["citations"][1]["image_url"] is None
|
||||
assert len(json.dumps(first_page, ensure_ascii=False)) < 12000
|
||||
|
||||
Reference in New Issue
Block a user