更新
This commit is contained in:
@@ -1641,6 +1641,49 @@ def test_sectioned_reply_becomes_a_structured_report(application: QApplication)
|
||||
bubble.deleteLater()
|
||||
|
||||
|
||||
def test_structured_report_shows_recorded_patient_and_skill_sources(
|
||||
application: QApplication,
|
||||
) -> None:
|
||||
reply = (
|
||||
"以下根据当前病历及历史随访资料作初步梳理,请医师结合原始记录复核所有结论,并确认记录时间与患者本人相符。\n"
|
||||
"1. 病情判断\n- 当前资料尚不足以确认具体证型,仍需补充舌脉与检查资料。\n"
|
||||
"2. 建议下一步\n- 请核对既往病历、血糖血压记录及随访记录,再决定后续检查与处置。\n"
|
||||
)
|
||||
commit = "270e94e637c4249dc411e54ac6715f21247de3cb"
|
||||
bubble = ai_consult_module._ChatBubble(role="ai", text=reply)
|
||||
bubble.set_provenance({
|
||||
"source_diagnosis_ids": [501, 502],
|
||||
"source_summary": {"diagnosis_count": 2, "blood_record_count": 3},
|
||||
"knowledge_source": {
|
||||
"title": "倪海厦 skill",
|
||||
"url": f"https://github.com/coinweth/nihaixia-skill/blob/{commit}/SKILL.md",
|
||||
"commit": commit,
|
||||
"sections": ["六经速查表"],
|
||||
},
|
||||
})
|
||||
|
||||
assert bubble.finalize_clinical_analysis() is True
|
||||
card = bubble.findChild(ai_consult_module.QFrame, "AiConsultReportProvenance")
|
||||
assert card is not None
|
||||
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)
|
||||
bubble.deleteLater()
|
||||
|
||||
|
||||
def test_clinical_report_marks_unrecorded_provenance(application: QApplication) -> None:
|
||||
bubble = ai_consult_module._ChatBubble(role="ai", text=LONG_CLINICAL_REPLY)
|
||||
assert bubble.finalize_clinical_analysis() is True
|
||||
card = bubble.findChild(ai_consult_module.QFrame, "AiConsultReportProvenance")
|
||||
assert card is not None
|
||||
lines = [label.text() for label in card.findChildren(QLabel)]
|
||||
assert any("未附可核查的来源清单" in line for line in lines)
|
||||
assert any("未记录所用知识资料版本" in line for line in lines)
|
||||
bubble.deleteLater()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"reply",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user