P1-2: 统一Dify调用点 - 删除detect-intent死链路(approval/byod) + routing_service共享client修复连接泄漏 + 前端死代码清理

This commit is contained in:
Simon
2026-07-18 01:05:20 +08:00
parent af392f2bf0
commit aeb4e0cf39
5 changed files with 54 additions and 424 deletions
+7 -48
View File
@@ -439,33 +439,12 @@ export async function getAllCategoriesCard(): Promise<ApprovalCardData> {
}
// =============================================================================
// 审批意图检测 API(Dify 意图置信度 — 替代纯关键词匹配)
// 审批意图检测 API —— v4.0 P1-2 已删除
// =============================================================================
/** 审批意图检测响应 */
export interface ApprovalDetectIntentResponse {
/** 是否为审批请求 */
is_approval_request: boolean
/** 置信度(0.0~1.0 */
confidence: number
/** 审批类型(设备申请/账号权限申请/软件服务申请/资产处置申请/办公用品申请) */
approval_type: string | null
/** 结果来源:dify(Dify识别) / keyword_prefilter(关键词预过滤未命中) / fallback(降级兜底) */
source: 'dify' | 'keyword_prefilter' | 'fallback'
}
/**
* 检测审批意图
* 员工发送消息后异步调用,后端先用关键词预过滤,命中后调 Dify 做意图识别。
* 返回 is_approval_request === true 时,前端在消息列表中插入审批卡片消息。
*
* @param text 用户消息文本
* @returns 审批意图检测结果
*/
export async function detectApprovalIntent(text: string): Promise<ApprovalDetectIntentResponse> {
const response: any = await apiClient.post('/approval/detect-intent', { text })
return response
}
// detectApprovalIntent / detectByodIntent 已删除:
// - 前端自 v2.0 起不再独立调用 detect-intentstore 注释确认零调用)
// - 后端 /approval/detect-intent 与 /byod/detect-intent 端点已同步删除
// - 审批意图识别统一由主 Dify 对话链路(action 字段 + ApprovalMatcher)处理
/**
* 获取软件下载列表
@@ -482,9 +461,9 @@ export async function getSoftwareDownloads(): Promise<SoftwareDownload[]> {
// =============================================================================
// 自备电脑补贴(BYOD)资格查询 API
// =============================================================================
// 说明:提供自备电脑补贴的意图检测和资格检查功能
// - detectByodIntent: 检测用户消息是否为 BYOD 意图(关键词预过滤 → Dify → 兜底)
// 说明:提供自备电脑补贴的资格检查功能
// - checkByodEligibility: 检查员工是否有资格申请自备电脑补贴
// - BYOD 意图检测已并入主 Dify 对话链路(v4.0 P1-2 删除 detectByodIntent
// =============================================================================
/** BYOD 资格查询响应 */
@@ -509,26 +488,6 @@ export interface ByodEligibilityResponse {
source: 'dify' | 'keyword_prefilter' | 'fallback' | 'wecom'
}
/**
* 检测自备电脑补贴意图
* 员工发送消息后调用,后端先用 BYOD 关键词预过滤,命中后调 Dify 做意图识别。
* 返回 is_byod_intent === true 时,前端应继续调用 checkByodEligibility 查询资格。
*
* @param text 用户消息文本
* @param employeeId 员工ID(可选,传给 Dify 作为用户标识)
* @returns BYOD 意图检测结果
*/
export async function detectByodIntent(
text: string,
employeeId?: string
): Promise<ByodEligibilityResponse> {
const response: any = await apiClient.post('/byod/detect-intent', {
text,
employee_id: employeeId,
})
return response
}
/**
* 检查自备电脑补贴资格
* 后端通过企微通讯录 API 获取员工岗位,与资格清单匹配后返回结果。