mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 00:53:54 +08:00
update:调整文件夹
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
import type {
|
||||
Agent,
|
||||
AgentCreateData,
|
||||
AgentDetail,
|
||||
ModelOption,
|
||||
RoleTemplate,
|
||||
} from './types'
|
||||
import { http } from '@/http/request/alova'
|
||||
|
||||
// 获取智能体详情
|
||||
export function getAgentDetail(id: string) {
|
||||
return http.Get<AgentDetail>(`/agent/${id}`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取角色模板列表
|
||||
export function getRoleTemplates() {
|
||||
return http.Get<RoleTemplate[]>('/agent/template', {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取模型选项
|
||||
export function getModelOptions(modelType: string, modelName: string = '') {
|
||||
return http.Get<ModelOption[]>('/models/names', {
|
||||
params: {
|
||||
modelType,
|
||||
modelName,
|
||||
},
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取智能体列表
|
||||
export function getAgentList() {
|
||||
return http.Get<Agent[]>('/agent/list', {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 创建智能体
|
||||
export function createAgent(data: AgentCreateData) {
|
||||
return http.Post<string>('/agent', data, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 删除智能体
|
||||
export function deleteAgent(id: string) {
|
||||
return http.Delete(`/agent/${id}`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取TTS音色列表
|
||||
export function getTTSVoices(ttsModelId: string, voiceName: string = '') {
|
||||
return http.Get<{ id: string, name: string }[]>(`/models/${ttsModelId}/voices`, {
|
||||
params: {
|
||||
voiceName,
|
||||
},
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 更新智能体
|
||||
export function updateAgent(id: string, data: Partial<AgentDetail>) {
|
||||
return http.Put(`/agent/${id}`, data, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: true,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取插件列表
|
||||
export function getPluginFunctions() {
|
||||
return http.Get<any[]>(`/models/provider/plugin/names`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取mcp接入点
|
||||
export function getMcpAddress(agentId: string) {
|
||||
return http.Get<string>(`/agent/mcp/address/${agentId}`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取mcp工具
|
||||
export function getMcpTools(agentId: string) {
|
||||
return http.Get<string[]>(`/agent/mcp/tools/${agentId}`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取声纹列表
|
||||
export function getVoicePrintList(agentId: string) {
|
||||
return http.Get<any[]>(`/agent/voice-print/list/${agentId}`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 获取语音对话记录
|
||||
export function getChatHistoryUser(agentId: string) {
|
||||
return http.Get<any[]>(`/agent/${agentId}/chat-history/user`, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: false,
|
||||
},
|
||||
cacheFor: {
|
||||
expire: 0,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 新增声纹说话人
|
||||
export function createVoicePrint(data: { agentId: string, audioId: string, sourceName: string, introduce: string }) {
|
||||
return http.Post('/agent/voice-print', data, {
|
||||
meta: {
|
||||
ignoreAuth: false,
|
||||
toast: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// 智能体列表数据类型
|
||||
export interface Agent {
|
||||
id: string
|
||||
agentName: string
|
||||
ttsModelName: string
|
||||
ttsVoiceName: string
|
||||
llmModelName: string
|
||||
vllmModelName: string
|
||||
memModelId: string
|
||||
systemPrompt: string
|
||||
summaryMemory: string | null
|
||||
lastConnectedAt: string | null
|
||||
deviceCount: number
|
||||
}
|
||||
|
||||
// 智能体创建数据类型
|
||||
export interface AgentCreateData {
|
||||
agentName: string
|
||||
}
|
||||
|
||||
// 智能体详情数据类型
|
||||
export interface AgentDetail {
|
||||
id: string
|
||||
userId: string
|
||||
agentCode: string
|
||||
agentName: string
|
||||
asrModelId: string
|
||||
vadModelId: string
|
||||
llmModelId: string
|
||||
vllmModelId: string
|
||||
ttsModelId: string
|
||||
ttsVoiceId: string
|
||||
memModelId: string
|
||||
intentModelId: string
|
||||
chatHistoryConf: number
|
||||
systemPrompt: string
|
||||
summaryMemory: string
|
||||
langCode: string
|
||||
language: string
|
||||
sort: number
|
||||
creator: string
|
||||
createdAt: string
|
||||
updater: string
|
||||
updatedAt: string
|
||||
functions: AgentFunction[]
|
||||
}
|
||||
|
||||
export interface AgentFunction {
|
||||
id?: string
|
||||
agentId?: string
|
||||
pluginId: string
|
||||
paramInfo: Record<string, string | number | boolean> | null
|
||||
}
|
||||
|
||||
// 角色模板数据类型
|
||||
export interface RoleTemplate {
|
||||
id: string
|
||||
agentCode: string
|
||||
agentName: string
|
||||
asrModelId: string
|
||||
vadModelId: string
|
||||
llmModelId: string
|
||||
vllmModelId: string
|
||||
ttsModelId: string
|
||||
ttsVoiceId: string
|
||||
memModelId: string
|
||||
intentModelId: string
|
||||
chatHistoryConf: number
|
||||
systemPrompt: string
|
||||
summaryMemory: string
|
||||
langCode: string
|
||||
language: string
|
||||
sort: number
|
||||
creator: string
|
||||
createdAt: string
|
||||
updater: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 模型选项数据类型
|
||||
export interface ModelOption {
|
||||
id: string
|
||||
modelName: string
|
||||
}
|
||||
|
||||
export interface PluginField {
|
||||
key: string
|
||||
type: string
|
||||
label: string
|
||||
default: string
|
||||
selected?: boolean
|
||||
editing?: boolean
|
||||
}
|
||||
|
||||
export interface PluginDefinition {
|
||||
id: string
|
||||
modelType: string
|
||||
providerCode: string
|
||||
name: string
|
||||
fields: PluginField[] // 注意:原始是字符串,需要先 JSON.parse
|
||||
sort: number
|
||||
updater: string
|
||||
updateDate: string
|
||||
creator: string
|
||||
createDate: string
|
||||
[key: string]: any
|
||||
}
|
||||
Reference in New Issue
Block a user