144 lines
3.6 KiB
TypeScript
144 lines
3.6 KiB
TypeScript
|
|
// =============================================================================
|
||
|
|
// 企微IT智能服务台 — 坐席端分诊 API 封装
|
||
|
|
// =============================================================================
|
||
|
|
// 说明:封装坐席端 7 个分诊看板 API 调用
|
||
|
|
// =============================================================================
|
||
|
|
|
||
|
|
import request from './index'
|
||
|
|
|
||
|
|
/** 分诊会话列表项 */
|
||
|
|
export interface TriageSessionItem {
|
||
|
|
id: string
|
||
|
|
conversation_id: string
|
||
|
|
user_id: string
|
||
|
|
user_name: string | null
|
||
|
|
user_dept: string | null
|
||
|
|
request_title: string
|
||
|
|
problem_type: string | null
|
||
|
|
problem_category: string | null
|
||
|
|
confidence: number | null
|
||
|
|
urgency: string
|
||
|
|
suggested_route: string | null
|
||
|
|
status: string
|
||
|
|
route_action: string | null
|
||
|
|
route_note: string | null
|
||
|
|
operator_id: string | null
|
||
|
|
created_at: string | null
|
||
|
|
operated_at: string | null
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 分诊详情 */
|
||
|
|
export interface TriageDetail extends TriageSessionItem {
|
||
|
|
user_level: string | null
|
||
|
|
device_info: string | null
|
||
|
|
request_content: string
|
||
|
|
source: string
|
||
|
|
matched_knowledge: string | null
|
||
|
|
match_score: number | null
|
||
|
|
context_tags: string[]
|
||
|
|
triage_steps: Record<string, any>[]
|
||
|
|
collected_context: string[]
|
||
|
|
updated_at: string | null
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 分诊统计 */
|
||
|
|
export interface TriageStats {
|
||
|
|
pending_total: number
|
||
|
|
today_triaged: number
|
||
|
|
ai_self_count: number
|
||
|
|
human_count: number
|
||
|
|
auto_approval_count: number
|
||
|
|
avg_duration_sec: number
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 列表查询参数 */
|
||
|
|
export interface TriageListQuery {
|
||
|
|
urgency?: string
|
||
|
|
problem_type?: string
|
||
|
|
page?: number
|
||
|
|
page_size?: number
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 历史查询参数 */
|
||
|
|
export interface TriageHistoryQuery {
|
||
|
|
date_from?: string
|
||
|
|
date_to?: string
|
||
|
|
route_action?: string
|
||
|
|
page?: number
|
||
|
|
page_size?: number
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 路由操作请求 */
|
||
|
|
export interface TriageRouteParams {
|
||
|
|
route_action: string
|
||
|
|
route_note?: string
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 排除选项请求 */
|
||
|
|
export interface TriageExcludeOptionsParams {
|
||
|
|
excluded_labels: string[]
|
||
|
|
recommended_label?: string
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取待分诊列表
|
||
|
|
* GET /api/agent/triage/pending
|
||
|
|
*/
|
||
|
|
export function getPendingTriage(params: TriageListQuery): Promise<{ total: number; items: TriageSessionItem[] }> {
|
||
|
|
return request.get('/agent/triage/pending', { params })
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取分诊统计
|
||
|
|
* GET /api/agent/triage/stats
|
||
|
|
*/
|
||
|
|
export function getTriageStats(): Promise<TriageStats> {
|
||
|
|
return request.get('/agent/triage/stats')
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取分诊详情
|
||
|
|
* GET /api/agent/triage/{triage_id}
|
||
|
|
*/
|
||
|
|
export function getTriageDetail(triageId: string): Promise<TriageDetail> {
|
||
|
|
return request.get(`/agent/triage/${triageId}`)
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 路由操作
|
||
|
|
* POST /api/agent/triage/{triage_id}/route
|
||
|
|
*/
|
||
|
|
export function routeTriage(triageId: string, params: TriageRouteParams): Promise<TriageSessionItem> {
|
||
|
|
return request.post(`/agent/triage/${triageId}/route`, params)
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取分诊历史
|
||
|
|
* GET /api/agent/triage/history
|
||
|
|
*/
|
||
|
|
export function getTriageHistory(params: TriageHistoryQuery): Promise<{ total: number; items: TriageSessionItem[] }> {
|
||
|
|
return request.get('/agent/triage/history', { params })
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导出分诊记录
|
||
|
|
* GET /api/agent/triage/export
|
||
|
|
*/
|
||
|
|
export function exportTriage(params: { date_from?: string; date_to?: string }): Promise<Blob> {
|
||
|
|
return request.get('/agent/triage/export', {
|
||
|
|
params,
|
||
|
|
responseType: 'blob',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 排除/推荐分诊选项
|
||
|
|
* POST /api/agent/triage/{triage_id}/exclude-options
|
||
|
|
*/
|
||
|
|
export function excludeTriageOptions(
|
||
|
|
triageId: string,
|
||
|
|
params: TriageExcludeOptionsParams,
|
||
|
|
): Promise<{ excluded: boolean }> {
|
||
|
|
return request.post(`/agent/triage/${triageId}/exclude-options`, params)
|
||
|
|
}
|