mcpField
D
detect-conversation-type

detect-conversation-type

github.com/happy-technologies-llc其他4141 次安装2 天前更新
代码仓库

关于 detect-conversation-type

此技能用于识别 ServiceNow 交互渠道中的对话类型,并为路由和后续处理提供分类依据。它覆盖咨询、请求、投诉、反馈、升级、故障排查和跟进,也能识别多意图对话。

主要功能

  1. 01分类七种对话类型
  2. 02识别对话中的多个意图
  3. 03将分类映射到路由规则
  4. 04把分类元数据写入交互记录
  5. 05通过人工修正跟踪分类准确性

适用场景

  1. 01为 Virtual Agent 主题配置路由
  2. 02按对话类型转交客服或处理队列
  3. 03为交互记录补充分类信息
  4. 04分析人工覆盖结果以调整规则

MCP 相关

该技能使用 ServiceNow MCP 工具读取消息和交互记录、搜索主题,并创建或更新下游记录及分类元数据。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/happy-technologies-llc/happy-platform-skills --skill detect-conversation-type

安装后在 Claude Code 中输入/detect-conversation-type确认已加载。

详细介绍

对话类型检测与分类

概述

此技能可检测并分类 ServiceNow 交互渠道(Virtual Agent、聊天、电子邮件、门户)中发生的对话类型,以实现智能路由和处理:

  • 咨询:询问服务、政策或状态的信息
  • 请求:可执行的服务请求或目录订单
  • 投诉:表达不满,需要进行服务补救
  • 反馈:针对服务、流程或体验提出的建设性意见
  • 升级:需要立即处理或管理层介入的紧急问题
  • 故障排除:需要执行诊断步骤来解决的技术问题
  • 跟进:延续先前对话或现有工单

适用场景: 构建 Virtual Agent 主题路由、为交互记录添加分类元数据、自动化对话移交决策,或分析对话模式以改进服务时。

前提条件

  • 角色: admin、sn_customerservice_manager、itil 或 virtual_agent_admin
  • 插件: com.glide.cs.chatbot(Virtual Agent)、com.glide.interaction(Agent Workspace Interaction)
  • 访问权限: 对 sys_cs_conversation、sys_cs_message、interaction 表具有读取权限
  • 知识: Virtual Agent 主题设计、对话流程概念、情感分析基础
  • 相关技能: csm/sentiment-analysis 用于情感评分,csm/chat-recommendation 用于回复建议

操作步骤

步骤 1:检索对话消息

获取对话历史以进行分类。

MCP 方法:

Tool: SN-Query-Table
Parameters:
  table_name: sys_cs_message
  query: conversation=<conversation_sys_id>^ORDERBYsys_created_on
  fields: sys_id,body,direction,sys_created_on,typed_by,message_type
  limit: 50

REST 方法:

GET /api/now/table/sys_cs_message
  ?sysparm_query=conversation=<conversation_sys_id>^ORDERBYsys_created_on
  &sysparm_fields=sys_id,body,direction,sys_created_on,typed_by,message_type
  &sysparm_limit=50

对于基于交互的对话:

Tool: SN-Query-Table
Parameters:
  table_name: interaction
  query: sys_id=<interaction_sys_id>
  fields: sys_id,short_description,type,channel,state,opened_for,assigned_to,opened_at,work_notes
  limit: 1
步骤 2:分析用户的初始消息

用户的第一条消息是判断对话类型的最强信号。提取以下内容:

意图信号:

信号类型示例分类
疑问词“我该如何……?”、“什么是……?”、“我可以在哪里……?”咨询
行动动词“我需要……”、“请设置……”、“你能创建……吗?”请求
负面情绪“这无法接受……”、“我很沮丧……”投诉
建议用语“如果能……就好了”、“你们是否考虑过……”反馈
紧急标记“紧急”、“这是关键问题”、“现在就需要帮助”升级
问题描述“它无法正常工作”、“我遇到了错误……”故障排除
提及先前事项“跟进 INC……”、“如之前讨论……”跟进
步骤 3:应用分类规则

使用加权分析,根据各类型对对话进行评分:

=== CONVERSATION CLASSIFICATION ===
Conversation ID: CS0045678
Channel: Virtual Agent (Service Portal)
User: Jane Smith (Engineering)
Initial Message: "I've been waiting 5 days for my laptop and no one
  has contacted me. This is the third time I've had to follow up.
  I need this resolved today or I need to speak with a manager."

Classification Scores:
| Type            | Score | Signals Detected |
|-----------------|-------|------------------|
| Complaint       | 85%   | Negative sentiment, dissatisfaction, wait time mention |
| Escalation      | 75%   | "speak with a manager", urgency ("today") |
| Follow-up       | 60%   | "third time", reference to prior interaction |
| Request         | 30%   | "need this resolved" (implicit service need) |
| Inquiry         | 10%   | No information-seeking language |
| Feedback        | 5%    | No constructive suggestion |
| Troubleshooting | 5%    | No technical problem described |

PRIMARY: Complaint (85%)
SECONDARY: Escalation (75%)
COMPOSITE: Complaint with Escalation Request

URGENCY: High
SENTIMENT: Negative (frustrated)
PRIORITY ACTION: Route to human agent with escalation flag
步骤 4:检测多意图对话

部分对话包含多个意图。请识别所有意图:

MCP 方法:

Tool: SN-Query-Table
Parameters:
  query: 123TEXTQUERY321=laptop delivery delay complaint escalation
  table_name: sys_cb_topic
  limit: 10

逐条分析消息,识别意图变化:

Message 1: "I need to reset my password" -> Request
Message 2: "Also, the VPN has been slow all week" -> Troubleshooting
Message 3: "And when will the new laptops be available?" -> Inquiry

Classification: Multi-intent conversation
Primary: Request (password reset - most actionable)
Secondary: Troubleshooting (VPN performance)
Tertiary: Inquiry (laptop availability)
步骤 5:将分类映射到路由规则

根据分类确定适当的处理工作流。

路由矩阵:

分类渠道优先级路由至
咨询Virtual Agent低知识搜索 -> FAQ 主题
请求Virtual Agent中目录项目主题 -> 履行
投诉实时 Agent高CSM 队列 -> 服务补救
反馈异步低反馈收集 -> 调查
升级实时 Agent严重经理队列 -> 优先处理
故障排除Virtual Agent中诊断主题 -> IT 支持
跟进实时 Agent中原受理人 -> 恢复上下文

MCP 方法:

Tool: SN-Query-Table
Parameters:
  table_name: sys_cb_topic
  query: nameLIKEcomplaint^active=true
  fields: sys_id,name,description,queue,priority,active
  limit: 5
步骤 6:丰富交互记录

使用分类元数据更新交互或对话记录。

MCP 方法:

Tool: SN-Update-Record
Parameters:
  table_name: interaction
  sys_id: <interaction_sys_id>
  data:
    u_conversation_type: "complaint"
    u_secondary_type: "escalation"
    u_urgency: "high"
    u_sentiment: "negative"
    u_classification_confidence: "85"
    u_routing_recommendation: "csm_escalation_queue"

REST 方法:

PATCH /api/now/table/interaction/<interaction_sys_id>
Body: {
  "u_conversation_type": "complaint",
  "u_secondary_type": "escalation",
  "u_urgency": "high",
  "u_sentiment": "negative"
}
步骤 7:根据类型创建下游记录

根据分类自动创建相应的记录。

对于投诉——创建 CSM 案例:

MCP 方法:

Tool: SN-Create-Record
Parameters:
  table_name: sn_customerservice_case
  data:
    short_description: "Complaint: Laptop delivery delay - 3rd follow-up"
    description: "<conversation summary>"
    priority: 2
    contact: "<user_sys_id>"
    category: "complaint"
    u_complaint_type: "service_delivery"
    u_source_conversation: "<conversation_sys_id>"

对于请求——创建目录请求:

MCP 方法:

Tool: SN-Create-Record
Parameters:
  table_name: sc_request
  data:
    requested_for: "<user_sys_id>"
    short_description: "Password reset request via chat"
    description: "<conversation context>"
    u_source_conversation: "<conversation_sys_id>"
步骤 8:处理升级路由

检测到升级时,立即触发路由。

MCP 方法:

Tool: SN-Update-Record
Parameters:
  table_name: interaction
  sys_id: <interaction_sys_id>
  data:
    state: "transferred_to_agent"
    assignment_group: "<escalation_queue_sys_id>"
    u_escalation_reason: "Customer requested manager involvement"
    u_escalation_priority: "high"
    work_notes: "AI Classification: Complaint with escalation request. Customer has followed up 3 times regarding laptop delivery delay. Sentiment: Negative/Frustrated. Routing to escalation queue."
步骤 9:跟踪分类准确率

随着时间推移监控并验证分类决策。

MCP 方法:

Tool: SN-Query-Table
Parameters:
  table_name: interaction
  query: u_conversation_typeISNOTEMPTY^sys_created_on>javascript:gs.daysAgo(30)
  fields: u_conversation_type,u_classification_confidence,state,u_agent_override_type
  limit: 500

计算准确率指标:

=== CLASSIFICATION ACCURACY (Last 30 Days) ===

| Type            | Classified | Agent Override | Accuracy |
|-----------------|-----------|---------------|----------|
| Inquiry         | 245       | 12            | 95.1%    |
| Request         | 189       | 8             | 95.8%    |
| Complaint       | 67        | 5             | 92.5%    |
| Troubleshooting | 156       | 11            | 92.9%    |
| Escalation      | 34        | 3             | 91.2%    |
| Feedback        | 28        | 4             | 85.7%    |
| Follow-up       | 42        | 6             | 85.7%    |

Overall Accuracy: 93.4%
Most Common Misclassification: Feedback classified as Inquiry
步骤 10:优化分类规则

使用人工覆盖数据提高分类准确率。

MCP 方法:

Tool: SN-Query-Table
Parameters:
  table_name: interaction
  query: u_agent_override_typeISNOTEMPTY^u_conversation_type!=u_agent_override_type
  fields: u_conversation_type,u_agent_override_type,short_description
  limit: 50

分析分类错误,找出模式并更新路由规则。

工具用法

工具用途适用时机
SN-Query-Table获取对话、消息、主题和指标主要数据检索
SN-Get-Record检索特定交互详情分析单个对话
SN-Create-Record创建下游记录(案例、事件)根据分类采取行动
SN-Update-Record使用分类元数据补充交互信息记录分类结果
SN-Natural-Language-Search查找匹配的主题或类似对话主题路由和模式匹配

最佳实践

  1. 根据首条消息进行分类——不要等待多轮交流后才进行初步分类
  2. 支持重新分类——对话类型可能在过程中发生变化;应动态更新分类
  3. 使用置信度阈值——置信度低于 70% 时,将对话转交人工 Agent 进行分类
  4. 结合意图和情感——带有负面情绪的请求可能实际上是投诉
  5. 妥善处理多重意图——先处理最紧急的意图,再处理次要意图
  6. 保留对话上下文——将完整的分类元数据传递给接收方 Agent 或工作流
  7. 跟踪 Agent 的人工覆盖——将人工覆盖数据作为训练信号,以改进分类规则
  8. 考虑渠道上下文——电话通话与聊天或电子邮件的模式不同
  9. 检测语言和语气变化——情绪升级通常表现为从中性转为负面
  10. 尊重隐私——不要在元数据字段中记录或分类敏感个人信息

故障排除

问题原因解决方法
未检索到消息对话表或 ID 格式错误检查 sys_cs_conversation 与 interaction 表
分类始终为“Inquiry”默认回退策略过于激进降低咨询阈值,添加更多信号模式
未检测到升级信号列表中没有紧急措辞在检测规则中添加特定领域的紧急短语
未处理多重意图仅提取了第一个意图实现逐条消息分析并累积意图
路由到错误队列主题映射已过时更新 sys_cb_topic 路由配置
置信度得分较低消息含糊或过短分类前向用户请求澄清

示例

示例 1:虚拟 Agent 咨询分类

输入: 用户消息:“2026 年公司的假期安排是什么?”

分类: 咨询(置信度 95%)。路由至知识库搜索主题。建议的知识库文章:“2026 年公司假日日历”。

示例 2:投诉与升级检测

输入: 用户消息:“我两周前提交了请求,但一直没有进展。这完全无法接受。我需要和真正能帮忙的人谈谈。”

分类: 投诉(88%)+ 升级(80%)。路由至升级队列中的在线 Agent。标记为高优先级。自动搜索该用户已有的未结请求。

示例 3:多意图聊天会话

输入: 用户发送 3 条消息:密码重置请求、关于 VPN 政策的问题,以及对门户设计的反馈。

分类: 检测到多种意图。主要意图:请求(密码重置,可执行)。次要意图:咨询(VPN 政策)。第三意图:反馈(门户)。将密码重置请求转至 IT 主题,将 VPN 问题加入知识搜索队列,并记录反馈,供 UX 团队审核。

相关技能

  • csm/sentiment-analysis - 对对话进行深入情感分析
  • csm/chat-recommendation - 为 Agent 提供建议回复
  • hrsd/chat-reply-recommendation - HR 专属聊天回复建议
  • genai/playbook-recommendations - 将对话与处理手册相匹配
  • itsm/incident-triage - 事件分类与路由

评论

支持 Markdown