This commit is contained in:
Your Name
2026-10-09 14:13:57 +08:00
parent 51d8fd409e
commit 5706e9a6a5
15 changed files with 732 additions and 162 deletions
@@ -52,6 +52,20 @@ ancientExpect(str_contains($augmented, NihaixiaClinicalSkill::VERSION), 'existin
ancientExpect(str_ends_with($augmented, $query), 'original patient question remains intact');
ancientExpect(ClinicalKnowledgeReference::augmentQuery($augmented) === $augmented, 'retry does not duplicate references');
foreach ([$query, '患者出现痛风症状。', '患者有未收录的症状。', '阶段=text 患者糖尿病', '阶段=final 患者糖尿病'] as $case) {
$selected = ClinicalKnowledgeReference::ancientBookSources($case);
ancientExpect(
ClinicalKnowledgeReference::augmentQueryWithAncientBookSources($case, $selected)
=== ClinicalKnowledgeReference::augmentQuery($case),
'selected sources preserve the exact legacy prompt for each clinical case'
);
}
ancientExpect(
ClinicalKnowledgeReference::augmentQueryWithAncientBookSources('患者有未收录的症状。', [])
=== ClinicalKnowledgeReference::augmentQuery('患者有未收录的症状。'),
'an unrelated request receives no preceding patient citations'
);
$messages = [['role' => 'user', 'content' => $query]];
$wire = ClinicalKnowledgeReference::augmentMessages($messages);
ancientExpect(count($wire) === 2 && str_contains($wire[0]['content'], '测试古籍'), 'chat receives reference in system message');