mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +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,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user