|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
// 企微IT智能服务台 — 管理后台 API 调用函数
|
|
|
|
|
// =============================================================================
|
|
|
|
|
// 说明:封装所有管理后台 API 端点调用,统一返回类型
|
|
|
|
|
// 所有函数返回 axios response,调用方从 response.data.data 获取业务数据
|
|
|
|
|
// 所有函数返回 axios response,调用方从 response 获取业务数据
|
|
|
|
|
|
|
|
|
|
import apiClient from './index'
|
|
|
|
|
import type {
|
|
|
|
@@ -114,6 +114,14 @@ export function deleteAgent(
|
|
|
|
|
return apiClient.delete(`/admin/agents/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 重置坐席密码 */
|
|
|
|
|
export function resetAgentPassword(
|
|
|
|
|
id: string,
|
|
|
|
|
newPassword: string
|
|
|
|
|
): Promise<{ data: { code: number; data: { message: string }; message: string } }> {
|
|
|
|
|
return apiClient.post(`/admin/agents/${id}/reset-password`, { new_password: newPassword })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
// 外部系统集成配置
|
|
|
|
|
// ==========================================================================
|
|
|
|
@@ -250,6 +258,71 @@ export function reviewQuickReply(
|
|
|
|
|
return apiClient.put(`/admin/quick-replies/${id}/review`, body)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 创建快速回复模板 */
|
|
|
|
|
export function createQuickReplyTemplate(
|
|
|
|
|
data: QuickReplyTemplate
|
|
|
|
|
): Promise<{ data: { code: number; data: QuickReplyTemplate; message: string } }> {
|
|
|
|
|
return apiClient.post('/quick-replies', data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 更新快速回复模板 */
|
|
|
|
|
export function updateQuickReplyTemplate(
|
|
|
|
|
id: string,
|
|
|
|
|
data: Partial<QuickReplyTemplate>
|
|
|
|
|
): Promise<{ data: { code: number; data: QuickReplyTemplate; message: string } }> {
|
|
|
|
|
return apiClient.put(`/quick-replies/${id}`, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
// 知识库管理
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
|
|
/** 知识库条目类型 */
|
|
|
|
|
export interface KnowledgeBaseItem {
|
|
|
|
|
id: string
|
|
|
|
|
category: string
|
|
|
|
|
title: string
|
|
|
|
|
content: string
|
|
|
|
|
tags: string[]
|
|
|
|
|
view_count: number
|
|
|
|
|
use_count: number
|
|
|
|
|
created_at: string
|
|
|
|
|
updated_at: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取知识库列表 */
|
|
|
|
|
export function getKnowledgeBase(
|
|
|
|
|
category?: string,
|
|
|
|
|
keyword?: string
|
|
|
|
|
): Promise<{ data: { code: number; data: { items: KnowledgeBaseItem[] }; message: string } }> {
|
|
|
|
|
const params: Record<string, string> = {}
|
|
|
|
|
if (category) params.category = category
|
|
|
|
|
if (keyword) params.keyword = keyword
|
|
|
|
|
return apiClient.get('/knowledge', { params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 创建知识库条目 */
|
|
|
|
|
export function createKnowledgeBase(
|
|
|
|
|
data: Omit<KnowledgeBaseItem, 'id' | 'view_count' | 'use_count' | 'created_at' | 'updated_at'>
|
|
|
|
|
): Promise<{ data: { code: number; data: KnowledgeBaseItem; message: string } }> {
|
|
|
|
|
return apiClient.post('/knowledge', data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 更新知识库条目 */
|
|
|
|
|
export function updateKnowledgeBase(
|
|
|
|
|
id: string,
|
|
|
|
|
data: Partial<KnowledgeBaseItem>
|
|
|
|
|
): Promise<{ data: { code: number; data: KnowledgeBaseItem; message: string } }> {
|
|
|
|
|
return apiClient.put(`/knowledge/${id}`, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 删除知识库条目 */
|
|
|
|
|
export function deleteKnowledgeBase(
|
|
|
|
|
id: string
|
|
|
|
|
): Promise<{ data: { code: number; data: null; message: string } }> {
|
|
|
|
|
return apiClient.delete(`/knowledge/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
// 消息分配模式
|
|
|
|
|
// ==========================================================================
|
|
|
|
@@ -383,3 +456,176 @@ export function getSystemLogs(params?: {
|
|
|
|
|
}): Promise<{ data: { code: number; data: { items: any[]; total: number; page: number; page_size: number }; message: string } }> {
|
|
|
|
|
return apiClient.get('/admin/system-logs', { params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
// P2: 满意度评价统计
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
|
|
/** 满意度评价统计数据项 */
|
|
|
|
|
export interface EvaluationStatsItem {
|
|
|
|
|
label: string
|
|
|
|
|
count: number
|
|
|
|
|
percentage: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 满意度评价记录 */
|
|
|
|
|
export interface EvaluationRecord {
|
|
|
|
|
id: string
|
|
|
|
|
conversation_id: string
|
|
|
|
|
employee_id: string
|
|
|
|
|
employee_name: string
|
|
|
|
|
star_rating: number
|
|
|
|
|
emoji: string
|
|
|
|
|
feedback_text: string | null
|
|
|
|
|
created_at: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 满意度评价统计响应 */
|
|
|
|
|
export interface EvaluationStatsResponse {
|
|
|
|
|
total_count: number
|
|
|
|
|
avg_star_rating: number
|
|
|
|
|
star_distribution: EvaluationStatsItem[]
|
|
|
|
|
emoji_distribution: EvaluationStatsItem[]
|
|
|
|
|
recent_evaluations: EvaluationRecord[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取满意度评价统计数据 */
|
|
|
|
|
export function getEvaluationStats(params?: {
|
|
|
|
|
page?: number
|
|
|
|
|
page_size?: number
|
|
|
|
|
}): Promise<{ data: { code: number; data: EvaluationStatsResponse; message: string } }> {
|
|
|
|
|
return apiClient.get('/evaluations/stats', { params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
// 知识库自动迭代 (P2-13)
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
|
|
/** 知识库优化建议项 */
|
|
|
|
|
export interface KnowledgeSuggestionItem {
|
|
|
|
|
id: string
|
|
|
|
|
suggestion_type: 'new_faq' | 'update' | 'outdated'
|
|
|
|
|
status: 'pending' | 'approved' | 'rejected' | 'applied'
|
|
|
|
|
title: string
|
|
|
|
|
content: string
|
|
|
|
|
category: string
|
|
|
|
|
tags: string[]
|
|
|
|
|
source_type: 'annotation' | 'conversation' | 'ai_uncertain'
|
|
|
|
|
source_data: string[] | null
|
|
|
|
|
reason: string | null
|
|
|
|
|
reject_reason: string | null
|
|
|
|
|
reviewer_id: string | null
|
|
|
|
|
reviewed_at: string | null
|
|
|
|
|
created_at: string
|
|
|
|
|
updated_at: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 知识库优化建议统计 */
|
|
|
|
|
export interface KnowledgeSuggestionStats {
|
|
|
|
|
total: number
|
|
|
|
|
pending: number
|
|
|
|
|
approved: number
|
|
|
|
|
rejected: number
|
|
|
|
|
applied: number
|
|
|
|
|
new_faq_count: number
|
|
|
|
|
update_count: number
|
|
|
|
|
outdated_count: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取知识库优化建议列表 */
|
|
|
|
|
export function getKnowledgeSuggestions(params?: {
|
|
|
|
|
status?: string
|
|
|
|
|
suggestion_type?: string
|
|
|
|
|
page?: number
|
|
|
|
|
page_size?: number
|
|
|
|
|
}): Promise<{ data: { code: number; data: { total: number; items: KnowledgeSuggestionItem[] }; message: string } }> {
|
|
|
|
|
return apiClient.get('/admin/knowledge-iteration/suggestions', { params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取知识库优化建议详情 */
|
|
|
|
|
export function getKnowledgeSuggestion(
|
|
|
|
|
id: string
|
|
|
|
|
): Promise<{ data: { code: number; data: KnowledgeSuggestionItem; message: string } }> {
|
|
|
|
|
return apiClient.get(`/admin/knowledge-iteration/suggestions/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 触发知识库迭代分析 */
|
|
|
|
|
export function triggerKnowledgeIterationAnalysis(params: {
|
|
|
|
|
days?: number
|
|
|
|
|
}): Promise<{ data: { code: number; data: any; message: string } }> {
|
|
|
|
|
return apiClient.post('/admin/knowledge-iteration/analyze', null, { params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获取知识库建议统计 */
|
|
|
|
|
export function getKnowledgeSuggestionStats(): Promise<{ data: { code: number; data: KnowledgeSuggestionStats; message: string } }> {
|
|
|
|
|
return apiClient.get('/admin/knowledge-iteration/stats')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 审核通过知识库建议 */
|
|
|
|
|
export function approveKnowledgeSuggestion(
|
|
|
|
|
id: string
|
|
|
|
|
): Promise<{ data: { code: number; data: KnowledgeSuggestionItem; message: string } }> {
|
|
|
|
|
return apiClient.post(`/admin/knowledge-iteration/suggestions/${id}/approve`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 拒绝知识库建议 */
|
|
|
|
|
export function rejectKnowledgeSuggestion(
|
|
|
|
|
id: string,
|
|
|
|
|
body: { reject_reason: string }
|
|
|
|
|
): Promise<{ data: { code: number; data: KnowledgeSuggestionItem; message: string } }> {
|
|
|
|
|
return apiClient.post(`/admin/knowledge-iteration/suggestions/${id}/reject`, body)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 管理员 API 对象 (供 KnowledgeSuggestions 等页面使用) */
|
|
|
|
|
export const adminApi = {
|
|
|
|
|
getKnowledgeSuggestions,
|
|
|
|
|
getKnowledgeSuggestionStats,
|
|
|
|
|
triggerKnowledgeIterationAnalysis,
|
|
|
|
|
approveKnowledgeSuggestion,
|
|
|
|
|
rejectKnowledgeSuggestion,
|
|
|
|
|
getDashboardOverview,
|
|
|
|
|
getConfigGroups,
|
|
|
|
|
updateConfig,
|
|
|
|
|
getConfigHistory,
|
|
|
|
|
getAgents,
|
|
|
|
|
createAgent,
|
|
|
|
|
updateAgent,
|
|
|
|
|
unbindOtp,
|
|
|
|
|
deleteAgent,
|
|
|
|
|
getIntegrations,
|
|
|
|
|
updateIntegration,
|
|
|
|
|
testHuorongConnection,
|
|
|
|
|
getHuorongTerminals,
|
|
|
|
|
getHuorongTerminalDetail,
|
|
|
|
|
getHuorongLeaks,
|
|
|
|
|
getHuorongVirusEvents,
|
|
|
|
|
testLianruanConnection,
|
|
|
|
|
queryLianruanTerminals,
|
|
|
|
|
getLianruanTerminalDetail,
|
|
|
|
|
testRagflowConnection,
|
|
|
|
|
getRagflowDatasets,
|
|
|
|
|
ragflowRetrieval,
|
|
|
|
|
getPendingQuickReplies,
|
|
|
|
|
reviewQuickReply,
|
|
|
|
|
createQuickReplyTemplate,
|
|
|
|
|
updateQuickReplyTemplate,
|
|
|
|
|
getKnowledgeBase,
|
|
|
|
|
createKnowledgeBase,
|
|
|
|
|
updateKnowledgeBase,
|
|
|
|
|
deleteKnowledgeBase,
|
|
|
|
|
getAssignmentMode,
|
|
|
|
|
updateAssignmentMode,
|
|
|
|
|
getMonitorSessions,
|
|
|
|
|
globalSearch,
|
|
|
|
|
getRoles,
|
|
|
|
|
assignRole,
|
|
|
|
|
revokeRole,
|
|
|
|
|
getRoleMappingRules,
|
|
|
|
|
createRoleMappingRule,
|
|
|
|
|
deleteRoleMappingRule,
|
|
|
|
|
getAuditConversations,
|
|
|
|
|
getAuditConversationDetail,
|
|
|
|
|
getAgentPerformance,
|
|
|
|
|
getSystemLogs,
|
|
|
|
|
getEvaluationStats,
|
|
|
|
|
}
|
|
|
|
|