修复
This commit is contained in:
@@ -7,5 +7,5 @@ __version__ = "1.4.9"
|
||||
|
||||
# 调试模式开启时,登录页显示“演示模式”和“服务器设置”。
|
||||
# 正式发布请保持 False;此时程序只使用下面配置的线上域名。
|
||||
DEBUG_MODE = False
|
||||
DEBUG_MODE = True
|
||||
ONLINE_API_BASE_URL = "https://admin.zhenyangtang.com.cn"
|
||||
|
||||
@@ -2990,6 +2990,9 @@ def _diagnosis_ai_request(diagnosis_id: int, prompt: str, task: str) -> tuple[st
|
||||
raise ValueError("prompt must not exceed 500 characters")
|
||||
clean_task = task.strip().lower() or "custom"
|
||||
if clean_task not in {
|
||||
"case_analysis",
|
||||
"glucose_trend",
|
||||
"lifestyle_advice",
|
||||
"summary",
|
||||
"tcm_pattern",
|
||||
"prescription_review",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -145,7 +145,6 @@ _DIAGNOSIS_FIELDS = (
|
||||
("脂肪肝程度", "fatty_liver_degree", "脂肪肝程度"),
|
||||
("舌象", "tongue", "舌质、舌苔等观察"),
|
||||
("舌苔", "tongue_coating", "舌苔记录"),
|
||||
("脉象", "pulse", "脉象记录"),
|
||||
("临床诊断", "clinical_diagnosis", "填写临床诊断"),
|
||||
("治则", "treatment_principle", "治疗原则"),
|
||||
("处方", "prescription", "处方摘要"),
|
||||
@@ -3279,8 +3278,6 @@ class DiagnosisDialog(QDialog):
|
||||
),
|
||||
"tongue": first_value(diagnosis, "tongue", "tongue_coating"),
|
||||
"tongue_image": first_value(diagnosis, "tongue_image"),
|
||||
"pulse": first_value(diagnosis, "pulse"),
|
||||
"pulse_condition": first_value(diagnosis, "pulse_condition"),
|
||||
"clinical_diagnosis": build_prescription_clinical_diagnosis(diagnosis, case_record),
|
||||
"doctor_name": first_value(
|
||||
appointment, "doctor_name", default=first_value(diagnosis, "doctor_name")
|
||||
|
||||
@@ -119,10 +119,28 @@ def preferred_ai_model(content: str = "", *, entry: str = "diagnosis") -> str:
|
||||
return "qwen" if entry in {"prescription", "diagnosis"} else "openai"
|
||||
|
||||
|
||||
DIAGNOSIS_TASK_TITLES = {
|
||||
"case_analysis": "病历分析",
|
||||
"glucose_trend": "血糖趋势",
|
||||
"medication_review": "用药评估",
|
||||
"complication_risk": "并发症风险",
|
||||
"summary": "问诊小结",
|
||||
"lifestyle_advice": "健康建议",
|
||||
}
|
||||
|
||||
|
||||
def diagnosis_ai_task(prompt: str) -> str:
|
||||
"""Map a user-facing question to the server assistant's stable task key."""
|
||||
|
||||
text = prompt.strip().lower()
|
||||
if any(marker in text for marker in ("分析病历", "分析当前病历", "当前病历给出辨证与病情摘要")):
|
||||
return "case_analysis"
|
||||
if any(marker in text for marker in ("血糖控制", "血糖趋势", "血糖记录", "glucose")):
|
||||
return "glucose_trend"
|
||||
if any(marker in text for marker in ("问诊小结", "问诊摘要")):
|
||||
return "summary"
|
||||
if any(marker in text for marker in ("健康建议", "生活方式建议", "lifestyle")):
|
||||
return "lifestyle_advice"
|
||||
if any(marker in text for marker in ("并发症", "complication")):
|
||||
return "complication_risk"
|
||||
if any(marker in text for marker in ("指南", "共识", "guideline")):
|
||||
@@ -133,10 +151,19 @@ def diagnosis_ai_task(prompt: str) -> str:
|
||||
return "prescription_review"
|
||||
if any(marker in text for marker in ("用药", "药物", "中药", "medication")):
|
||||
return "medication_review"
|
||||
if any(marker in text for marker in ("辨证", "证候", "舌象", "脉象", "tcm")):
|
||||
has_tcm_intent = any(marker in text for marker in ("中医", "辨证", "证候", "舌象", "脉象", "tcm"))
|
||||
wants_full_report = (
|
||||
any(marker in text for marker in ("完整", "full", "complete"))
|
||||
and any(marker in text for marker in ("报告", "report"))
|
||||
)
|
||||
if has_tcm_intent and ("tcm_pattern" in text or wants_full_report):
|
||||
return "tcm_pattern"
|
||||
# A summary may mention evidence such as 证候 without requesting a full
|
||||
# TCM report. Specific clinical tasks above still take precedence.
|
||||
if any(marker in text for marker in ("总结", "概括", "摘要", "summary")):
|
||||
return "summary"
|
||||
if has_tcm_intent:
|
||||
return "tcm_pattern"
|
||||
if any(marker in text for marker in ("风险", "预后", "急症", "risk")):
|
||||
return "complication_risk"
|
||||
return "custom"
|
||||
|
||||
Reference in New Issue
Block a user