更新
This commit is contained in:
@@ -1668,8 +1668,8 @@ def test_structured_report_shows_recorded_patient_and_skill_sources(
|
||||
lines = [label.text() for label in card.findChildren(QLabel)]
|
||||
assert any("#501" in line and "#502" in line for line in lines)
|
||||
assert any("诊单 2 条" in line and "血糖血压记录 3 条" in line for line in lines)
|
||||
assert any("commit 270e94e637c4" in line for line in lines)
|
||||
assert any("/blob/270e94e637c4249dc411e54ac6715f21247de3cb/SKILL.md" in line for line in lines)
|
||||
assert any("server/knowledge/nihaixia-skill/SKILL.md" in line and "版本 270e94e637c4" in line for line in lines)
|
||||
assert all("https://github.com" not in line for line in lines)
|
||||
bubble.deleteLater()
|
||||
|
||||
|
||||
|
||||
@@ -1351,11 +1351,14 @@ def test_reception_report_displays_recorded_sources(application: QApplication) -
|
||||
assert "#501" in dialog.source_label.text()
|
||||
assert "历史处方 2 条" in dialog.source_label.text()
|
||||
assert "六经速查表" in dialog.source_label.text()
|
||||
assert "server/knowledge/nihaixia-skill/SKILL.md" in dialog.source_label.text()
|
||||
assert "https://github.com" not in dialog.source_label.text()
|
||||
|
||||
page = ReceptionPage(object(), PermissionSet([]))
|
||||
page._render_ai_analysis_payload(payload, "qwen")
|
||||
assert "报告出处" in page.ai_source_label.text()
|
||||
assert "#501" in page.ai_source_label.text()
|
||||
assert "https://github.com" not in page.ai_source_label.text()
|
||||
dialog.close()
|
||||
page.close()
|
||||
|
||||
|
||||
@@ -17,13 +17,56 @@ def test_recorded_ancient_book_reference_has_title_chapter_and_pinned_line() ->
|
||||
{
|
||||
"title": "测试古籍",
|
||||
"chapter": "消渴篇",
|
||||
"path": "123-测试古籍.txt",
|
||||
"line": 42,
|
||||
"excerpt": "消渴者,当辨其证。",
|
||||
"url": _URL,
|
||||
"commit": _COMMIT,
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
assert any("《测试古籍》「消渴篇」" in line and _URL in line for line in lines)
|
||||
assert any(
|
||||
"《测试古籍》「消渴篇」" in line
|
||||
and "server/knowledge/tcm-ancient-books/123-测试古籍.txt 第42行" in line
|
||||
and "版本 db0155dc7c42" in line
|
||||
and "摘录:消渴者,当辨其证。" in line
|
||||
for line in lines
|
||||
)
|
||||
assert "https://github.com" not in "\n".join(lines)
|
||||
|
||||
|
||||
def test_locally_bundled_sources_render_without_external_urls() -> None:
|
||||
lines = report_provenance_lines({
|
||||
"prompt_version": "patient-longitudinal-report-nihaixia-ancient-v4",
|
||||
"knowledge_source": {
|
||||
"commit": "270e94e637c4249dc411e54ac6715f21247de3cb",
|
||||
"path": "SKILL.md",
|
||||
"url": "",
|
||||
},
|
||||
"ancient_book_sources": [{
|
||||
"title": "测试古籍",
|
||||
"chapter": "消渴篇",
|
||||
"path": "123-测试古籍.txt",
|
||||
"line": 42,
|
||||
"excerpt": "消渴者,当辨其证。",
|
||||
"commit": _COMMIT,
|
||||
"url": "",
|
||||
}],
|
||||
})
|
||||
assert any("server/knowledge/nihaixia-skill/SKILL.md" in line for line in lines)
|
||||
assert any("server/knowledge/tcm-ancient-books/123-测试古籍.txt 第42行" in line for line in lines)
|
||||
assert "https://github.com" not in "\n".join(lines)
|
||||
|
||||
|
||||
def test_ancient_book_reference_rejects_conflicting_local_metadata() -> None:
|
||||
lines = report_provenance_lines({
|
||||
"ancient_book_sources": [
|
||||
{"title": "测试古籍", "path": "别的书.txt", "line": 42, "url": _URL, "commit": _COMMIT},
|
||||
{"title": "测试古籍", "path": "123-测试古籍.txt", "line": 43, "url": _URL, "commit": _COMMIT},
|
||||
],
|
||||
})
|
||||
assert all("古籍参考:《" not in line for line in lines)
|
||||
|
||||
|
||||
def test_old_or_unverified_report_does_not_gain_ancient_citation() -> None:
|
||||
|
||||
Reference in New Issue
Block a user