feat: 2026-07-12~13 全量更新 - AI对话链路改造+H5 v4/v5+坐席端v5+上下文感知诊断+知识库迭代3
## H5 员工端 v4 (2026-07-13 00:48 已部署)
- 人工按钮三态文案统一为"人工坐席"
- 按钮位置移至发送键和语音按钮上方(垂直堆叠)
- 点按钮直接调 store.shakeAgent(),删除 CallAgentModal 弹窗动画
- 截图快捷键提示改为"截图->粘贴:Alt+Shift+A-Ctrl+V ---> Ctrl+V"
- 移动端隐藏截图提示(CSS 媒体查询)
- AI转人工提示改为"已为您呼叫人工坐席,请稍等!"
- 坐席接入提示改为"坐席正在查看您的信息,请等待处理回复!"
- 删除"摇铃呼叫坐席"入口和文案
- 删除孤儿组件 MessageList.vue + shake 动画 CSS
## H5 员工端 v5 (2026-07-13 02:08 已部署)
- RightPanel v2.1:删除"软件安装"和"资源权限"标签页
- 移除标签栏,智能推荐(DynamicRecommend)直接展示
- 删除 SoftwareDownloads/ApprovalLinks 引用和相关 CSS
## AI 对话链路全栈改造 Phase 1-6 (已部署)
- Phase 1: Dify JSON输出 + 后端blocking解析 + 双WS推送 + 错误降级
- Phase 2: 关键词收窄(~25强意图词) + 两级分类Prompt + 删除前端checkApprovalIntent
- Phase 3: WS扩展(ai_thinking+dynamic_recommend) + ai_structured气泡 + RightPanel v2 + 选项回传
- Phase 4: VisionService接入 + 图片消息融合(5秒窗口) + 降级策略
- Phase 5: 坐席端ai_thinking指示器 + ai_structured/byod_card渲染 + handleNewMessage修复
- Phase 6: diagnosis_stage(6值) + response_time_ms计时 + 慢响应告警(>10s)
## 坐席端 v5 (2026-07-13 01:38 已部署)
- ai_structured/byod_card 只读渲染
- AI思考指示器 UI
- handleNewMessage 透传 msg_type/extra_data 修复
- 布局优化v2.0: QuickReplyBar L1+L2悬浮 + ReplyBox左右分区 + 右栏260/560px切换
- 键盘快捷键v2.3: 纯数字路由 + ESC分层撤销 + Shift+Space用event.code
## 上下文感知智能诊断闭环 (2026-07-12 已部署)
- 三层诊断(API→Script→AI) + 三段排队(VIP→info_locked→not locked)
- 答题插队 + 五场景关闭
- 迁移052(6表+6列) + queue_service + quiz_service + closing_service
- H5前端: QueueWaiting + RightPanel双Tab + InputBar三态 + ResolveConfirmCard
- 坐席前端: pending_close结单流程 + 信息锁定(Dify步骤完成+有效回答率≥70%)
## 知识库迭代3 (2026-07-12 已部署)
- 分诊交互(H5+坐席+Dify独立应用)
- 拓扑预览(ECharts只读)
- 代答排除(4种匹配器: keyword/regex/intent/category)
- 迁移051 + 44文件43测试通过
## 后端变更
- 6个Python文件改造(h5_ai_task.py/h5.py/ai_service.py/closing_service.py等)
- funny_phrase_service.py: shake/connected/keyword 默认文案更新
- session_service.py: 企微消息文案同步
- 新增: queue.py/quiz.py/triage.py/exclusion_rules.py 等API端点
- 新增: diagnostic.py/quiz.py/triage_session.py 等模型
- 新增: closing_service/queue_service/quiz_service/triage_service 等服务
## 文档更新
- CHANGELOG.md: 新增 [未发布] 区全部变更记录
- 项目管理主文档 v2.5: 新增v0.7.3版本 + 已完成看板 + 最近搞定
- 版本记录: 新增v0.7.3条目
- AI对话链路实施计划: Phase 1-6 全部标记✅已实施
- 新增架构图/时序图/类图(mermaid)
## 部署路径修正
- 服务器项目根路径: /opt/wecom-it-desk/
- 所有前端dist均为ro bind mount,只能在宿主机源路径操作
- 服务器nginx /h5/ 是静态文件服务(非proxy_pass)
- elFinder上传二进制不可靠(MD5不匹配),改用base64分块上传
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
# =============================================================================
|
||||
# 企微IT智能服务台 — 代答排除 Pydantic Schema
|
||||
# =============================================================================
|
||||
# 说明:代答排除模块的请求/响应数据模型,覆盖管理后台所有接口。
|
||||
# =============================================================================
|
||||
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 请求 Schema
|
||||
# =============================================================================
|
||||
|
||||
class ExclusionRuleCreate(BaseModel):
|
||||
"""新建排除规则请求。
|
||||
|
||||
Attributes:
|
||||
rule_name: 规则名称(唯一)
|
||||
rule_description: 规则描述
|
||||
priority: 优先级(P0/P1/P2/P3)
|
||||
match_type: 匹配方式(keyword/regex/intent/category)
|
||||
match_condition: 匹配条件
|
||||
match_scope: 匹配范围
|
||||
action_type: 命中后动作类型
|
||||
transfer_message: 转人工提示语
|
||||
"""
|
||||
|
||||
rule_name: str = Field(..., min_length=1, max_length=200, description="规则名称")
|
||||
rule_description: Optional[str] = Field(None, description="规则描述")
|
||||
priority: str = Field("P2", description="优先级:P0/P1/P2/P3")
|
||||
match_type: str = Field(..., description="匹配方式:keyword/regex/intent/category")
|
||||
match_condition: str = Field(..., min_length=1, description="匹配条件")
|
||||
match_scope: List[str] = Field(default_factory=lambda: ["ai_auto_reply"], description="匹配范围")
|
||||
action_type: str = Field("transfer_human", description="命中后动作类型")
|
||||
transfer_message: Optional[str] = Field(None, description="转人工提示语")
|
||||
|
||||
|
||||
class ExclusionRuleUpdate(BaseModel):
|
||||
"""编辑排除规则请求。
|
||||
|
||||
所有字段可选,仅更新传入的字段。
|
||||
|
||||
Attributes:
|
||||
rule_name: 规则名称
|
||||
rule_description: 规则描述
|
||||
priority: 优先级
|
||||
match_type: 匹配方式
|
||||
match_condition: 匹配条件
|
||||
match_scope: 匹配范围
|
||||
action_type: 命中后动作类型
|
||||
transfer_message: 转人工提示语
|
||||
"""
|
||||
|
||||
rule_name: Optional[str] = Field(None, min_length=1, max_length=200, description="规则名称")
|
||||
rule_description: Optional[str] = Field(None, description="规则描述")
|
||||
priority: Optional[str] = Field(None, description="优先级")
|
||||
match_type: Optional[str] = Field(None, description="匹配方式")
|
||||
match_condition: Optional[str] = Field(None, description="匹配条件")
|
||||
match_scope: Optional[List[str]] = Field(None, description="匹配范围")
|
||||
action_type: Optional[str] = Field(None, description="命中后动作类型")
|
||||
transfer_message: Optional[str] = Field(None, description="转人工提示语")
|
||||
|
||||
|
||||
class ExclusionRuleToggle(BaseModel):
|
||||
"""启用/停用规则请求。
|
||||
|
||||
Attributes:
|
||||
status: 目标状态(enabled/disabled)
|
||||
"""
|
||||
|
||||
status: str = Field(..., description="目标状态:enabled/disabled")
|
||||
|
||||
|
||||
class ExclusionTestRequest(BaseModel):
|
||||
"""测试匹配请求。
|
||||
|
||||
Attributes:
|
||||
message: 测试消息文本
|
||||
rule_id: 指定规则ID(可选,不指定则测试所有启用规则)
|
||||
"""
|
||||
|
||||
message: str = Field(..., min_length=1, description="测试消息文本")
|
||||
rule_id: Optional[str] = Field(None, description="指定规则ID")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 查询参数 Schema
|
||||
# =============================================================================
|
||||
|
||||
class ExclusionRuleQuery(BaseModel):
|
||||
"""排除规则列表查询参数。
|
||||
|
||||
Attributes:
|
||||
status: 状态筛选
|
||||
match_type: 匹配方式筛选
|
||||
priority: 优先级筛选
|
||||
keyword: 关键词搜索(规则名称/描述)
|
||||
page: 页码
|
||||
page_size: 每页数量
|
||||
"""
|
||||
|
||||
status: Optional[str] = Field(None, description="状态筛选")
|
||||
match_type: Optional[str] = Field(None, description="匹配方式筛选")
|
||||
priority: Optional[str] = Field(None, description="优先级筛选")
|
||||
keyword: Optional[str] = Field(None, description="关键词搜索")
|
||||
page: int = Field(1, ge=1, description="页码")
|
||||
page_size: int = Field(20, ge=1, le=100, description="每页数量")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 响应 Schema
|
||||
# =============================================================================
|
||||
|
||||
class ExclusionRuleResponse(BaseModel):
|
||||
"""排除规则响应。
|
||||
|
||||
Attributes:
|
||||
id: 规则ID
|
||||
rule_name: 规则名称
|
||||
rule_description: 规则描述
|
||||
priority: 优先级
|
||||
match_type: 匹配方式
|
||||
match_condition: 匹配条件
|
||||
match_scope: 匹配范围
|
||||
action_type: 命中后动作类型
|
||||
transfer_message: 转人工提示语
|
||||
status: 状态
|
||||
hit_count: 命中次数
|
||||
created_by: 创建人ID
|
||||
created_at: 创建时间
|
||||
updated_at: 更新时间
|
||||
"""
|
||||
|
||||
id: str = Field(..., description="规则ID")
|
||||
rule_name: str = Field(..., description="规则名称")
|
||||
rule_description: Optional[str] = Field(None, description="规则描述")
|
||||
priority: str = Field(..., description="优先级")
|
||||
match_type: str = Field(..., description="匹配方式")
|
||||
match_condition: str = Field(..., description="匹配条件")
|
||||
match_scope: List[str] = Field(default_factory=list, description="匹配范围")
|
||||
action_type: str = Field(..., description="命中后动作类型")
|
||||
transfer_message: Optional[str] = Field(None, description="转人工提示语")
|
||||
status: str = Field(..., description="状态")
|
||||
hit_count: int = Field(0, description="命中次数")
|
||||
created_by: str = Field(..., description="创建人ID")
|
||||
created_at: Optional[datetime] = Field(None, description="创建时间")
|
||||
updated_at: Optional[datetime] = Field(None, description="更新时间")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ExclusionTestResponse(BaseModel):
|
||||
"""测试匹配响应。
|
||||
|
||||
Attributes:
|
||||
matched: 是否命中
|
||||
matched_detail: 命中详情
|
||||
rule_name: 命中的规则名称
|
||||
action_type: 命中后动作类型
|
||||
"""
|
||||
|
||||
matched: bool = Field(False, description="是否命中")
|
||||
matched_detail: Optional[str] = Field(None, description="命中详情")
|
||||
rule_name: Optional[str] = Field(None, description="命中的规则名称")
|
||||
action_type: Optional[str] = Field(None, description="命中后动作类型")
|
||||
|
||||
|
||||
class ExclusionStatsResponse(BaseModel):
|
||||
"""排除规则统计概要响应。
|
||||
|
||||
Attributes:
|
||||
enabled_count: 启用规则数
|
||||
disabled_count: 停用规则数
|
||||
monthly_hits: 本月命中次数
|
||||
monthly_transfers: 本月转人工次数
|
||||
"""
|
||||
|
||||
enabled_count: int = Field(0, description="启用规则数")
|
||||
disabled_count: int = Field(0, description="停用规则数")
|
||||
monthly_hits: int = Field(0, description="本月命中次数")
|
||||
monthly_transfers: int = Field(0, description="本月转人工次数")
|
||||
@@ -145,3 +145,48 @@ class TerminalBindingListResponse(BaseModel):
|
||||
|
||||
list: List[TerminalBindingResponse] = Field(default_factory=list)
|
||||
total: int = 0
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 报修相关
|
||||
# =============================================================================
|
||||
|
||||
class RepairRequest(BaseModel):
|
||||
"""提交报修请求。"""
|
||||
|
||||
terminal_sn: str = Field(..., min_length=1, max_length=64, description="终端序列号")
|
||||
meetingroom_id: int = Field(..., description="企微会议室ID")
|
||||
meetingroom_name: str = Field("", max_length=100, description="会议室名称")
|
||||
device_type: str = Field(..., min_length=1, max_length=50, description="故障设备类型: projector/video_conf/aircon/desk_chair/network/other")
|
||||
fault_description: str = Field(..., min_length=1, description="故障描述")
|
||||
reporter_name: Optional[str] = Field(None, max_length=100, description="报修人姓名(为空则匿名)")
|
||||
reporter_userid: Optional[str] = Field(None, max_length=64, description="报修人企微userid")
|
||||
|
||||
|
||||
class RepairResponse(BaseModel):
|
||||
"""报修提交响应。"""
|
||||
|
||||
repair_id: int = Field(..., description="报修记录ID")
|
||||
conversation_id: str = Field(..., description="关联的IT工单会话ID")
|
||||
status: int = Field(0, description="报修状态")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 操作指南相关
|
||||
# =============================================================================
|
||||
|
||||
class GuideItem(BaseModel):
|
||||
"""操作指南条目。"""
|
||||
|
||||
id: int = Field(..., description="指南ID")
|
||||
category: str = Field(..., description="设备类型")
|
||||
title: str = Field(..., description="指南标题")
|
||||
brief: str = Field("", description="简要操作步骤")
|
||||
detail_url: str = Field("", description="详细文档URL")
|
||||
icon: str = Field("📋", description="图标emoji")
|
||||
|
||||
|
||||
class GuideListResponse(BaseModel):
|
||||
"""操作指南列表响应。"""
|
||||
|
||||
guides: List[GuideItem] = Field(default_factory=list, description="指南列表")
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
# =============================================================================
|
||||
# 企微IT智能服务台 — 分诊交互 Pydantic Schema
|
||||
# =============================================================================
|
||||
# 说明:分诊模块的请求/响应数据模型,覆盖 H5 端和坐席端所有接口。
|
||||
# =============================================================================
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 基础嵌套模型
|
||||
# =============================================================================
|
||||
|
||||
class TriageOption(BaseModel):
|
||||
"""分诊选项。
|
||||
|
||||
Attributes:
|
||||
label: 选项标签文本
|
||||
probability: AI 推荐概率(0.0-1.0)
|
||||
"""
|
||||
|
||||
label: str = Field(..., description="选项标签文本")
|
||||
probability: Optional[float] = Field(None, ge=0.0, le=1.0, description="AI推荐概率")
|
||||
|
||||
|
||||
class TriageStep(BaseModel):
|
||||
"""分诊步骤。
|
||||
|
||||
Attributes:
|
||||
question: 步骤问题文本
|
||||
options: 选项列表
|
||||
"""
|
||||
|
||||
question: str = Field(..., description="步骤问题文本")
|
||||
options: List[TriageOption] = Field(default_factory=list, description="选项列表")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# H5 端请求 Schema
|
||||
# =============================================================================
|
||||
|
||||
class TriageStartRequest(BaseModel):
|
||||
"""发起分诊请求。
|
||||
|
||||
Attributes:
|
||||
conversation_id: 会话ID
|
||||
question: 员工问题文本
|
||||
"""
|
||||
|
||||
conversation_id: str = Field(..., description="会话ID")
|
||||
question: str = Field(..., min_length=1, description="员工问题文本")
|
||||
|
||||
|
||||
class TriageStepRequest(BaseModel):
|
||||
"""提交步骤选择请求。
|
||||
|
||||
Attributes:
|
||||
triage_id: 分诊会话ID
|
||||
step_index: 当前步骤序号(0-based)
|
||||
selected_label: 选择的选项标签
|
||||
"""
|
||||
|
||||
triage_id: str = Field(..., description="分诊会话ID")
|
||||
step_index: int = Field(..., ge=0, description="当前步骤序号")
|
||||
selected_label: str = Field(..., description="选择的选项标签")
|
||||
|
||||
|
||||
class TriageSkipRequest(BaseModel):
|
||||
"""跳过步骤请求。
|
||||
|
||||
Attributes:
|
||||
triage_id: 分诊会话ID
|
||||
step_index: 要跳过的步骤序号
|
||||
"""
|
||||
|
||||
triage_id: str = Field(..., description="分诊会话ID")
|
||||
step_index: int = Field(..., ge=0, description="要跳过的步骤序号")
|
||||
|
||||
|
||||
class TriageTransferRequest(BaseModel):
|
||||
"""转人工请求。
|
||||
|
||||
Attributes:
|
||||
triage_id: 分诊会话ID
|
||||
context: 已收集的上下文列表
|
||||
"""
|
||||
|
||||
triage_id: str = Field(..., description="分诊会话ID")
|
||||
context: List[str] = Field(default_factory=list, description="已收集的上下文列表")
|
||||
|
||||
|
||||
class TriageCompleteRequest(BaseModel):
|
||||
"""分诊完成请求。
|
||||
|
||||
Attributes:
|
||||
triage_id: 分诊会话ID
|
||||
context: 已收集的上下文列表
|
||||
"""
|
||||
|
||||
triage_id: str = Field(..., description="分诊会话ID")
|
||||
context: List[str] = Field(default_factory=list, description="已收集的上下文列表")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# H5 端响应 Schema
|
||||
# =============================================================================
|
||||
|
||||
class TriageStartResponse(BaseModel):
|
||||
"""发起分诊响应。
|
||||
|
||||
Attributes:
|
||||
triage_id: 分诊会话ID
|
||||
steps: 分诊步骤列表
|
||||
total: 总步骤数
|
||||
confidence: AI 置信度
|
||||
urgency: 紧急度
|
||||
suggested_route: AI 建议路由
|
||||
"""
|
||||
|
||||
triage_id: str = Field(..., description="分诊会话ID")
|
||||
steps: List[TriageStep] = Field(default_factory=list, description="分诊步骤列表")
|
||||
total: int = Field(0, description="总步骤数")
|
||||
confidence: Optional[float] = Field(None, description="AI 置信度")
|
||||
urgency: str = Field("medium", description="紧急度")
|
||||
suggested_route: Optional[str] = Field(None, description="AI 建议路由")
|
||||
|
||||
|
||||
class TriageStepResponse(BaseModel):
|
||||
"""提交步骤选择响应。
|
||||
|
||||
Attributes:
|
||||
next_step: 下一步骤数据(无下一步时为 null)
|
||||
collected_context: 已收集的上下文列表
|
||||
"""
|
||||
|
||||
next_step: Optional[TriageStep] = Field(None, description="下一步骤数据")
|
||||
collected_context: List[str] = Field(default_factory=list, description="已收集的上下文列表")
|
||||
|
||||
|
||||
class TriageTransferResponse(BaseModel):
|
||||
"""转人工响应。
|
||||
|
||||
Attributes:
|
||||
conversation_id: 会话ID
|
||||
status: 会话状态
|
||||
"""
|
||||
|
||||
conversation_id: str = Field(..., description="会话ID")
|
||||
status: str = Field("waiting_agent", description="会话状态")
|
||||
|
||||
|
||||
class TriageCompleteResponse(BaseModel):
|
||||
"""分诊完成响应。
|
||||
|
||||
Attributes:
|
||||
reply: AI 生成的最终回复
|
||||
confidence: AI 置信度
|
||||
"""
|
||||
|
||||
reply: str = Field(..., description="AI 生成的最终回复")
|
||||
confidence: float = Field(0.0, description="AI 置信度")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 坐席端请求 Schema
|
||||
# =============================================================================
|
||||
|
||||
class TriageRouteRequest(BaseModel):
|
||||
"""坐席路由操作请求。
|
||||
|
||||
Attributes:
|
||||
route_action: 路由动作(ai_self/human/auto_approval/skip)
|
||||
route_note: 路由备注
|
||||
"""
|
||||
|
||||
route_action: str = Field(..., description="路由动作:ai_self/human/auto_approval/skip")
|
||||
route_note: Optional[str] = Field(None, description="路由备注")
|
||||
|
||||
|
||||
class TriageExcludeOptionsRequest(BaseModel):
|
||||
"""坐席排除/推荐分诊选项请求。
|
||||
|
||||
Attributes:
|
||||
excluded_labels: 要排除的选项标签列表
|
||||
recommended_label: 推荐的选项标签
|
||||
"""
|
||||
|
||||
excluded_labels: List[str] = Field(default_factory=list, description="要排除的选项标签列表")
|
||||
recommended_label: Optional[str] = Field(None, description="推荐的选项标签")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# 坐席端响应 Schema
|
||||
# =============================================================================
|
||||
|
||||
class TriageSessionResponse(BaseModel):
|
||||
"""分诊会话列表项响应。
|
||||
|
||||
Attributes:
|
||||
id: 分诊会话ID
|
||||
conversation_id: 会话ID
|
||||
user_id: 员工ID
|
||||
user_name: 员工姓名
|
||||
user_dept: 员工部门
|
||||
request_title: 问题标题
|
||||
problem_type: 问题类型
|
||||
problem_category: 问题分类
|
||||
confidence: AI 置信度
|
||||
urgency: 紧急度
|
||||
suggested_route: AI 建议路由
|
||||
status: 分诊状态
|
||||
route_action: 路由动作
|
||||
route_note: 路由备注
|
||||
operator_id: 操作坐席ID
|
||||
created_at: 创建时间
|
||||
operated_at: 操作时间
|
||||
"""
|
||||
|
||||
id: str = Field(..., description="分诊会话ID")
|
||||
conversation_id: str = Field(..., description="会话ID")
|
||||
user_id: str = Field(..., description="员工ID")
|
||||
user_name: Optional[str] = Field(None, description="员工姓名")
|
||||
user_dept: Optional[str] = Field(None, description="员工部门")
|
||||
request_title: str = Field(..., description="问题标题")
|
||||
problem_type: Optional[str] = Field(None, description="问题类型")
|
||||
problem_category: Optional[str] = Field(None, description="问题分类")
|
||||
confidence: Optional[float] = Field(None, description="AI 置信度")
|
||||
urgency: str = Field("medium", description="紧急度")
|
||||
suggested_route: Optional[str] = Field(None, description="AI 建议路由")
|
||||
status: str = Field("pending", description="分诊状态")
|
||||
route_action: Optional[str] = Field(None, description="路由动作")
|
||||
route_note: Optional[str] = Field(None, description="路由备注")
|
||||
operator_id: Optional[str] = Field(None, description="操作坐席ID")
|
||||
created_at: Optional[datetime] = Field(None, description="创建时间")
|
||||
operated_at: Optional[datetime] = Field(None, description="操作时间")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class TriageDetailResponse(BaseModel):
|
||||
"""分诊详情响应(含完整数据)。
|
||||
|
||||
Attributes:
|
||||
id: 分诊会话ID
|
||||
conversation_id: 会话ID
|
||||
user_id: 员工ID
|
||||
user_name: 员工姓名
|
||||
user_dept: 员工部门
|
||||
user_level: 员工IT技能等级
|
||||
device_info: 设备信息
|
||||
request_title: 问题标题
|
||||
request_content: 问题原文
|
||||
source: 来源渠道
|
||||
problem_type: 问题类型
|
||||
problem_category: 问题分类
|
||||
confidence: AI 置信度
|
||||
urgency: 紧急度
|
||||
suggested_route: AI 建议路由
|
||||
matched_knowledge: 匹配到的知识条目
|
||||
match_score: 知识匹配分数
|
||||
context_tags: 上下文标签列表
|
||||
triage_steps: 分诊步骤数据
|
||||
collected_context: 已收集的上下文列表
|
||||
status: 分诊状态
|
||||
route_action: 路由动作
|
||||
route_note: 路由备注
|
||||
operator_id: 操作坐席ID
|
||||
created_at: 创建时间
|
||||
updated_at: 更新时间
|
||||
operated_at: 操作时间
|
||||
"""
|
||||
|
||||
id: str = Field(..., description="分诊会话ID")
|
||||
conversation_id: str = Field(..., description="会话ID")
|
||||
user_id: str = Field(..., description="员工ID")
|
||||
user_name: Optional[str] = Field(None, description="员工姓名")
|
||||
user_dept: Optional[str] = Field(None, description="员工部门")
|
||||
user_level: Optional[str] = Field(None, description="员工IT技能等级")
|
||||
device_info: Optional[str] = Field(None, description="设备信息")
|
||||
request_title: str = Field(..., description="问题标题")
|
||||
request_content: str = Field(..., description="问题原文")
|
||||
source: str = Field("wecom_h5", description="来源渠道")
|
||||
problem_type: Optional[str] = Field(None, description="问题类型")
|
||||
problem_category: Optional[str] = Field(None, description="问题分类")
|
||||
confidence: Optional[float] = Field(None, description="AI 置信度")
|
||||
urgency: str = Field("medium", description="紧急度")
|
||||
suggested_route: Optional[str] = Field(None, description="AI 建议路由")
|
||||
matched_knowledge: Optional[str] = Field(None, description="匹配到的知识条目")
|
||||
match_score: Optional[float] = Field(None, description="知识匹配分数")
|
||||
context_tags: List[str] = Field(default_factory=list, description="上下文标签列表")
|
||||
triage_steps: List[Dict[str, Any]] = Field(default_factory=list, description="分诊步骤数据")
|
||||
collected_context: List[str] = Field(default_factory=list, description="已收集的上下文列表")
|
||||
status: str = Field("pending", description="分诊状态")
|
||||
route_action: Optional[str] = Field(None, description="路由动作")
|
||||
route_note: Optional[str] = Field(None, description="路由备注")
|
||||
operator_id: Optional[str] = Field(None, description="操作坐席ID")
|
||||
created_at: Optional[datetime] = Field(None, description="创建时间")
|
||||
updated_at: Optional[datetime] = Field(None, description="更新时间")
|
||||
operated_at: Optional[datetime] = Field(None, description="操作时间")
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class TriageStatsResponse(BaseModel):
|
||||
"""分诊看板统计概要响应。
|
||||
|
||||
Attributes:
|
||||
pending_total: 待分诊总数
|
||||
today_triaged: 今日已分诊数
|
||||
ai_self_count: AI 自答数
|
||||
human_count: 转人工数
|
||||
auto_approval_count: 自动审批数
|
||||
avg_duration_sec: 平均耗时(秒)
|
||||
"""
|
||||
|
||||
pending_total: int = Field(0, description="待分诊总数")
|
||||
today_triaged: int = Field(0, description="今日已分诊数")
|
||||
ai_self_count: int = Field(0, description="AI 自答数")
|
||||
human_count: int = Field(0, description="转人工数")
|
||||
auto_approval_count: int = Field(0, description="自动审批数")
|
||||
avg_duration_sec: float = Field(0.0, description="平均耗时(秒)")
|
||||
Reference in New Issue
Block a user