chore: finalize backend feature scope

This commit is contained in:
刘金宝
2026-06-11 16:19:07 +08:00
parent d855ecab82
commit ec515d5453
43 changed files with 680 additions and 712 deletions
+2 -23
View File
@@ -1,6 +1,6 @@
from collections.abc import AsyncIterator
from app.agents.llm_adapter import DeepSeekClient, LLMResponse, LLMStreamChunk
from app.agents.llm_adapter import DeepSeekClient, LLMStreamChunk
from app.core.config import settings
from app.models.source_case import CaseBase
@@ -11,23 +11,6 @@ class PatientAgent:
def __init__(self, llm: DeepSeekClient | None = None) -> None:
self.llm = llm or DeepSeekClient()
async def reply(
self,
case: CaseBase,
memory_messages: list[dict],
user_message: str,
mode: str,
patient_config: dict | None = None,
) -> LLMResponse:
"""问诊回复:拼接病例上下文、短期记忆和用户输入后调用 Patient Agent。"""
messages = self._build_messages(case, memory_messages, user_message, mode, patient_config)
return await self.llm.chat(
messages,
settings.llm_fast_model,
thinking_enabled=settings.llm_fast_thinking_enabled,
max_tokens=settings.llm_fast_max_tokens,
)
async def stream_reply(
self,
case: CaseBase,
@@ -58,11 +41,7 @@ class PatientAgent:
profile = case.ai_patient_profile or {}
hidden_info = case.hidden_patient_info or {}
config_rule = self._build_patient_config_rule(patient_config)
mode_rule = {
"novice": "新手模式:回答清楚,必要时可提示医生继续追问症状、既往史或检查。",
"practice": "练习模式:只回答被问到的信息,不主动给诊断建议。",
"teaching": "教学模式:保持患者身份,允许在回答后补充简短学习提示。",
}.get(mode, "只回答被问到的信息。")
mode_rule = "练习模式:只回答被问到的信息,不主动给诊断建议。"
system = f"""
你是一名标准化 AI 病人或患儿家属,只能基于病例资料回答。
病例主诉:{case.chief_complaint}