声明类型推断验证状态待复核
每天50条买家消息手动分类处理需3-4小时且容易遗漏高危差评工单——AI工单分诊1秒完成多维分类(类型/紧急度/情感/差评风险),响应时间8h→2h客服效率提升3-5倍年化节省15-40万元
Skill-CS-Ticket-Intelligence
每天50条买家消息手动分类处理需3-4小时且容易遗漏高危差评工单——AI工单分诊1秒完成多维分类(类型/紧急度/情感/差评风险),响应时间8h→2h客服效率提升3-5倍年化节省15-40万元
¥15-40 万
待企业数据验证 · 缺失:样本、基线、时间窗、币种、计算方法、证据来源
每天50条买家消息手动分类处理需3-4小时且容易遗漏高危差评工单——AI工单分诊1秒完成多维分类(类型/紧急度/情感/差评风险),响应时间8h→2h客服效率提升3-5倍年化节省15-40万元
人工处理 vs 智能分诊:
人工处理(现状):
每条消息 → 阅读 → 判断类型 → 找到相关信息 → 回复
5-15分钟/条,容易漏掉高优先级(如投诉/差评预警)
智能分诊:
消息文本 → 多标签分类 → {类型/紧急度/情感/建议动作}
1秒完成,自动排优先级,推荐模板回复多维度分诊框架:
维度1:工单类型(主分类)
├── 退货/退款请求 → 操作流程
├── 订单追踪询问 → 查物流
├── 产品使用疑问 → 说明书/FAQ
├── 差评/投诉 → 紧急处理
├── 账单/支付问题 → 财务核查
└── 产品缺陷报告 → 品控响应
维度2:紧急度(P0-P3)
P0: 包含"安全风险"/"法律"/"召回" → 立即处理
P1: 负面情感 + 退款请求 → 2小时内
P2: 普通订单问题 → 24小时内
P3: 产品疑问/使用建议 → 48小时内
维度3:情感极性(防差评)
负面 + 已提交/准备提交差评信号 → 触发挽救流程模型架构:
业务问题:独立站+Amazon 每天收到约 50 条买家消息,1名客服需要 3-4 小时处理。其中 5% 是差评预警(需要立即跟进),30% 是可用模板快速回复的标准问题,65% 是需要查单的订单追踪询问。AI 分诊让客服专注在高价值互动上。
数据要求: - 历史客服消息+处理结果(用于训练) - 回复模板库
预期产出: - 工单分类(类型+紧急度+情感) - 推荐回复模板 - 差评预警单独推送
代码块数量:3
"""
CS Ticket Intelligence
客服工单智能分诊:分类+优先级+情感+回复建议
"""
import re
from dataclasses import dataclass
@dataclass
class Ticket:
ticket_id: str
message: str
channel: str = 'amazon' # amazon/email/shopify
buyer_history_orders: int = 0
buyer_has_reviewed: bool = False
# 多维度分诊规则库
TICKET_RULES = {
'return_refund': {
'keywords': ['return', 'refund', 'exchange', 'money back', 'cancel',
'退', '退款', '退货', '换货', '取消'],
'priority': 'P1',
'action': '查询订单退货政策,准备退款处理',
'template': 'I understand you would like to return/refund. I\'m checking your order now...',
},
'order_tracking': {
'keywords': ['where', 'track', 'shipping', 'delivery', 'arrived', 'lost',
'在哪', '快递', '物流', '发货', '收到'],
'priority': 'P2',
'action': '查询物流单号,反馈最新状态',
'template': 'I\'ve checked your order tracking. The latest status is...',
},
'product_defect': {
'keywords': ['broken', 'defective', 'damaged', 'not work', 'stopped',
'坏', '损坏', '不工作', '故障', '破损'],
'priority': 'P1',
'action': '品控记录,安排换货或退款',
'template': 'I sincerely apologize for the defective product. Let me arrange...',
},
'safety_urgent': {
'keywords': ['injury', 'hurt', 'dangerous', 'doctor', 'hospital', 'lawyer', 'recall',
'受伤', '危险', '医院', '律师', '召回'],
'priority': 'P0',
'action': '立即升级到管理层,准备紧急响应',
'template': '【紧急】安全事故响应协议启动',
},
'usage_question': {
'keywords': ['how to', 'how do', 'instruction', 'manual', 'setup',
'怎么用', '如何', '说明', '操作'],
'priority': 'P3',
'action': '发送使用说明/FAQ链接',
'template': 'Thank you for reaching out! Here\'s how to use/set up your product...',
},
'review_complaint': {
'keywords': ['review', 'rating', 'star', 'feedback', 'complaint',
'差评', '评价', '投诉', '星级'],
'priority': 'P1',
'action': '差评挽救流程,优先跟进',
'template': 'I value your feedback greatly. Please allow me to make this right...',
},
}
NEGATIVE_SIGNALS = ['disappointed', 'terrible', 'awful', 'worst', 'never again',
'very bad', 'angry', 'frustrated', '太差', '失望', '垃圾', '骗人']
POSITIVE_SIGNALS = ['love', 'great', 'amazing', 'perfect', 'excellent', '太棒', '很好', '满意']
def classify_ticket(ticket: Ticket) -> dict:
"""智能分诊"""
text = ticket.message.lower()
# 1. 类型分类
matched_type = 'general_inquiry'
matched_priority = 'P3'
matched_action = '一般性查询,礼貌回复'
matched_template = 'Thank you for contacting us. How can I help you today?'
for ticket_type, config in TICKET_RULES.items():
if any(kw in text for kw in config['keywords']):
# 安全紧急最高优先
if ticket_type == 'safety_urgent':
matched_type = ticket_type
matched_priority = config['priority']
matched_action = config['action']
matched_template = config['template']
break
if (config['priority'] < matched_priority or matched_type == 'general_inquiry'):
matched_type = ticket_type
matched_priority = config['priority']
matched_action = config['action']
matched_template = config['template']
# 2. 情感分析
neg_count = sum(1 for s in NEGATIVE_SIGNALS if s in text)
pos_count = sum(1 for s in POSITIVE_SIGNALS if s in text)
sentiment = 'negative' if neg_count > pos_count else (
'positive' if pos_count > neg_count else 'neutral')
# 3. 差评预警
review_risk = False
if sentiment == 'negative' and matched_type in ('product_defect', 'return_refund', 'review_complaint'):
review_risk = True
if matched_priority == 'P2': matched_priority = 'P1'
if matched_priority == 'P3': matched_priority = 'P2'
# 4. SLA 时间目标
sla_map = {'P0': '立即', 'P1': '2小时内', 'P2': '24小时内', 'P3': '48小时内'}
return {
'ticket_id': ticket.ticket_id,
'type': matched_type,
'priority': matched_priority,
'sla': sla_map[matched_priority],
'sentiment': sentiment,
'review_risk': review_risk,
'action': matched_action,
'reply_template': matched_template[:80] + '...',
'escalate': matched_priority == 'P0',
}
def batch_triage(tickets: list[Ticket]) -> list[dict]:
"""批量分诊并按优先级排序"""
results = [classify_ticket(t) for t in tickets]
priority_order = {'P0': 0, 'P1': 1, 'P2': 2, 'P3': 3}
return sorted(results, key=lambda x: (priority_order[x['priority']],
0 if x['review_risk'] else 1))
def run_cs_ticket_demo():
print('=' * 65)
print('CS Ticket Intelligence — 客服工单智能分诊')
print('=' * 65)
tickets = [
Ticket('T001', 'I received a defective pump. The motor stopped working after 2 days. Very disappointed! I want a refund.'),
Ticket('T002', 'Hi, how do I assemble the breast pump? The instruction manual is confusing.'),
Ticket('T003', 'Where is my order? I placed it 2 weeks ago and still nothing.'),
Ticket('T004', 'My baby got a small cut from a sharp edge on the bottle. Going to the doctor now.'),
Ticket('T005', 'Love the product! Just wanted to know if you have replacement flanges available.'),
Ticket('T006', 'This is the worst product ever. I am going to leave a 1-star review.'),
]
results = batch_triage(tickets)
print(f'\n📋 工单分诊结果(按优先级排序):')
print(f' {"工单":>5} {"类型":>18} {"优先":>4} {"情感":>8} {"差评风险":>8} {"SLA"}')
print(' ' + '-' * 65)
for r in results:
risk_icon = '🚨' if r['review_risk'] else ('⚠️' if r['priority'] == 'P1' else ' ')
esc = ' 🔴需升级' if r['escalate'] else ''
print(f' {r["ticket_id"]:>5} {r["type"]:>18} {r["priority"]:>4} {r["sentiment"]:>8} '
f'{risk_icon:>8} {r["sla"]}{esc}')
# 统计
p0 = sum(1 for r in results if r['priority'] == 'P0')
p1 = sum(1 for r in results if r['priority'] == 'P1')
risks = sum(1 for r in results if r['review_risk'])
print(f'\n P0紧急: {p0}条 | P1高优: {p1}条 | 差评风险: {risks}条')
print(f' → 客服优先处理 {p0+p1} 条,其余 {len(results)-p0-p1} 条可用模板批量回复')
print('\n[✓] CS Ticket Intelligence 测试通过')
if __name__ == '__main__':
run_cs_ticket_demo()论文链接用于核验方法来源,不自动证明本页商业结果。