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
+3 -18
View File
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field, field_validator
from pydantic import BaseModel, Field
from app.schemas.training_config import PatientConfig
@@ -8,16 +8,10 @@ class CreateSessionRequest(BaseModel):
case_id: int
training_type: str = Field(pattern="^(case_analysis|diagnosis_treatment|consultation)$")
mode: str = Field(pattern="^(novice|practice|teaching)$")
mode: str = Field(pattern="^practice$")
score_type: str = Field(default="percentage", pattern="^(percentage|five_point)$")
patient_config: PatientConfig | None = None
@field_validator("mode")
@classmethod
def normalize_mode(cls, value: str) -> str:
"""训练模式:兼容旧 novice 请求,实际按 practice 练习模式处理。"""
return "practice" if value == "novice" else value
class CreateSessionResponse(BaseModel):
"""创建会话响应:返回会话标识和 AI 病人开场白。"""
@@ -35,15 +29,6 @@ class ChatRequest(BaseModel):
message: str = Field(min_length=1, max_length=2000)
class ChatResponse(BaseModel):
"""问诊消息响应:返回 AI 病人的非流式回复。"""
reply: str
latency_ms: int
model: str
fallback_used: bool = False
class OrderItemResponse(BaseModel):
"""可申请检查项:只返回名称和类型,不返回结果。"""
@@ -116,7 +101,7 @@ class SubmitTreatmentResponse(BaseModel):
class HintRequest(BaseModel):
"""会话提示入参:基于当前会话上下文生成新手模式提醒"""
"""会话提示入参:基于当前会话上下文生成练习提示"""
last_user_message: str | None = Field(default=None, max_length=2000)
scope: str = Field(default="current_conversation", pattern="^current_conversation$")