2026-04-09 10:01:23 +08:00
|
|
|
import { readSession } from "@/lib/auth"
|
2026-06-01 13:57:49 +08:00
|
|
|
import { request, requestBlob } from "@/lib/api/client"
|
2026-04-14 19:59:49 +08:00
|
|
|
import { createWebSocketBaseUrl } from "@/lib/api/websocket"
|
2026-05-25 12:06:15 +08:00
|
|
|
import { translateCurrentMessage } from "@/i18n/messages"
|
2026-04-09 10:01:23 +08:00
|
|
|
|
|
|
|
|
export type Paging = {
|
|
|
|
|
page: number
|
|
|
|
|
limit: number
|
|
|
|
|
total: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type PageResult<T> = {
|
|
|
|
|
results: T[]
|
|
|
|
|
page: Paging
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CursorResult<T> = {
|
2026-04-24 21:37:50 +08:00
|
|
|
results?: T[] | null
|
2026-04-09 10:01:23 +08:00
|
|
|
cursor: string
|
|
|
|
|
hasMore: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminUser = {
|
|
|
|
|
id: number
|
|
|
|
|
username: string
|
|
|
|
|
nickname: string
|
|
|
|
|
avatar: string
|
|
|
|
|
mobile?: string
|
|
|
|
|
email?: string
|
|
|
|
|
status: number
|
|
|
|
|
isSystem: boolean
|
|
|
|
|
lastLoginAt?: string
|
|
|
|
|
lastLoginIp?: string
|
|
|
|
|
roles?: AdminRole[]
|
|
|
|
|
permissions?: string[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminUserPayload = {
|
|
|
|
|
id: number
|
|
|
|
|
nickname: string
|
|
|
|
|
avatar: string
|
|
|
|
|
mobile: string | null
|
|
|
|
|
email: string | null
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAdminUserPayload = {
|
|
|
|
|
username: string
|
|
|
|
|
nickname: string
|
|
|
|
|
avatar: string
|
|
|
|
|
mobile: string | null
|
|
|
|
|
email: string | null
|
|
|
|
|
remark: string
|
|
|
|
|
roleIds: number[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateUserResult = {
|
|
|
|
|
user: AdminUser
|
|
|
|
|
password: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type ResetPasswordResult = {
|
|
|
|
|
password: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminRole = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
code: string
|
|
|
|
|
status: number
|
|
|
|
|
isSystem: boolean
|
|
|
|
|
sortNo: number
|
|
|
|
|
permissions?: string[]
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-23 14:05:13 +08:00
|
|
|
export type CreateAdminRolePayload = {
|
|
|
|
|
name: string
|
|
|
|
|
code: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type AdminPermission = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
code: string
|
|
|
|
|
type: string
|
|
|
|
|
groupName: string
|
|
|
|
|
method: string
|
|
|
|
|
apiPath: string
|
|
|
|
|
status: number
|
|
|
|
|
sortNo: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type ConversationTag = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
color: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type ConversationParticipant = {
|
|
|
|
|
id: number
|
|
|
|
|
participantType: string
|
|
|
|
|
participantId: number
|
|
|
|
|
externalParticipantId?: string
|
|
|
|
|
joinedAt?: string
|
|
|
|
|
leftAt?: string
|
|
|
|
|
status: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminConversation = {
|
|
|
|
|
id: number
|
2026-04-27 17:59:23 +08:00
|
|
|
channelId: number
|
2026-04-27 19:22:40 +08:00
|
|
|
customerId: number
|
|
|
|
|
customerName: string
|
2026-04-09 10:01:23 +08:00
|
|
|
status: number
|
|
|
|
|
serviceMode: number
|
|
|
|
|
priority: number
|
|
|
|
|
currentAssigneeId: number
|
|
|
|
|
currentAssigneeName?: string
|
|
|
|
|
lastMessageId: number
|
|
|
|
|
lastMessageAt?: string
|
|
|
|
|
lastActiveAt?: string
|
|
|
|
|
lastMessageSummary?: string
|
|
|
|
|
customerUnreadCount: number
|
|
|
|
|
agentUnreadCount: number
|
|
|
|
|
customerLastReadMessageId: number
|
|
|
|
|
customerLastReadSeqNo: number
|
|
|
|
|
customerLastReadAt?: string
|
|
|
|
|
agentLastReadMessageId: number
|
|
|
|
|
agentLastReadSeqNo: number
|
|
|
|
|
agentLastReadAt?: string
|
|
|
|
|
closedAt?: string
|
|
|
|
|
closedBy: number
|
|
|
|
|
closedByName?: string
|
|
|
|
|
closeReason?: string
|
|
|
|
|
participants?: ConversationParticipant[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminConversationDetail = AdminConversation & {
|
|
|
|
|
participants?: ConversationParticipant[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminMessage = {
|
|
|
|
|
id: number
|
|
|
|
|
conversationId: number
|
|
|
|
|
clientMsgId?: string
|
|
|
|
|
senderType: string
|
|
|
|
|
senderId: number
|
|
|
|
|
senderName?: string
|
|
|
|
|
senderAvatar?: string
|
|
|
|
|
messageType: string
|
|
|
|
|
content: string
|
|
|
|
|
payload?: string
|
|
|
|
|
seqNo: number
|
|
|
|
|
sendStatus: number
|
|
|
|
|
sentAt?: string
|
|
|
|
|
deliveredAt?: string
|
|
|
|
|
readAt?: string
|
|
|
|
|
customerRead: boolean
|
|
|
|
|
customerReadAt?: string
|
|
|
|
|
agentRead: boolean
|
|
|
|
|
agentReadAt?: string
|
|
|
|
|
recalledAt?: string
|
|
|
|
|
quotedMessageId?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminQuickReply = {
|
|
|
|
|
id: number
|
|
|
|
|
groupName: string
|
|
|
|
|
title: string
|
|
|
|
|
content: string
|
|
|
|
|
status: number
|
|
|
|
|
sortNo: number
|
|
|
|
|
createdBy: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminChannel = {
|
|
|
|
|
id: number
|
|
|
|
|
channelType: string
|
|
|
|
|
channelId: string
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
aiAgentName?: string
|
|
|
|
|
name: string
|
|
|
|
|
configJson: string
|
|
|
|
|
status: number
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-27 11:43:34 +08:00
|
|
|
export type WxWorkKFAccount = {
|
|
|
|
|
openKfId: string
|
|
|
|
|
name: string
|
|
|
|
|
avatar: string
|
|
|
|
|
managePrivilege: boolean
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type CreateAdminChannelPayload = {
|
|
|
|
|
channelType: string
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
name: string
|
|
|
|
|
configJson: string
|
|
|
|
|
status: number
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminChannelPayload = CreateAdminChannelPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 10:15:15 +08:00
|
|
|
export type ResetChannelUserTokenSecretResult = {
|
|
|
|
|
userTokenSecret: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type AIAgent = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
|
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
aiConfigId: number
|
|
|
|
|
aiConfigName?: string
|
|
|
|
|
serviceMode: number
|
|
|
|
|
serviceModeName: string
|
|
|
|
|
systemPrompt: string
|
|
|
|
|
welcomeMessage: string
|
|
|
|
|
replyTimeoutSeconds: number
|
|
|
|
|
teams: { id: number; name: string }[]
|
|
|
|
|
handoffMode: number
|
|
|
|
|
handoffModeName: string
|
2026-04-18 13:36:44 +08:00
|
|
|
fallbackMode: number
|
|
|
|
|
fallbackModeName: string
|
2026-04-09 10:01:23 +08:00
|
|
|
fallbackMessage: string
|
|
|
|
|
knowledgeIds: number[]
|
|
|
|
|
knowledgeBaseNames: string[]
|
|
|
|
|
skillIds: number[]
|
2026-06-20 20:42:07 +08:00
|
|
|
skills: { id: number; name: string }[]
|
2026-04-09 10:01:23 +08:00
|
|
|
directTools: {
|
2026-04-09 15:36:20 +08:00
|
|
|
toolCode: string
|
2026-04-09 10:01:23 +08:00
|
|
|
serverCode: string
|
|
|
|
|
toolName: string
|
|
|
|
|
title: string
|
|
|
|
|
description: string
|
|
|
|
|
arguments?: Record<string, string>
|
|
|
|
|
}[]
|
2026-04-14 15:10:50 +08:00
|
|
|
graphTools: string[]
|
2026-04-09 10:01:23 +08:00
|
|
|
sortNo: number
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAIAgentPayload = {
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
|
|
|
|
aiConfigId: number
|
|
|
|
|
serviceMode: number
|
|
|
|
|
systemPrompt: string
|
|
|
|
|
welcomeMessage: string
|
|
|
|
|
replyTimeoutSeconds: number
|
|
|
|
|
teamIds: number[]
|
|
|
|
|
handoffMode: number
|
2026-04-18 13:36:44 +08:00
|
|
|
fallbackMode: number
|
2026-04-09 10:01:23 +08:00
|
|
|
fallbackMessage: string
|
|
|
|
|
knowledgeIds: number[]
|
|
|
|
|
skillIds: number[]
|
|
|
|
|
directTools: {
|
2026-04-09 15:36:20 +08:00
|
|
|
toolCode: string
|
2026-04-09 10:01:23 +08:00
|
|
|
serverCode: string
|
|
|
|
|
toolName: string
|
|
|
|
|
title: string
|
|
|
|
|
description: string
|
|
|
|
|
arguments?: Record<string, string>
|
|
|
|
|
}[]
|
2026-04-14 15:10:50 +08:00
|
|
|
graphTools: string[]
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAIAgentPayload = CreateAIAgentPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAdminQuickReplyPayload = {
|
|
|
|
|
groupName: string
|
|
|
|
|
title: string
|
|
|
|
|
content: string
|
|
|
|
|
status: number
|
|
|
|
|
sortNo: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminQuickReplyPayload = CreateAdminQuickReplyPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type SkillDefinition = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
2026-04-12 10:00:47 +08:00
|
|
|
instruction: string
|
2026-04-09 15:36:20 +08:00
|
|
|
examples: string[]
|
2026-04-12 10:16:03 +08:00
|
|
|
toolWhitelist: string[]
|
2026-04-09 10:01:23 +08:00
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
remark: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateSkillDefinitionPayload = {
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
2026-04-12 10:00:47 +08:00
|
|
|
instruction: string
|
2026-04-09 15:36:20 +08:00
|
|
|
examples: string[]
|
2026-04-12 10:16:03 +08:00
|
|
|
toolWhitelist: string[]
|
2026-04-09 10:01:23 +08:00
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateSkillDefinitionPayload = CreateSkillDefinitionPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 16:52:45 +08:00
|
|
|
export type SkillDebugRunPayload = {
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
conversationId?: number
|
2026-06-20 20:42:07 +08:00
|
|
|
skillDefinitionId: number
|
2026-04-10 16:52:45 +08:00
|
|
|
userMessage: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 17:27:44 +08:00
|
|
|
export type SkillDebugResumePayload = {
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
conversationId?: number
|
|
|
|
|
checkPointId: string
|
|
|
|
|
userMessage: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 16:52:45 +08:00
|
|
|
export type SkillDebugRunResult = {
|
2026-06-20 20:42:07 +08:00
|
|
|
skillDefinitionId: number
|
2026-04-10 16:52:45 +08:00
|
|
|
skillName: string
|
|
|
|
|
replyText: string
|
|
|
|
|
planReason: string
|
|
|
|
|
skillRouteTrace: string
|
2026-04-12 10:17:27 +08:00
|
|
|
toolWhitelist: string[]
|
|
|
|
|
exposedToolCodes: string[]
|
2026-04-10 16:52:45 +08:00
|
|
|
invokedToolCodes: string[]
|
|
|
|
|
toolSearchTrace: string
|
|
|
|
|
graphToolTrace: string
|
|
|
|
|
graphToolCode: string
|
|
|
|
|
interruptType: string
|
|
|
|
|
checkPointId: string
|
|
|
|
|
interrupted: boolean
|
|
|
|
|
traceData: string
|
|
|
|
|
errorMessage: string
|
|
|
|
|
conversationId: number
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type MCPConnectionResult = {
|
|
|
|
|
serverCode: string
|
|
|
|
|
endpoint: string
|
|
|
|
|
protocol: string
|
|
|
|
|
serverName: string
|
|
|
|
|
version: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type MCPServerInfo = {
|
|
|
|
|
code: string
|
|
|
|
|
enabled: boolean
|
|
|
|
|
endpoint: string
|
|
|
|
|
timeoutMs: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type MCPToolInfo = {
|
|
|
|
|
name: string
|
|
|
|
|
title: string
|
|
|
|
|
description: string
|
|
|
|
|
inputSchema: unknown
|
|
|
|
|
outputSchema?: unknown
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-14 15:05:38 +08:00
|
|
|
export type MCPToolSourceType = "mcp" | "graph" | "builtin"
|
|
|
|
|
|
2026-04-09 15:36:20 +08:00
|
|
|
export type MCPToolCatalogItem = {
|
|
|
|
|
toolCode: string
|
|
|
|
|
serverCode: string
|
|
|
|
|
toolName: string
|
2026-04-14 15:05:38 +08:00
|
|
|
sourceType: MCPToolSourceType
|
2026-04-10 15:41:02 +08:00
|
|
|
autoInjected: boolean
|
2026-04-09 15:36:20 +08:00
|
|
|
title: string
|
|
|
|
|
description: string
|
|
|
|
|
inputSchema: unknown
|
|
|
|
|
outputSchema?: unknown
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type MCPToolResultContent = {
|
|
|
|
|
type: string
|
|
|
|
|
text?: string
|
|
|
|
|
data?: unknown
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type MCPToolCallResult = {
|
|
|
|
|
serverCode: string
|
|
|
|
|
toolName: string
|
|
|
|
|
isError: boolean
|
|
|
|
|
content: MCPToolResultContent[]
|
|
|
|
|
structuredContent?: unknown
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AgentRunLog = {
|
|
|
|
|
id: number
|
|
|
|
|
conversationId: number
|
|
|
|
|
messageId: number
|
|
|
|
|
aiAgentId: number
|
|
|
|
|
aiConfigId: number
|
|
|
|
|
userMessage: string
|
|
|
|
|
plannedAction: string
|
2026-06-20 20:42:07 +08:00
|
|
|
plannedSkillId: number
|
2026-04-10 14:43:57 +08:00
|
|
|
plannedSkillName: string
|
|
|
|
|
skillRouteTrace: string
|
2026-04-10 15:04:02 +08:00
|
|
|
toolSearchTrace: string
|
2026-04-10 15:47:58 +08:00
|
|
|
graphToolTrace: string
|
2026-04-10 16:23:25 +08:00
|
|
|
graphToolCode: string
|
2026-04-12 14:12:04 +08:00
|
|
|
recommendedAction: string
|
|
|
|
|
riskLevel: string
|
|
|
|
|
ticketDraftReady: boolean
|
2026-04-10 16:23:25 +08:00
|
|
|
handoffReason: string
|
2026-04-09 10:01:23 +08:00
|
|
|
plannedToolCode: string
|
|
|
|
|
planReason: string
|
2026-04-10 14:43:57 +08:00
|
|
|
interruptType: string
|
|
|
|
|
resumeSource: string
|
2026-04-10 16:45:52 +08:00
|
|
|
hitlStatus: string
|
|
|
|
|
hitlStatusName: string
|
|
|
|
|
hitlSummary: string
|
2026-04-09 10:01:23 +08:00
|
|
|
finalAction: string
|
2026-04-10 14:43:57 +08:00
|
|
|
finalStatus: string
|
2026-04-09 10:01:23 +08:00
|
|
|
replyText: string
|
|
|
|
|
errorMessage: string
|
|
|
|
|
latencyMs: number
|
|
|
|
|
traceData: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentProfile = {
|
|
|
|
|
id: number
|
|
|
|
|
userId: number
|
|
|
|
|
teamId: number
|
|
|
|
|
teamName?: string
|
|
|
|
|
username?: string
|
|
|
|
|
nickname?: string
|
|
|
|
|
agentCode: string
|
|
|
|
|
displayName: string
|
|
|
|
|
avatar: string
|
|
|
|
|
serviceStatus: number
|
|
|
|
|
maxConcurrentCount: number
|
|
|
|
|
priorityLevel: number
|
|
|
|
|
autoAssignEnabled: boolean
|
|
|
|
|
receiveOfflineMessage: boolean
|
|
|
|
|
lastOnlineAt?: string
|
|
|
|
|
lastStatusAt?: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAdminAgentProfilePayload = {
|
|
|
|
|
userId: number
|
|
|
|
|
teamId: number
|
|
|
|
|
agentCode: string
|
|
|
|
|
displayName: string
|
|
|
|
|
avatar: string
|
|
|
|
|
serviceStatus: number
|
|
|
|
|
maxConcurrentCount: number
|
|
|
|
|
priorityLevel: number
|
|
|
|
|
autoAssignEnabled: boolean
|
|
|
|
|
receiveOfflineMessage: boolean
|
|
|
|
|
lastOnlineAt?: string
|
|
|
|
|
lastStatusAt?: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminAgentProfilePayload =
|
|
|
|
|
CreateAdminAgentProfilePayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentTeam = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
leaderUserId: number
|
|
|
|
|
leaderUsername?: string
|
|
|
|
|
leaderNickname?: string
|
|
|
|
|
status: number
|
|
|
|
|
description: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAdminAgentTeamPayload = {
|
|
|
|
|
name: string
|
|
|
|
|
leaderUserId: number
|
|
|
|
|
status: number
|
|
|
|
|
description: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminAgentTeamPayload = CreateAdminAgentTeamPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentTeamSchedule = {
|
|
|
|
|
id: number
|
|
|
|
|
teamId: number
|
|
|
|
|
teamName?: string
|
|
|
|
|
startAt: string
|
|
|
|
|
endAt: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAdminAgentTeamSchedulePayload = {
|
|
|
|
|
teamId: number
|
|
|
|
|
startAt: string
|
|
|
|
|
endAt: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAdminAgentTeamSchedulePayload =
|
|
|
|
|
CreateAdminAgentTeamSchedulePayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 19:54:59 +08:00
|
|
|
export type BatchAdminAgentTeamSchedulePayload = {
|
|
|
|
|
teamIds: number[]
|
|
|
|
|
startDate: string
|
|
|
|
|
endDate: string
|
|
|
|
|
weekdays: number[]
|
|
|
|
|
startTime: string
|
|
|
|
|
endTime: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentTeamScheduleBatchPreviewItem = {
|
|
|
|
|
teamId: number
|
|
|
|
|
teamName: string
|
|
|
|
|
date: string
|
|
|
|
|
weekday: number
|
|
|
|
|
startAt: string
|
|
|
|
|
endAt: string
|
|
|
|
|
remark: string
|
|
|
|
|
conflict: boolean
|
|
|
|
|
conflictReason: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentTeamScheduleBatchPreview = {
|
|
|
|
|
total: number
|
|
|
|
|
conflict: boolean
|
|
|
|
|
items: AdminAgentTeamScheduleBatchPreviewItem[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAgentTeamScheduleBatchGenerateResult = {
|
|
|
|
|
created: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
function toQueryString(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
if (!query) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const params = new URLSearchParams()
|
|
|
|
|
Object.entries(query).forEach(([key, value]) => {
|
|
|
|
|
if (value === undefined || value === "") {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
params.set(key, String(value))
|
|
|
|
|
})
|
|
|
|
|
const output = params.toString()
|
|
|
|
|
return output ? `?${output}` : ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAdminWebSocketUrl() {
|
|
|
|
|
const session = readSession()
|
|
|
|
|
if (!session?.accessToken) {
|
2026-05-25 12:06:15 +08:00
|
|
|
throw new Error(translateCurrentMessage("api.authExpired"))
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-14 19:59:49 +08:00
|
|
|
const baseUrl = createWebSocketBaseUrl()
|
2026-04-09 10:01:23 +08:00
|
|
|
const params = new URLSearchParams({
|
|
|
|
|
accessToken: session.accessToken,
|
|
|
|
|
})
|
2026-04-25 10:50:23 +08:00
|
|
|
return `${baseUrl}/api/ws/dashboard?${params.toString()}`
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchChannels(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminChannel>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/channel/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchChannel(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminChannel>(`/api/dashboard/channel/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-27 11:43:34 +08:00
|
|
|
export function fetchWxWorkKFAccounts() {
|
|
|
|
|
return request<WxWorkKFAccount[]>("/api/dashboard/channel/wxwork/kf/accounts")
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function createChannel(payload: CreateAdminChannelPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminChannel>("/api/dashboard/channel/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateChannel(payload: UpdateAdminChannelPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/channel/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateChannelStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/channel/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 10:15:15 +08:00
|
|
|
export function resetChannelUserTokenSecret(id: number) {
|
|
|
|
|
return request<ResetChannelUserTokenSecretResult>(
|
|
|
|
|
"/api/dashboard/channel/reset_user_token_secret",
|
|
|
|
|
{
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function deleteChannel(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/channel/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIAgents(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AIAgent>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/ai-agent/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIAgentsAll(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<AIAgent[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/ai-agent/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIAgent(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AIAgent>(`/api/dashboard/ai-agent/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAIAgent(payload: CreateAIAgentPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AIAgent>("/api/dashboard/ai-agent/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIAgent(payload: UpdateAIAgentPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-agent/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAIAgent(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-agent/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIAgentSort(ids: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-agent/update_sort", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(ids),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIAgentStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-agent/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchUsers(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<PageResult<AdminUser>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/user/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchUsersAll(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<AdminUser[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/user/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createUser(payload: CreateAdminUserPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<CreateUserResult>("/api/dashboard/user/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
username: payload.username,
|
|
|
|
|
nickname: payload.nickname,
|
|
|
|
|
avatar: payload.avatar,
|
|
|
|
|
mobile: payload.mobile,
|
|
|
|
|
email: payload.email,
|
|
|
|
|
remark: payload.remark,
|
|
|
|
|
roleIds: payload.roleIds,
|
|
|
|
|
}),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateUser(payload: UpdateAdminUserPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/user/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchUserDetail(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminUser>(`/api/dashboard/user/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateUserStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/user/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function resetUserPassword(userId: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<ResetPasswordResult>("/api/dashboard/user/reset_password", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ userId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function changeSelfPassword(password: string) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/user/change_password", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ password }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function assignUserRoles(userId: number, roleIds: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/user/assign_role", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ userId, roleIds }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchRoles(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<PageResult<AdminRole>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/role/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchRoleListAll() {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminRole[]>("/api/dashboard/role/list_all")
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchRoleDetail(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminRole>(`/api/dashboard/role/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-23 14:05:13 +08:00
|
|
|
export function createRole(payload: CreateAdminRolePayload) {
|
|
|
|
|
return request<AdminRole>("/api/dashboard/role/create", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function assignRolePermissions(roleId: number, permissionIds: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/role/assign_permission", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ roleId, permissionIds }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateRoleSort(ids: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/role/update_sort", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(ids),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchPermissions(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminPermission>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/permission/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchConversations(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminConversation>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/conversation/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchConversationDetail(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminConversationDetail>(`/api/dashboard/conversation/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchConversationMessages(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<CursorResult<AdminMessage>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/conversation/message_list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function assignConversation(
|
|
|
|
|
conversationId: number,
|
|
|
|
|
assigneeId: number,
|
|
|
|
|
reason: string
|
|
|
|
|
) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/conversation/assign", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ conversationId, assigneeId, reason }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function dispatchConversation(conversationId: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/conversation/dispatch", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ conversationId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function transferConversation(
|
|
|
|
|
conversationId: number,
|
|
|
|
|
toUserId: number,
|
|
|
|
|
reason: string
|
|
|
|
|
) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/conversation/transfer", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ conversationId, toUserId, reason }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function closeConversation(conversationId: number, closeReason: string) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/conversation/close", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ conversationId, closeReason }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function markConversationRead(conversationId: number, messageId = 0) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/conversation/read", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ conversationId, messageId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function sendConversationMessage(payload: {
|
|
|
|
|
conversationId: number
|
|
|
|
|
messageType: string
|
|
|
|
|
content: string
|
|
|
|
|
payload?: string
|
|
|
|
|
clientMsgId?: string
|
|
|
|
|
}) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminMessage>("/api/dashboard/conversation/send_message", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function recallConversationMessage(messageId: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminMessage>("/api/dashboard/conversation/recall_message", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ messageId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchQuickReplies(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminQuickReply>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/quick-reply/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchQuickReplyListAll() {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminQuickReply[]>("/api/dashboard/quick-reply/list_all")
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchQuickReply(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminQuickReply>(`/api/dashboard/quick-reply/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createQuickReply(payload: CreateAdminQuickReplyPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminQuickReply>("/api/dashboard/quick-reply/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateQuickReply(payload: UpdateAdminQuickReplyPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/quick-reply/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteQuickReply(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/quick-reply/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchSkillDefinitions(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<SkillDefinition>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/skill-definition/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchSkillDefinitionsAll(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<SkillDefinition[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/skill-definition/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchSkillDefinition(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<SkillDefinition>(`/api/dashboard/skill-definition/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createSkillDefinition(payload: CreateSkillDefinitionPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<SkillDefinition>("/api/dashboard/skill-definition/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateSkillDefinition(payload: UpdateSkillDefinitionPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/skill-definition/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentRunLogs(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AgentRunLog>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent-run-log/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentRunLog(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AgentRunLog>(`/api/dashboard/agent-run-log/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateSkillDefinitionStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/skill-definition/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteSkillDefinition(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/skill-definition/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-17 15:54:09 +08:00
|
|
|
export function restoreSkillDefinition(id: number) {
|
|
|
|
|
return request<void>("/api/dashboard/skill-definition/restore", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 16:52:45 +08:00
|
|
|
export function debugRunSkillDefinition(payload: SkillDebugRunPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<SkillDebugRunResult>("/api/dashboard/skill-definition/debug_run", {
|
2026-04-10 16:52:45 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-10 17:27:44 +08:00
|
|
|
export function debugResumeSkillDefinition(payload: SkillDebugResumePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<SkillDebugRunResult>("/api/dashboard/skill-definition/debug_resume", {
|
2026-04-10 17:27:44 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function testMCPConnection(serverCode: string) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<MCPConnectionResult>("/api/dashboard/mcp/test_connection", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ serverCode }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function listMCPServers() {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<MCPServerInfo[]>("/api/dashboard/mcp/list_servers")
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function listMCPTools(serverCode: string) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<MCPToolInfo[]>("/api/dashboard/mcp/list_tools", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ serverCode }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 15:36:20 +08:00
|
|
|
export function fetchMCPCatalog() {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<MCPToolCatalogItem[]>("/api/dashboard/mcp/catalog")
|
2026-04-09 15:36:20 +08:00
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function callMCPTool(payload: {
|
|
|
|
|
serverCode: string
|
|
|
|
|
toolName: string
|
|
|
|
|
arguments: Record<string, unknown>
|
|
|
|
|
}) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<MCPToolCallResult>("/api/dashboard/mcp/call_tool", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentProfiles(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminAgentProfile>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentProfile(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentProfile>(`/api/dashboard/agent/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentProfilesAll(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<AdminAgentProfile[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAgentProfile(payload: CreateAdminAgentProfilePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentProfile>("/api/dashboard/agent/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAgentProfile(payload: UpdateAdminAgentProfilePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAgentProfile(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentTeams(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<AdminAgentTeam[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent-team/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentTeamsAll() {
|
|
|
|
|
return request<AdminAgentTeam[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent-team/list_all`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentTeam(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentTeam>(`/api/dashboard/agent-team/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAgentTeam(payload: CreateAdminAgentTeamPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentTeam>("/api/dashboard/agent-team/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAgentTeam(payload: UpdateAdminAgentTeamPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent-team/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAgentTeam(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent-team/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAgentTeamSchedules(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AdminAgentTeamSchedule>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/agent-team-schedule/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 09:23:54 +08:00
|
|
|
export function fetchAgentTeamScheduleCalendar(
|
|
|
|
|
query: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<AdminAgentTeamSchedule[]>(
|
|
|
|
|
`/api/dashboard/agent-team-schedule/calendar${toQueryString(query)}`
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function fetchAgentTeamSchedule(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentTeamSchedule>(`/api/dashboard/agent-team-schedule/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAgentTeamSchedule(payload: CreateAdminAgentTeamSchedulePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAgentTeamSchedule>("/api/dashboard/agent-team-schedule/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAgentTeamSchedule(payload: UpdateAdminAgentTeamSchedulePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent-team-schedule/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAgentTeamSchedule(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/agent-team-schedule/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 19:54:59 +08:00
|
|
|
export function previewAgentTeamScheduleBatch(payload: BatchAdminAgentTeamSchedulePayload) {
|
|
|
|
|
return request<AdminAgentTeamScheduleBatchPreview>(
|
|
|
|
|
"/api/dashboard/agent-team-schedule/batch_preview",
|
|
|
|
|
{
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function generateAgentTeamScheduleBatch(payload: BatchAdminAgentTeamSchedulePayload) {
|
|
|
|
|
return request<AdminAgentTeamScheduleBatchGenerateResult>(
|
|
|
|
|
"/api/dashboard/agent-team-schedule/batch_generate",
|
|
|
|
|
{
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type AIConfig = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
provider: string
|
|
|
|
|
baseUrl: string
|
2026-05-30 22:41:21 +08:00
|
|
|
hasApiKey: boolean
|
2026-04-09 10:01:23 +08:00
|
|
|
modelType: string
|
|
|
|
|
modelName: string
|
|
|
|
|
dimension: number
|
|
|
|
|
maxContextTokens: number
|
|
|
|
|
maxOutputTokens: number
|
|
|
|
|
timeoutMs: number
|
|
|
|
|
maxRetryCount: number
|
|
|
|
|
rpmLimit: number
|
|
|
|
|
tpmLimit: number
|
|
|
|
|
status: number
|
|
|
|
|
sortNo: number
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateAIConfigPayload = {
|
|
|
|
|
name: string
|
|
|
|
|
provider: string
|
|
|
|
|
baseUrl: string
|
|
|
|
|
apiKey: string
|
|
|
|
|
modelType: string
|
|
|
|
|
modelName: string
|
|
|
|
|
dimension: number
|
|
|
|
|
maxContextTokens: number
|
|
|
|
|
maxOutputTokens: number
|
|
|
|
|
timeoutMs: number
|
|
|
|
|
maxRetryCount: number
|
|
|
|
|
rpmLimit: number
|
|
|
|
|
tpmLimit: number
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateAIConfigPayload = CreateAIConfigPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIConfigs(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<AIConfig>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/ai-config/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIConfig(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AIConfig>(`/api/dashboard/ai-config/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchAIConfigsAll(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<AIConfig[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/ai-config/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createAIConfig(payload: CreateAIConfigPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AIConfig>("/api/dashboard/ai-config/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIConfig(payload: UpdateAIConfigPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-config/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAIConfig(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-config/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIConfigStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-config/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAIConfigSort(ids: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/ai-config/update_sort", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(ids),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeBase = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
|
|
|
|
knowledgeType: string
|
|
|
|
|
knowledgeTypeName: string
|
|
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
defaultTopK: number
|
|
|
|
|
defaultScoreThreshold: number
|
|
|
|
|
defaultRerankLimit: number
|
|
|
|
|
chunkProvider: string
|
|
|
|
|
chunkTargetTokens: number
|
|
|
|
|
chunkMaxTokens: number
|
|
|
|
|
chunkOverlapTokens: number
|
|
|
|
|
answerMode: number
|
|
|
|
|
answerModeName: string
|
|
|
|
|
documentCount: number
|
|
|
|
|
faqCount: number
|
|
|
|
|
remark: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateKnowledgeBasePayload = {
|
|
|
|
|
name: string
|
|
|
|
|
description: string
|
|
|
|
|
knowledgeType: string
|
|
|
|
|
defaultTopK: number
|
|
|
|
|
defaultScoreThreshold: number
|
|
|
|
|
defaultRerankLimit: number
|
|
|
|
|
chunkProvider: string
|
|
|
|
|
chunkTargetTokens: number
|
|
|
|
|
chunkMaxTokens: number
|
|
|
|
|
chunkOverlapTokens: number
|
|
|
|
|
answerMode: number
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateKnowledgeBasePayload = CreateKnowledgeBasePayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeDocument = {
|
|
|
|
|
id: number
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
knowledgeBaseName?: string
|
2026-06-02 15:37:50 +08:00
|
|
|
directoryId: number
|
|
|
|
|
directoryName?: string
|
|
|
|
|
directoryPath?: string
|
2026-04-09 10:01:23 +08:00
|
|
|
title: string
|
|
|
|
|
contentType: string
|
|
|
|
|
content: string
|
|
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
indexStatus: string
|
|
|
|
|
indexStatusName: string
|
|
|
|
|
indexedAt?: string | null
|
|
|
|
|
indexError: string
|
|
|
|
|
contentHash: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-30 13:43:22 +08:00
|
|
|
export type KnowledgeDocumentListItem = Omit<KnowledgeDocument, "content">
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export type KnowledgeFAQ = {
|
|
|
|
|
id: number
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
knowledgeBaseName?: string
|
2026-06-02 15:37:50 +08:00
|
|
|
directoryId: number
|
|
|
|
|
directoryName?: string
|
|
|
|
|
directoryPath?: string
|
2026-04-09 10:01:23 +08:00
|
|
|
question: string
|
|
|
|
|
answer: string
|
|
|
|
|
similarQuestions: string[]
|
|
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
indexStatus: string
|
|
|
|
|
indexStatusName: string
|
|
|
|
|
indexedAt?: string | null
|
|
|
|
|
indexError: string
|
|
|
|
|
remark: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeSearchResult = {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
chunkId: number
|
|
|
|
|
documentId: number
|
|
|
|
|
documentTitle: string
|
|
|
|
|
faqId: number
|
|
|
|
|
faqQuestion: string
|
|
|
|
|
chunkNo: number
|
|
|
|
|
title: string
|
|
|
|
|
sectionPath: string
|
|
|
|
|
content: string
|
|
|
|
|
score: number
|
|
|
|
|
rerankScore?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeSearchResponse = {
|
|
|
|
|
question: string
|
|
|
|
|
results: KnowledgeSearchResult[]
|
|
|
|
|
hitCount: number
|
|
|
|
|
latencyMs: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeAnswerResponse = {
|
|
|
|
|
question: string
|
|
|
|
|
rewriteQuestion?: string
|
|
|
|
|
answer: string
|
|
|
|
|
answerStatus: number
|
|
|
|
|
answerStatusName: string
|
|
|
|
|
citations: KnowledgeCitation[]
|
|
|
|
|
hits: KnowledgeSearchResult[]
|
|
|
|
|
hitCount: number
|
|
|
|
|
topScore: number
|
|
|
|
|
latencyMs: number
|
|
|
|
|
retrieveMs: number
|
|
|
|
|
generateMs: number
|
|
|
|
|
promptTokens: number
|
|
|
|
|
completionTokens: number
|
|
|
|
|
modelName: string
|
|
|
|
|
retrieveLogId: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeCitation = {
|
|
|
|
|
documentId: number
|
|
|
|
|
documentTitle: string
|
|
|
|
|
faqId: number
|
|
|
|
|
faqQuestion: string
|
|
|
|
|
chunkNo: number
|
|
|
|
|
title: string
|
|
|
|
|
sectionPath: string
|
|
|
|
|
snippet: string
|
|
|
|
|
score: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeRetrieveLog = {
|
|
|
|
|
id: number
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
knowledgeBaseName?: string
|
|
|
|
|
channel: string
|
|
|
|
|
channelName: string
|
|
|
|
|
scene: string
|
|
|
|
|
sceneName: string
|
|
|
|
|
sessionId: string
|
|
|
|
|
conversationId: number
|
|
|
|
|
requestId: string
|
|
|
|
|
question: string
|
|
|
|
|
rewriteQuestion: string
|
|
|
|
|
answer: string
|
|
|
|
|
answerStatus: number
|
|
|
|
|
answerStatusName: string
|
|
|
|
|
hitCount: number
|
|
|
|
|
topScore: number
|
|
|
|
|
chunkProvider: string
|
|
|
|
|
chunkTargetTokens: number
|
|
|
|
|
chunkMaxTokens: number
|
|
|
|
|
chunkOverlapTokens: number
|
|
|
|
|
rerankEnabled: boolean
|
|
|
|
|
rerankLimit: number
|
|
|
|
|
citationCount: number
|
|
|
|
|
usedChunkCount: number
|
|
|
|
|
latencyMs: number
|
|
|
|
|
retrieveMs: number
|
|
|
|
|
generateMs: number
|
|
|
|
|
promptTokens: number
|
|
|
|
|
completionTokens: number
|
|
|
|
|
modelName: string
|
|
|
|
|
traceData: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeRetrieveHit = {
|
|
|
|
|
id: number
|
|
|
|
|
retrieveLogId: number
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
chunkId: number
|
|
|
|
|
documentId: number
|
|
|
|
|
documentTitle: string
|
|
|
|
|
faqId: number
|
|
|
|
|
faqQuestion: string
|
|
|
|
|
chunkNo: number
|
|
|
|
|
title: string
|
|
|
|
|
sectionPath: string
|
|
|
|
|
chunkType: string
|
|
|
|
|
chunkTypeName: string
|
|
|
|
|
provider: string
|
|
|
|
|
rankNo: number
|
|
|
|
|
score: number
|
|
|
|
|
rerankScore: number
|
|
|
|
|
usedInAnswer: boolean
|
|
|
|
|
isCitation: boolean
|
|
|
|
|
snippet: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeRetrieveLogDetail = {
|
|
|
|
|
log: KnowledgeRetrieveLog
|
|
|
|
|
hits: KnowledgeRetrieveHit[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeRetrieveLogListQuery = {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
question?: string
|
|
|
|
|
channel?: string
|
|
|
|
|
scene?: string
|
|
|
|
|
answerStatus?: number
|
|
|
|
|
chunkProvider?: string
|
|
|
|
|
rerankEnabled?: number
|
|
|
|
|
page?: number
|
|
|
|
|
limit?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeSearchPayload = {
|
|
|
|
|
knowledgeBaseIds: number[]
|
|
|
|
|
question: string
|
|
|
|
|
topK?: number
|
|
|
|
|
scoreThreshold?: number
|
|
|
|
|
rerankLimit?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeAnswerPayload = KnowledgeSearchPayload & {
|
|
|
|
|
answerMode?: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateKnowledgeDocumentPayload = {
|
|
|
|
|
knowledgeBaseId: number
|
2026-06-02 15:37:50 +08:00
|
|
|
directoryId: number
|
2026-04-09 10:01:23 +08:00
|
|
|
title: string
|
|
|
|
|
contentType: string
|
|
|
|
|
content: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateKnowledgeDocumentPayload = CreateKnowledgeDocumentPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateKnowledgeFAQPayload = {
|
|
|
|
|
knowledgeBaseId: number
|
2026-06-02 15:37:50 +08:00
|
|
|
directoryId: number
|
2026-04-09 10:01:23 +08:00
|
|
|
question: string
|
|
|
|
|
answer: string
|
|
|
|
|
similarQuestions: string[]
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateKnowledgeFAQPayload = CreateKnowledgeFAQPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 16:13:08 +08:00
|
|
|
export type BatchMoveKnowledgeContentPayload = {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
directoryId: number
|
|
|
|
|
ids: number[]
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 15:37:50 +08:00
|
|
|
export type KnowledgeDirectory = {
|
|
|
|
|
id: number
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
parentId: number
|
|
|
|
|
name: string
|
|
|
|
|
sortNo: number
|
|
|
|
|
status: number
|
|
|
|
|
statusName: string
|
|
|
|
|
remark: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserName: string
|
|
|
|
|
children: KnowledgeDirectory[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateKnowledgeDirectoryPayload = {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
parentId: number
|
|
|
|
|
name: string
|
|
|
|
|
remark: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateKnowledgeDirectoryPayload = CreateKnowledgeDirectoryPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-01 13:57:49 +08:00
|
|
|
export type KnowledgeFAQImportMode = "append" | "overwrite"
|
|
|
|
|
|
|
|
|
|
export type KnowledgeFAQImportError = {
|
|
|
|
|
row: number
|
|
|
|
|
message: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type KnowledgeFAQImportResult = {
|
|
|
|
|
total: number
|
|
|
|
|
created: number
|
|
|
|
|
updated: number
|
|
|
|
|
skipped: number
|
|
|
|
|
failed: number
|
|
|
|
|
errors: KnowledgeFAQImportError[]
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function fetchKnowledgeBases(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<KnowledgeBase>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/knowledge-base/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeBasesAll(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<KnowledgeBase[]>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/knowledge-base/list_all${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeBase(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeBase>(`/api/dashboard/knowledge-base/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createKnowledgeBase(payload: CreateKnowledgeBasePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeBase>("/api/dashboard/knowledge-base/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateKnowledgeBase(payload: UpdateKnowledgeBasePayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-base/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteKnowledgeBase(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-base/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateKnowledgeBaseSort(ids: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-base/update_sort", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(ids),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rebuildKnowledgeBaseIndex(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-base/rebuild_index", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 15:37:50 +08:00
|
|
|
export function fetchKnowledgeDirectories(knowledgeBaseId: number) {
|
|
|
|
|
return request<KnowledgeDirectory[]>(
|
|
|
|
|
`/api/dashboard/knowledge-directory/list_all${toQueryString({ knowledgeBaseId })}`
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createKnowledgeDirectory(payload: CreateKnowledgeDirectoryPayload) {
|
|
|
|
|
return request<KnowledgeDirectory>("/api/dashboard/knowledge-directory/create", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateKnowledgeDirectory(payload: UpdateKnowledgeDirectoryPayload) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-directory/update", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteKnowledgeDirectory(id: number) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-directory/delete", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-07 22:25:02 +08:00
|
|
|
export function updateKnowledgeDirectorySort(payload: {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
parentId: number
|
|
|
|
|
ids: number[]
|
|
|
|
|
}) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-directory/update_sort", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function fetchKnowledgeDocuments(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
2026-04-30 13:43:22 +08:00
|
|
|
return request<PageResult<KnowledgeDocumentListItem>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/knowledge-document/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeDocument(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeDocument>(`/api/dashboard/knowledge-document/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createKnowledgeDocument(payload: CreateKnowledgeDocumentPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeDocument>("/api/dashboard/knowledge-document/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateKnowledgeDocument(payload: UpdateKnowledgeDocumentPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-document/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteKnowledgeDocument(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-document/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 16:13:08 +08:00
|
|
|
export function batchMoveKnowledgeDocuments(payload: BatchMoveKnowledgeContentPayload) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-document/batch_move", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function batchDeleteKnowledgeDocuments(ids: number[]) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-document/batch_delete", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ ids }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function buildKnowledgeDocumentIndex(documentId: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-retrieve/build", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ documentId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeFAQs(
|
|
|
|
|
query?: Record<string, string | number | undefined>
|
|
|
|
|
) {
|
|
|
|
|
return request<PageResult<KnowledgeFAQ>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/knowledge-faq/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeFAQ(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeFAQ>(`/api/dashboard/knowledge-faq/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createKnowledgeFAQ(payload: CreateKnowledgeFAQPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeFAQ>("/api/dashboard/knowledge-faq/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateKnowledgeFAQ(payload: UpdateKnowledgeFAQPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-faq/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteKnowledgeFAQ(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-faq/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-02 16:13:08 +08:00
|
|
|
export function batchMoveKnowledgeFAQs(payload: BatchMoveKnowledgeContentPayload) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-faq/batch_move", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function batchDeleteKnowledgeFAQs(ids: number[]) {
|
|
|
|
|
return request<void>("/api/dashboard/knowledge-faq/batch_delete", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ ids }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-01 13:57:49 +08:00
|
|
|
function downloadBlob(blob: Blob, filename: string) {
|
|
|
|
|
const url = URL.createObjectURL(blob)
|
|
|
|
|
const link = document.createElement("a")
|
|
|
|
|
link.href = url
|
|
|
|
|
link.download = filename
|
|
|
|
|
link.click()
|
|
|
|
|
URL.revokeObjectURL(url)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function downloadKnowledgeFAQImportTemplate() {
|
|
|
|
|
const result = await requestBlob("/api/dashboard/knowledge-faq/import_template")
|
|
|
|
|
downloadBlob(result.blob, result.filename || "knowledge-faq-import-template.xlsx")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function exportKnowledgeFAQs(knowledgeBaseId: number) {
|
|
|
|
|
const result = await requestBlob(
|
|
|
|
|
`/api/dashboard/knowledge-faq/export${toQueryString({ knowledgeBaseId })}`
|
|
|
|
|
)
|
|
|
|
|
downloadBlob(result.blob, result.filename || `knowledge-faq-${knowledgeBaseId}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function importKnowledgeFAQs(payload: {
|
|
|
|
|
knowledgeBaseId: number
|
|
|
|
|
mode: KnowledgeFAQImportMode
|
|
|
|
|
file: File
|
|
|
|
|
}) {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.set("knowledgeBaseId", String(payload.knowledgeBaseId))
|
|
|
|
|
formData.set("mode", payload.mode)
|
|
|
|
|
formData.set("file", payload.file)
|
|
|
|
|
return request<KnowledgeFAQImportResult>("/api/dashboard/knowledge-faq/import", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
body: formData,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 10:01:23 +08:00
|
|
|
export function buildKnowledgeFAQIndex(faqId: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/knowledge-retrieve/build", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ faqId }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function debugKnowledgeSearch(payload: KnowledgeSearchPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeSearchResponse>("/api/dashboard/knowledge-retrieve/debug/search", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function debugKnowledgeAnswer(payload: KnowledgeAnswerPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeAnswerResponse>("/api/dashboard/knowledge-retrieve/debug/answer", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeRetrieveLogs(query: KnowledgeRetrieveLogListQuery) {
|
|
|
|
|
return request<PageResult<KnowledgeRetrieveLog>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/knowledge-retrieve-log/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchKnowledgeRetrieveLog(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<KnowledgeRetrieveLogDetail>(`/api/dashboard/knowledge-retrieve-log/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AdminAsset = {
|
|
|
|
|
id: number
|
|
|
|
|
assetId: string
|
|
|
|
|
provider: string
|
|
|
|
|
filename: string
|
|
|
|
|
fileSize: number
|
|
|
|
|
mimeType: string
|
|
|
|
|
status: number
|
|
|
|
|
url: string
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
createUserId: number
|
|
|
|
|
createUserName: string
|
|
|
|
|
updateUserId: number
|
|
|
|
|
updateUserName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function uploadAsset(file: File, prefix?: string) {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.set("file", file)
|
|
|
|
|
if (prefix) {
|
|
|
|
|
formData.set("prefix", prefix)
|
|
|
|
|
}
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<AdminAsset>("/api/dashboard/asset/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: formData,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type Tag = {
|
|
|
|
|
id: number
|
|
|
|
|
parentId: number
|
|
|
|
|
name: string
|
|
|
|
|
remark: string
|
|
|
|
|
sortNo: number
|
|
|
|
|
status: number
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type TagTree = {
|
|
|
|
|
id: number
|
|
|
|
|
parentId: number
|
|
|
|
|
name: string
|
|
|
|
|
remark: string
|
|
|
|
|
sortNo: number
|
|
|
|
|
status: number
|
|
|
|
|
createdAt: string
|
|
|
|
|
updatedAt: string
|
|
|
|
|
children: TagTree[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type CreateTagPayload = {
|
|
|
|
|
parentId: number
|
|
|
|
|
name: string
|
|
|
|
|
remark: string
|
|
|
|
|
status: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type UpdateTagPayload = CreateTagPayload & {
|
|
|
|
|
id: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchTags(query?: Record<string, string | number | undefined>) {
|
|
|
|
|
return request<PageResult<Tag>>(
|
2026-04-15 17:12:30 +08:00
|
|
|
`/api/dashboard/tag/list${toQueryString(query)}`
|
2026-04-09 10:01:23 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchTagsAll() {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<TagTree[]>("/api/dashboard/tag/list_all")
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function fetchTag(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<Tag>(`/api/dashboard/tag/${id}`)
|
2026-04-09 10:01:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createTag(payload: CreateTagPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<Tag>("/api/dashboard/tag/create", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateTag(payload: UpdateTagPayload) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/tag/update", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteTag(id: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/tag/delete", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateTagSort(ids: number[]) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/tag/update_sort", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify(ids),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateTagStatus(id: number, status: number) {
|
2026-04-15 17:12:30 +08:00
|
|
|
return request<void>("/api/dashboard/tag/update_status", {
|
2026-04-09 10:01:23 +08:00
|
|
|
method: "POST",
|
|
|
|
|
body: JSON.stringify({ id, status }),
|
|
|
|
|
})
|
|
|
|
|
}
|