Appearance
母婴馆 Agent · 母婴小悦 Agent 设计
§2.2 场景 · 晨悦编排平台孵化的旗舰垂直 Agent · 商用版设计文档
索引 → §2 场景 Agent · 平台孵化 · 案例对照:PM vs 母婴
定位
母婴小悦 是 ChenYue AI Platform 上可运营、可评测、可复用的商用垂直 Agent 样板,不是小程序里的关键词脚本。
- 晨悦编排上孵化的 业务垂直 Agent(非 AgentPM)
- 跟营学员:生产环境 只读 / case 分析
- PM 交付跟练仍走 AgentPM · §2.1
四层目标架构
L4 接入层(后接) 小程序 BabyXiaoYue · flow-admin 调试台 · 企微/飞书(可选)
L3 编排层 Scene baby(L1/L2/L3)· Workflow 交易链路 · Skills 组合包
L2 Agent 核心 固定 Agent · 三层记忆 · 育儿 KB RAG · HTTP Plugins ×4
L1 业务 API /api/goods/* · /api/preference · 内容安全设计原则:
- 平台承载智能,客户端承载呈现
- 确定性路径走 Workflow,开放性路径走 LLM + RAG
- 一切可 seed、可版本化、可回滚
- 输出结构化 — 不只
reply_text,还要有goods_list/actions/checklist_groups
一、升级目标
将母婴小悦从「本地关键词匹配」升级为「ChenYue AI Platform 驱动的智能母婴顾问」,达到商用级别。
现状对比
| 当前(v0) | 目标(v1) | |
|---|---|---|
| 意图识别 | 纯关键词匹配 | AI 语义理解 |
| 回复方式 | 硬编码文案池 | LLM 动态生成 |
| 上下文 | 仅本地存储 baby_stage | 三层记忆系统 |
| 商品搜索 | 正则抽词 → 调商品 API | AI 理解意图 → Function Calling → HTTP 节点 |
| 覆盖面 | 仅 7 种意图 | 全场景覆盖 |
| 用户体验 | 「小悦还不懂 😅」高频出现 | 温柔共情 + 专业建议 |
二、架构变化
2.1 升级前(v0 · 客户端承载)
BabyXiaoYue.vue
→ onSend()
→ handleBabyIntent(text, ctx)
→ baby-intents.js 关键词匹配
→ baby-handlers.js 硬编码回复 / 直调商品 API2.2 升级后(v1 · 平台承载)
BabyXiaoYue.vue(薄客户端)
→ baby-ai-chat.js(固定 Agent ID + 协议解析)
→ POST /api/agents/{id}/chat
→ ChenYue AI Platform
├─ Scene baby(Layer1 本地命中 → 零 token)
├─ Chat 管线(Memory · RAG · Tool Calling)
└─ Workflow baby-xiaoyue-v1(交易类确定性链路)
→ Memory Load
→ LLM 意图分类
→ Condition → HTTP(商品/券/清单)
→ Code 格式化结构化输出
→ LLM 导语(≤80字,不编价格)
→ Memory Save
→ 响应:reply_text + goods_list + actions + checklist_groups
→ 降级:AI/平台不可用时 → handleBabyIntent(offline fallback)2.3 平台能力映射(全用满)
| 平台能力 | 在小悦 Agent 中的职责 | 优先级 |
|---|---|---|
| Agent | 角色、边界、模型参数、发布态 | P0 |
| Scene(baby) | 高频意图 Layer1 本地命中;Layer2 AI+hint | P0 |
| Workflow | 交易类:意图→API→格式化→回复 | P0 |
| HTTP Plugins + Tool Calling | 搜商品、查券、阶段清单、辅食 RAG | P0 |
| Knowledge RAG | 辅食/发育/选购要点(非商品库) | P0 |
| Long-term Memory | baby_stage、过敏、搜过的品类 | P0 |
| Mid/Short Memory | 多轮对话、摘要压缩 | P1 |
| Skills | KB + Workflow + Prompt 打包 | P1 |
| Preference API | 用户档案真源;登录后同步进 Memory | P1 |
| 内容安全 | 入站+出站双向审核 | P0 |
| Semantic Cache | 高频 FAQ 降本 | P2 |
| Model Routing | 分类用 Flash,复杂问答路由 Plus | P2 |
刻意不用: 客户端创建 Agent(商用禁止)· MCP 直连商品(REST Plugin 更稳)· 纯 LLM 带货(无结构化卡片不合格)
2.4 Scene 设计(baby)
| Layer | 场景 | 示例 | 成本 |
|---|---|---|---|
| L1 本地 | 极高频、零歧义 | 「设置阶段」「查看清单」「有优惠券吗」 | 0 token |
| L2 AI+hint | 中频、需共情 | 「宝宝不爱吃辅食」→ 注入 RAG hint | 低 |
| L3 兜底 | 未命中 | 走完整 Agent Chat 管线 | 正常 |
初版意图(12 个):goods_search · coupon_check · checklist_recommend · baby_food_qa · stage_set · stage_query · feeding_guide · goods_browse · development_qa · anxiety_chat · complaint · unknown
2.5 HTTP Plugins(Tool Calling 四件套)
| Plugin | 方法 | 参数 | Agent 何时调 |
|---|---|---|---|
baby_goods_search | GET /api/goods/list | keyword, page_size, sort_by | 用户要买具体东西 |
baby_coupon_list | GET /api/goods/list | filter coupon | 「有券吗」 |
baby_checklist_by_stage | GET /api/goods/checklist-by-stage | stage | 「该买什么」 |
baby_food_rag | 内部 RAG search | query, stage | 辅食/发育问答 |
2.6 Knowledge 设计
一个 KB:baby_parenting_kb
| 分片 | 内容 | 更新频率 |
|---|---|---|
| feeding | 辅食添加表、过敏观察 | 月更 |
| development | 月龄发育里程碑(非诊断) | 季更 |
| shopping_guide | 品类选购要点(段数、材质) | 随清单更新 |
| stage_overview | 7 阶段概述 | 稳定 |
不用 KB 存商品 — 商品永远走 API 实时查。上线前每分片 20 条 Q&A,RAG 命中率目标 ≥ 85%。
2.7 Memory + Preference 双写
| 数据 | 真源 | Agent 读法 | 写入时机 |
|---|---|---|---|
baby_stage | PUT /api/preference → extra.baby_stage | Memory Load + Workflow 变量 | 用户设阶段 / memory_save |
| 过敏/忌口 | long_term category=fact | Memory Load | 对话抽取 + 用户明示 |
| 最近搜过的品类 | long_term category=preference | Memory Load | 每次 goods_search 后 |
| 对话上下文 | short + mid summary | Chat 管线自带 | 自动 |
规则:preference 是档案真源,memory 是 Agent 工作副本;登录时 preference → memory upsert。
2.8 结构化输出协议(商用关键)
Workflow end_1 与 Chat 响应扩展字段:
json
{
"reply_text": "帮你找了5款尿不湿~",
"message_type": "goods_cards",
"goods_list": [
{
"id": "5001",
"title": "贝亲宽口径PPSU奶瓶",
"price": "89.00",
"original_price": "129.00",
"buy_url": "https://...",
"coupon_url": "https://...",
"platform": "京东",
"reason": "新生儿必备"
}
],
"actions": [
{ "label": "去好物广场", "action": "navigate", "url": "/pages-goods/pages/index/index" }
],
"checklist_groups": [
{
"category_name": "0-6月必备",
"items": [
{ "name": "新生儿奶瓶", "buying_tip": "...", "importance": "essential" }
]
}
],
"meta": { "intent": "goods_search", "stage": "baby-0-6", "workflow_version": "v1" }
}message_type 枚举:text · goods_cards · checklist_groups · action_buttons · mixed
客户端映射:goods_list → 商品卡片 · actions → 按钮消息 · checklist_groups → 分组清单卡
三、工作流设计
3.1 节点布局总览
触发条件:Workflow 不是每条消息都跑。Scene Layer1 命中 → 不触发;Layer2/L3 或未命中 → 由 Workflow Skill 触发。
┌──────────────────────────────────────────────────────────────────────┐
│ 工作流画布(16 节点 · 商用目标版) │
│ │
│ ┌──────────┐ │
│ │ Start │ 输入变量: user_message, baby_stage, user_id │
│ └────┬─────┘ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ 📖 Memory Load │ long_term │
│ │ │ 读取: baby_stage, 已购商品, 最近对话 │
│ └──────┬───────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────────┐ │
│ │ 🤖 LLM #1 — 意图分类 │ │
│ │ model: GLM-4-Flash, temperature: 0.3 │ │
│ └──────┬──────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────┐ │
│ │ 💻 parse_intent — JSON 容错 + stage │ │
│ └──────┬───────────────────────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────┐ │
│ │ 🔀 condition_trade(是否交易类?) │ │
│ └────┬────────────────┬───────────────┘ │
│ │ True │ False │
│ ▼ ▼ │
│ ┌──────────────┐ ┌─────────────────────┐ │
│ │ build_http │ │ 🤖 llm_chat │ │
│ │ + http_trade │ │ 母婴顾问回复 │ │
│ │ + has_items │ └──────────┬──────────┘ │
│ └──────┬───────┘ │ │
│ ▼ │ │
│ ┌──────────────┐ │ │
│ │ code_format │ │ │
│ │ llm_intro │ │ │
│ └──────┬───────┘ │ │
│ └─────────┬───────────┘ │
│ ▼ │
│ ┌───────────────────────────────────────────┐ │
│ │ 💾 Memory Save │ │
│ └──────┬────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────┐ │
│ │ End │ 输出: reply_text, goods_list, actions │
│ └──────────┘ │
└──────────────────────────────────────────────────────────────────────┘3.2 完整节点清单(16 节点)
| # | 节点 ID | 类型 | 说明 |
|---|---|---|---|
| 1 | start_1 | Start | user_message, baby_stage, user_id |
| 2 | memory_load_1 | Memory Load | long_term, limit=5 |
| 3 | llm_intent | LLM | 意图分类 JSON, temp=0.3 |
| 4 | parse_intent | Code | JSON 容错 + stage 合并 |
| 5 | condition_trade | Condition | 是否交易类 |
| 6a | condition_goods | Condition | intent == goods_search |
| 6b | condition_coupon | Condition | intent == coupon |
| 6c | condition_checklist | Condition | intent == checklist |
| 7 | http_trade | HTTP | 单节点动态 URL(方案 B) |
| 8 | condition_has_items | Condition | API 是否有结果 |
| 9 | code_format | Code | 格式化为 §2.8 协议 |
| 10 | llm_intro | LLM | 交易导语 ≤80 字,禁止编价格 |
| 11 | llm_empty | LLM | 空结果温柔回复 + 引导 |
| 12 | llm_chat | LLM | 非交易类:chat / feeding_qa / stage_qa |
| 13 | memory_save_1 | Memory Save | 保存本次对话关键信息 |
| 14 | end_1 | End | 完整协议字段 |
3.3 连线关系
| 源节点 | 目标节点 | 条件 |
|---|---|---|
start_1 | memory_load_1 | — |
memory_load_1 | llm_intent | — |
llm_intent | parse_intent | — |
parse_intent | condition_trade | — |
condition_trade | build_http_request → http_trade → condition_has_items | true(交易类) |
condition_trade | llm_chat | false |
condition_has_items | code_format | true(有结果) |
condition_has_items | llm_empty | false |
code_format | llm_intro | — |
llm_intro / llm_empty / llm_chat | memory_save_1 | — |
memory_save_1 | end_1 | — |
3.4 HTTP 节点接口详解
商品搜索
GET /api/goods/list?keyword={{llm_intent.output.search_keyword}}&page=1&page_size=5&sort_by=comprehensive返回 JSON 结构:
json
{
"code": 0,
"data": {
"items": [
{
"id": 5001,
"title": "贝亲宽口径PPSU奶瓶 160ml",
"image": "https://img.example.com/goods/5001.jpg",
"price": "89.00",
"original_price": "129.00",
"category_name": "喂养用品",
"age_range": "0-6个月",
"platform": "京东",
"buy_url": "https://u.jd.com/xxx",
"brand": "贝亲",
"shop_name": "贝亲官方旗舰店",
"coupon_amount": "20",
"coupon_url": "https://u.jd.com/coupon/xxx",
"monthly_sales": 3200,
"good_rate": "98%",
"reason": "新生儿必备,PPSU材质轻便耐摔",
"recommend_count": 156,
"like_count": 89
}
],
"total": 156,
"page": 1,
"page_size": 5
}
}优惠券商品
GET /api/goods/list?sort_by=coupon&page_size=5返回结构同商品搜索,聚焦 coupon_amount 和 coupon_url 字段。
选购清单
GET /api/goods/checklist-by-stage?stage={{llm_intent.output.stage}}| 参数 | 枚举值 |
|---|---|
stage | preparing(备孕待产)、pregnant-early/mid/late(孕期)、baby-0-6、baby-6-12、baby-1-3、baby-3plus |
返回 JSON 结构:
json
{
"code": 0,
"data": [
{
"category_id": 10,
"category_name": "0-6月必备",
"icon": "👶",
"items": [
{
"id": 101,
"name": "新生儿奶瓶",
"buying_tip": "选择PPSU材质,宽口径易清洗,160ml即可",
"importance": "essential",
"icon": "🍼"
}
]
}
]
}3.5 关键节点 Prompt 详情
LLM #1 — 意图分类 System Prompt
你是一个母婴对话意图分类器。根据用户的消息和记忆上下文,判断用户意图并输出 JSON。
用户消息: {{user_message}}
宝宝阶段: {{baby_stage}}
记忆上下文: {{memory_load_1.output}}
可能的意图:
- goods_search: 搜索商品、求推荐
- coupon: 查优惠券、查折扣
- checklist: 要选购清单
- feeding_qa: 喂养相关问题
- stage_qa: 阶段发育问题
- chat: 日常闲聊、情感陪伴
输出严格的 JSON 格式:
{
"intent": "goods_search|coupon|checklist|feeding_qa|stage_qa|chat",
"search_keyword": "提取的搜索关键词",
"stage": "提取或推断的宝宝阶段",
"reply_hint": "闲聊时的话题提示"
}Code — 格式化 API 结果
python
import json
parsed = inputs.get("parse_intent") or {}
intent = parsed.get("intent", "chat")
stage = parsed.get("stage", "")
if intent in ("goods_search", "coupon"):
raw = inputs.get("http_trade") or {}
if isinstance(raw, dict) and "result" in raw:
raw = raw["result"]
api_result = raw if isinstance(raw, dict) else json.loads(str(raw))
items = api_result.get("data", {}).get("items", [])
goods_list = []
for i, item in enumerate(items[:5]):
goods_list.append({
"id": item.get("id", str(i)),
"title": item.get("title", ""),
"price": str(item.get("price", "")),
"original_price": str(item.get("original_price", "")),
"coupon_amount": str(item.get("coupon_amount", "0")),
"coupon_url": item.get("coupon_url", ""),
"platform": item.get("platform", ""),
"buy_url": item.get("buy_url", ""),
"reason": item.get("reason", ""),
})
result = {
"message_type": "goods_cards",
"goods_list": goods_list,
"item_count": len(goods_list),
}
elif intent == "checklist":
raw = inputs.get("http_trade") or {}
if isinstance(raw, dict) and "result" in raw:
raw = raw["result"]
api_result = raw if isinstance(raw, dict) else json.loads(str(raw))
categories = api_result.get("data", [])
checklist_groups = []
for cat in categories:
group_items = []
for item in cat.get("items", []):
group_items.append({
"name": item.get("name", ""),
"buying_tip": item.get("buying_tip", ""),
"importance": item.get("importance", ""),
})
if group_items:
checklist_groups.append({
"category_name": cat.get("category_name", ""),
"items": group_items,
})
result = {
"message_type": "checklist_groups",
"checklist_groups": checklist_groups,
"stage": stage,
}
else:
result = {"message_type": "text", "goods_list": [], "checklist_groups": []}llm_intro Prompt 要点
你是小悦。根据下方已查到的真实商品/清单数据,写一段≤80字的温柔导语。
规则:
- 价格、链接、券额只能引用 structured_data 中的字段,禁止编造
- goods_cards 用「帮你找到了{n}款{keyword}」开头
- checklist 用「为你整理了{stage}阶段的必备清单」开头
- 结尾加一个 emojillm_empty Prompt 要点
用户想找的商品暂时没查到。温柔告知并建议:去好物广场逛逛 / 换个关键词 / 告诉小悦宝宝阶段。
不要编造商品。≤60字。emoji 结尾。3.6 平台对齐要点
Condition 表达式校正:平台 Condition 节点仅 True/False 两出口,不能一个节点分三路。v2 采用 方案 B:一个 http_trade 节点 + 前置 Code 按 intent 拼 URL。
Code 节点约定:
| 项目 | 约定 |
|---|---|
| 读入 | inputs 字典,key = 上游 node_id |
| 写出 | 赋给 result 变量 |
| 禁止 | import、open、eval、访问网络 |
变量解析优先级(baby_stage):
| 优先级 | 来源 | 说明 |
|---|---|---|
| 1 | start_1.baby_stage | Workflow 入参(来自 preference / 客户端) |
| 2 | memory_load_1 中的 stage 记忆 | long_term 档案 |
| 3 | llm_intent / parse_intent.stage | LLM 从对话推断 |
| 4 | 默认 baby-0-6 | 兜底 |
非交易类与 RAG 分工:
| 意图 | Workflow 内 | Agent Chat 管线 |
|---|---|---|
| goods_search / coupon / checklist | ✅ 主路径 | Tool/Workflow 可补调 |
| feeding_qa / stage_qa | ⚠️ llm_chat 可兜底 | ✅ KB RAG + Plugin(推荐主路径) |
| chat | ✅ llm_chat | ✅ 记忆 + 共情 Prompt |
3.7 End 节点输出映射
json
{
"reply_text": "{{llm_intro.content 或 llm_empty.content 或 llm_chat.content}}",
"message_type": "{{code_format.result.message_type 或 text}}",
"goods_list": "{{code_format.result.goods_list 或 []}}",
"checklist_groups": "{{code_format.result.checklist_groups 或 []}}",
"actions": [],
"meta": {
"intent": "{{parse_intent.intent}}",
"stage": "{{parse_intent.stage}}",
"workflow_version": "baby-xiaoyue-v2",
"item_count": "{{code_format.result.item_count 或 0}}"
}
}四、Agent System Prompt
母婴小悦角色定义
你是「小悦」,晨悦家生活助手中的母婴专属顾问。
你陪伴妈妈们走过备孕、怀孕、育儿每一段温柔旅程。
## 角色特点
- 语气:温柔、亲切、像懂你的闺蜜,叫用户"妈妈"
- 风格:先共情再给建议,不直接抛结论
- 专业:育儿知识准确可靠,不确定的事情诚实说"建议咨询医生"
- 有价值:每次对话都给出至少一个可执行的建议
## 能力范围
你可以帮助妈妈们:
- 推荐适合宝宝阶段的母婴好物
- 查看优惠券和折扣信息
- 按宝宝阶段生成选购清单
- 解答喂养、辅食、发育等育儿问题
- 聊天陪伴,缓解育儿焦虑
## 安全边界
- 不给出医疗诊断,涉及疾病时建议就医
- 不推荐具体品牌,只说品类和选购要点
- 涉及药物时强调"请遵医嘱"
- 不评价其他平台的优劣
- 如果有人输入政治敏感、色情暴力内容,礼貌转移话题
## 宝宝阶段知识
{{memory.stage_info}}
0-6个月:纯母乳/配方奶,不需额外喝水
6-12个月:添加辅食,从含铁米粉开始
1-3岁:可与大人同食,少盐少糖少油
## 回复规范
- 每条回复控制在 200 字内
- 如果能推荐商品,用「帮你找到了xxx」开头
- 如果需要用户补充信息,温柔提问(不超过 2 个问题)
- 对话结尾加一个 emoji 表情五、客户端改动
v2 共识:先平台验收,后接小程序。客户端做薄渲染层,解析结构化响应。
5.1 文件改动清单
| 文件 | 操作 | 说明 |
|---|---|---|
src/utils/baby-ai-chat.js | 改造 | 读 env 固定 BABY_AGENT_ID;解析结构化响应 |
src/pages-baby/xiaoyue/BabyXiaoYue.vue | 改造 | 解析 goods_list/actions/checklist_groups → 渲染卡片 |
src/pages-baby/xiaoyue/baby-handlers.js | 降级保留 | offline fallback |
src/config/env.js | 新增 | features.babyAi 开关 |
5.2 核心调用架构
BabyXiaoYue.vue
├─ onSend(text) ─────────────────────────────┐
├─ quickSearch / quickAsk / quickAction │
└─ onAction(checklist-recommend) │
▼ │
sendToPlatform(text) │
1. addUserMsg │
2. setLoading(true) │
3. sendMessage(text) ─────────────────┘
4. 解析响应
├─ reply_text → addBotMsg
├─ goods_list → addGoodsMsg
├─ checklist_groups → addActionMsg
└─ actions → addActionMsg
5. catch → handleBabyIntent() 【offline fallback】5.3 对接文件示例
javascript
// src/utils/baby-ai-chat.js
// 接口: POST /api/agents/{agentId}/chat
// 降级: 10s 超时 → 抛异常 → 降级到 keyword matching
const AGENT_ID = '<YOUR_BABY_AGENT_ID>'
const TIMEOUT_MS = 10000
export async function sendMessage(message, options = {}) {
const controller = new AbortController()
const timer = setTimeout(() => controller.abort(), options.timeout || TIMEOUT_MS)
try {
const res = await fetch(`/api/agents/${AGENT_ID}/chat`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
message,
stream: options.stream || false,
}),
signal: controller.signal,
})
if (!res.ok) throw new Error(`AI Platform error: ${res.status}`)
const data = await res.json()
if (data.code !== 0) throw new Error(data.message || 'AI response error')
return {
text: data.data?.message?.content || '',
raw: data.data,
}
} finally {
clearTimeout(timer)
}
}六、风险与降级策略
| 风险 | 概率 | 影响 | 降级方案 |
|---|---|---|---|
| AI Platform 响应慢/超时 | 中 | 用户等待感差 | 10s 超时 → 本地关键词兜底 |
| LLM 不懂业务词 | 低 | 回复不准确 | Prompt 中定义业务术语表 |
| 流式 SSE 小程序不支持 | 低 | 体验降级 | stream: false 同步模式 |
| 商品 API 返回空 | 低 | 推荐无内容 | LLM 生成「暂时没找到」的自然回复 |
| LLM 服务不可用 | 低 | 全部不可用 | 切换备用模型,或整体降级到关键词匹配 |
降级链路图
用户发送消息
↓
sendToAI()
├─ 正常 → 解析结构化响应 → 渲染卡片/文本
├─ 超时(10s) → catch → handleBabyIntent(offline fallback)
├─ 网络错误 → catch → handleBabyIntent
└─ babyAi=false → handleBabyIntent(主路径或降级)
handleBabyIntent: 7 种意图 + 商品搜索 + 优惠券 + 清单七、评测与安全
7.1 评测指标
| 类别 | 指标 | 目标 |
|---|---|---|
| 意图 | 12 意图分类准确率 | ≥ 90% |
| 交易 | 搜商品 / 清单 / 领券成功率 | ≥ 95% |
| RAG | 辅食 FAQ 命中率 | ≥ 85% |
| 安全 | 违规内容漏检 | 0 |
| 体验 | 首包响应(L1 / L3) | < 200ms / < 3s |
| 成本 | 均对话 token | 监控 + 周报 |
黄金测试集 50 条:含方言、错别字、多意图;每次改 Prompt / Workflow 必跑。
7.2 安全与合规
用户输入 → msgSecCheck → Agent
Agent 输出 → msgSecCheck → 客户端- 医疗敏感:模板化「建议咨询儿科医生」
- 商品文案:价格/链接只来自 API 字段,LLM 禁止编造
- 审计:intent、plugin 调用、workflow 版本、token 消耗
八、Agent Seed 配置草案
| 字段 | 值 |
|---|---|
| name | 母婴顾问小悦 |
| model | GLM-4-Flash(分类/日常);复杂问答可路由 Plus |
| temperature | 意图 0.3 / 聊天 0.7 / 商品导语 0.5 |
| max_tokens | 512 |
| memory_enabled | true |
| scene_enabled | true |
| knowledge_base_ids | [baby_parenting_kb] |
| mounted_plugins | baby_goods_search, baby_coupon_list, baby_checklist_by_stage, baby_food_rag |
| mounted_skills | Prompt Skill + KB Skill + Workflow Skill |
九、实施决策记录
| # | 问题 | 决策 | 理由 |
|---|---|---|---|
| 1 | 工作流复杂度 | 先跑通再升级 16 节点 | 验证链路 |
| 2 | 商品结果展示 | 平台定义结构化协议 → 客户端渲染卡片 | 商用带货必须出卡 |
| 3 | 记忆保存策略 | 开启 long_term + preference 双写 | 多端一致 |
| 4 | 兜底逻辑 | 保留本地关键词作 offline fallback | 永不白屏 |
| 5 | Scene 路由 | 开启 scene_enabled | L1 降本;高频业务不走 LLM |
| 6 | 实施顺序 | 平台资产 → 手册 → 母婴馆对接 | Agent 真身在平台 |
| 7 | Agent 创建 | 平台 seed 固定 ID;禁止客户端创建 | 商用运维、Prompt 统一 |
| 8 | 工作流分支 | 短期方案 B(单 HTTP);长期方案 A(引擎 Condition skip) | 对齐引擎现状 |
| 9 | feeding/stage 问答 | 主走 Agent Chat RAG,Workflow 内 llm_chat 仅兜底 | Workflow 无 RAG 节点 |
十、现有代码迁移对照
| 现有文件 | v1 角色 | v2 目标角色 |
|---|---|---|
baby-intents.js | 客户端意图 | → Scene Layer1 规则真源,客户端删除 |
baby-handlers.js | 主业务逻辑 | → Workflow/Code 节点 + offline fallback |
baby-ai-chat.js | AI 对接 | → 固定 ID + 协议解析 |
BabyXiaoYue.vue | UI + AI 编排 | → 纯 UI + 结构化消息渲染 |