完善训练链路接口与PDF下载

This commit is contained in:
刘金宝
2026-06-08 15:16:07 +08:00
parent 41a2851120
commit 11b1712b01
12 changed files with 550 additions and 164 deletions
+21
View File
@@ -11,6 +11,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from app.agents.scoring_agent import ScoringAgent
from app.agents.hint_agent import HintAgent
from app.agents.llm_adapter import OpenAICompatibleLLMClient
from app.agents.patient_agent import PatientAgent
from app.core.config import settings
from app.services.runtime_memory import InMemoryRuntimeMemoryService
@@ -78,10 +79,30 @@ def test_hint_agent_invalid_json_fallback() -> None:
assert result["recommended_orders"]
def test_patient_agent_config_rule_boundary() -> None:
"""病人配置提示:验证训练页初始化配置进入 Patient Agent 且不改变病例事实边界。"""
agent = PatientAgent()
rule = agent._build_patient_config_rule(
{
"labels": {
"visit_environment": "急诊",
"age_group": "儿童",
"education_level": "小学及以下",
"personality": "焦虑",
}
}
)
assert "就诊环境=急诊" in rule
assert "以家属代述为主" in rule
assert "不能改变病例事实" in rule
assert "不能编造检查检验结果" in rule
if __name__ == "__main__":
test_runtime_memory_lifecycle()
test_score_convert_to_five_point()
test_public_settings()
test_reasoning_effort_disabled_when_thinking_off()
test_hint_agent_invalid_json_fallback()
test_patient_agent_config_rule_boundary()
print("core logic tests passed")