cs-chatbot-design

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Chatbot Design

聊天机器人设计

Framework

框架

IRON LAW: Intent First, Response Second

A chatbot must UNDERSTAND what the user wants (intent) before crafting
a response. Building response templates without intent classification
produces a keyword-matching FAQ, not a chatbot.

Flow: User message → Intent classification → Slot extraction → Response
IRON LAW: Intent First, Response Second

聊天机器人必须先理解用户的需求(意图),再生成回复。如果不做意图分类就直接构建回复模板,得到的只是基于关键词匹配的FAQ系统,而非真正的聊天机器人。

流程:用户消息 → 意图分类 → 槽位提取 → 生成回复

Core NLU Pipeline

核心NLU流水线

StageWhat It DoesExample
Intent ClassificationIdentify what the user wants to do"What time do you close?" → intent:
check_hours
Entity/Slot ExtractionExtract key information from the message"Book a table for 4 on Friday" → slots: {party_size: 4, date: Friday}
Dialogue ManagementDecide the next action (ask for missing info, confirm, execute)Missing slot
time
→ ask "What time would you like?"
Response GenerationProduce the reply"I've booked a table for 4 on Friday at 7pm. See you then!"
阶段功能示例
意图分类识别用户的需求"你们几点关门?" → 意图:
check_hours
实体/槽位提取从消息中提取关键信息"预订周五的4人桌" → 槽位:{party_size: 4, date: Friday}
对话管理决定下一步操作(询问缺失信息、确认、执行)缺失槽位
time
→ 询问:“请问您需要几点的桌位?”
回复生成生成回复内容"我已为您预订了周五晚7点的4人桌,期待您的光临!"

Intent Design

意图设计

  • Start with 10-15 core intents covering 80% of user queries
  • Each intent needs 10-20 training examples (varied phrasings)
  • Include a
    fallback
    intent for unrecognized inputs
  • Group related intents:
    order_status
    ,
    order_cancel
    ,
    order_modify
    under "Order Management"
  • 从10-15个核心意图入手,覆盖80%的用户查询场景
  • 每个意图需要10-20条训练样本(表述方式需多样化)
  • 需包含
    fallback
    (兜底)意图,用于处理无法识别的输入
  • 可将相关意图分组:例如将
    order_status
    order_cancel
    order_modify
    归为“订单管理”类别

Dialogue Flow Patterns

对话流程模式

PatternWhen to UseExample
Single-turnSimple Q&A, no context needed"What are your hours?" → respond immediately
Multi-turn (slot filling)Need multiple pieces of info"Book a table" → ask party size → ask date → ask time → confirm
BranchingDifferent paths based on user's answer"Do you have an account?" → Yes: login flow / No: registration flow
ConfirmationBefore executing actions"I'll cancel order #12345. Is that correct?"
HandoffBot can't handle the request"Let me connect you with a human agent"
模式适用场景示例
单轮对话简单问答,无需上下文“你们的营业时间是?” → 直接回复
多轮对话(槽位填充)需要收集多条信息“预订桌位” → 询问人数 → 询问日期 → 询问时间 → 确认
分支对话根据用户回答进入不同路径“您有账户吗?” → 是:登录流程 / 否:注册流程
确认环节执行操作前需确认“我将为您取消订单#12345,是否确认?”
人工转接机器人无法处理请求时“我将为您转接人工客服”

Response Design Principles

回复设计原则

  1. Acknowledge first: "Got it, you want to check your order status."
  2. Be concise: Answer the question, then stop. Don't add unnecessary information.
  3. Offer next steps: "Is there anything else I can help with?" or suggest related actions.
  4. Use quick replies/buttons: Reduce typing, guide the conversation.
  5. Personality: Define a consistent tone (friendly, professional, casual) and stick to it.
  1. 先确认需求:“好的,我了解您想查询订单状态。”
  2. 简洁明了:回答问题后即停止,避免冗余信息。
  3. 提供后续选项:“请问还有其他需要帮助的吗?”或推荐相关操作。
  4. 使用快捷回复/按钮:减少用户输入,引导对话方向。
  5. 保持统一人设:定义一致的语气(友好、专业、随性)并严格遵循。

Metrics

指标

MetricDefinitionTarget
Intent accuracy% correctly classified intents> 85%
Containment rate% resolved without human handoff> 60-70%
CSATCustomer satisfaction score> 4.0/5
Fallback rate% triggering fallback/unknown intent< 15%
Resolution timeAverage time to resolve< 2 minutes
指标定义目标值
意图识别准确率正确分类的意图占比> 85%
自主解决率无需人工转接即可解决的请求占比> 60-70%
客户满意度(CSAT)用户满意度评分> 4.0/5
兜底触发率触发兜底/未知意图的请求占比< 15%
问题解决时长平均解决时间< 2分钟

Output Format

输出格式

markdown
undefined
markdown
undefined

Chatbot Design: {Use Case}

聊天机器人设计:{使用场景}

Intent Catalog

意图目录

IntentDescriptionExample UtterancesPriority
{intent}{what it means}"{example 1}", "{example 2}"H/M/L
意图描述示例表述优先级
{intent}{意图含义}"{示例1}", "{示例2}"高/中/低

Dialogue Flows

对话流程

{Flow Name}

{流程名称}

  1. User: {trigger utterance}
  2. Bot: {response + slot question if needed}
  3. User: {provides info}
  4. Bot: {confirmation or action}
  1. 用户:{触发语句}
  2. 机器人:{回复 + 如需槽位则提问}
  3. 用户:{提供信息}
  4. 机器人:{确认或执行操作}

Fallback Strategy

兜底策略

  • After 1 miss: rephrase + suggest options
  • After 2 misses: offer human handoff
  • 首次无法识别:重新表述问题 + 提供选项
  • 两次无法识别:转接人工客服

Metrics Targets

指标目标

MetricTarget
Intent accuracy> {X%}
Containment> {X%}
undefined
指标目标值
意图识别准确率> {X%}
自主解决率> {X%}
undefined

Gotchas

注意事项

  • Users don't follow your flow: People type in unexpected ways, change topics mid-conversation, and give incomplete information. Design for messiness, not just the happy path.
  • Fallback is your most important intent: A good fallback ("I'm not sure I understood. Did you mean X, Y, or Z?") is better than a bad guess.
  • LLM-powered bots still need guardrails: Using GPT/Claude for response generation? Add intent classification as a first layer to route and constrain, preventing hallucination and off-topic responses.
  • Test with real users, not team members: Your team knows how the bot works and phrases things "correctly." Real users don't. Test with 10+ real users before launch.
  • Conversation logs are gold: Review conversation logs weekly. Failed conversations reveal missing intents, confusing flows, and training data gaps.
  • 用户不会严格遵循流程:用户的输入方式可能超出预期,会中途切换话题或提供不完整信息。设计时需考虑各种异常情况,而非仅针对理想流程。
  • 兜底意图是重中之重:一个好的兜底回复(“我没太理解您的意思,您是指X、Y还是Z?”)比错误猜测更重要。
  • 大语言模型驱动的机器人仍需约束:使用GPT/Claude生成回复时,需先添加意图分类层进行路由和约束,防止生成幻觉内容或偏离主题的回复。
  • 请真实用户测试,而非内部团队:内部人员了解机器人的使用逻辑,会用“正确”的方式提问,但真实用户不会。上线前请至少10名真实用户参与测试。
  • 对话日志是宝贵资源:每周复盘对话日志。失败的对话会暴露缺失的意图、易混淆的流程和训练数据的漏洞。

References

参考资料

  • For NLU training data best practices, see
    references/nlu-training.md
  • For LINE/Messenger platform integration, see the ecom-conversational skill
  • 关于NLU训练数据的最佳实践,请查看
    references/nlu-training.md
  • 关于LINE/Messenger平台集成,请参考电商对话技能文档