فهرست منبع

feat(langgraph): 健康方案 prompt 追加 tasks 输出契约

iwt 3 هفته پیش
والد
کامیت
b54779e074
1فایلهای تغییر یافته به همراه37 افزوده شده و 2 حذف شده
  1. 37 2
      cfc-langgraph/app/api/adapter.py

+ 37 - 2
cfc-langgraph/app/api/adapter.py

@@ -596,19 +596,46 @@ PLAN_SYSTEM_PROMPT = """你是一个专业的家庭健康方案规划师。根
       "content": "Markdown 格式的详细内容",
       "items": [
         {"name": "产品名", "dosage": "用量", "timing": "服用时间", "reason": "推荐理由"}
+      ],
+      "tasks": [
+        {
+          "action_type": "buy",
+          "title": "购买维生素D3补充剂",
+          "dimension": "wealth",
+          "frequency": "once",
+          "notes": "每日一粒,随餐服用"
+        }
       ]
     },
     {
       "key": "diet",
       "title": "饮食建议",
       "content": "Markdown 格式的餐饮建议",
-      "items": [{"meal": "餐型", "food": "食物建议", "notes": "注意事项"}]
+      "items": [{"meal": "餐型", "food": "食物建议", "notes": "注意事项"}],
+      "tasks": [
+        {
+          "action_type": "diet",
+          "title": "早餐增加高蛋白与膳食纤维",
+          "dimension": "body",
+          "frequency": "daily",
+          "notes": ""
+        }
+      ]
     },
     {
       "key": "exercise",
       "title": "运动计划",
       "content": "Markdown 格式的运动建议",
-      "items": [{"type": "运动类型", "duration": "时长", "frequency": "频率", "notes": "注意事项"}]
+      "items": [{"type": "运动类型", "duration": "时长", "frequency": "频率", "notes": "注意事项"}],
+      "tasks": [
+        {
+          "action_type": "exercise",
+          "title": "每周3次有氧运动,每次30分钟",
+          "dimension": "body",
+          "frequency": "daily",
+          "notes": ""
+        }
+      ]
     }
   ],
   "abnormal_indicators": [
@@ -616,6 +643,14 @@ PLAN_SYSTEM_PROMPT = """你是一个专业的家庭健康方案规划师。根
   ]
 }
 
+## tasks 字段约定
+- 每个 section 的 `tasks` 是该 section 中"可执行的行动项"列表,与 `content`(人类可读 Markdown)分离。
+- `action_type` 取值仅限:`buy`(购买/补充产品)、`read`(阅读)、`exercise`(运动)、`checkin`(打卡/记录)、`diet`(饮食)、`activity`(活动/社交)。
+- `dimension` 取值仅限五维:`body`/`mind`/`wisdom`/`action`/`wealth`。
+- `frequency`:`once`=一次性任务;`daily`=每日重复任务。
+- `title` 是最终写入任务系统的标题,必须是**具体可执行的动作**,不要写纯原理/机制描述。
+- 若某 section 没有可执行的行动项,`tasks` 输出空数组 `[]`。
+
 ## 原则
 1. 基于实际数据给出建议,不编造
 2. 引用知识库内容时标注来源