🧠 图解记忆:客服系统先分流,再基于证据回答,最后以人工接管兜底;点击图片可查看原图。
💡 答案要点(STAR框架)
S(背景): 1000万用户,日活100万,需要7×24小时智能客服
T(任务): 设计一个能处理咨询、售后、投诉等多场景的AI客服系统
A(行动)——四层架构设计:
┌─────────────────────────────────────────────────────┐
│ 接入层:多渠道统一接入 │
│ 微信/APP/网页/电话 → 统一消息格式 │
└──────────────────┬──────────────────────────────────┘
↓
┌──────────────────────────────────────────────────┐
│ 路由层:意图识别 + 路由分发 │
│ LLM 判断意图 → 转人工/知识库/工单系统 │
└──────────────────┬─────────────────────────────────┘
↓
┌──────────────────────────────────────────────────┐
│ 能力层:多Agent协作 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 知识库Agent│ │ 订单Agent │ │ 投诉Agent │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────┬─────────────────────────────────┘
↓
┌──────────────────────────────────────────────────┐
│ 数据层:会话记忆 + 知识库 + 工单系统 │
└──────────────────────────────────────────────────┘关键设计点:
python
# 意图识别 + 路由
def route(query, session_history):
intent = llm.judge(f"""
判断用户意图:
1=咨询 2=下单 3=售后 4=投诉 5=转人工
问题:{query}
历史:{session_history[-3:]}
""")
if intent == 5 or contains_sensitive词(query):
return "human_agent" # 转人工
elif intent == 1:
return "knowledge_agent"
elif intent == 2:
return "order_agent"
# ...
# 多轮对话记忆
class ConversationMemory:
def __init__(self, max_turns=10):
self.history = []
self.max_turns = max_turns
def add(self, role, content):
self.history.append({"role": role, "content": content})
if len(self.history) > self.max_turns * 2:
# 压缩:保留关键信息
self.history = self.summarize_and_compress()R(结果): 客服响应时间从30s→2s,问题解决率85%,人工客服工作量减少60%
