import type { Agent, AgentCreateData, AgentDetail, ModelOption, RoleTemplate, } from './types' import { http } from '@/http/request/alova' // 获取智能体详情 export function getAgentDetail(id: string) { return http.Get(`/agent/${id}`, { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取角色模板列表 export function getRoleTemplates() { return http.Get('/agent/template', { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取模型选项 export function getModelOptions(modelType: string, modelName: string = '') { return http.Get('/models/names', { params: { modelType, modelName, }, meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取智能体列表 export function getAgentList() { return http.Get('/agent/list', { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 创建智能体 export function createAgent(data: AgentCreateData) { return http.Post('/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) { return http.Put(`/agent/${id}`, data, { meta: { ignoreAuth: false, toast: true, }, cacheFor: { expire: 0, }, }) } // 获取插件列表 export function getPluginFunctions() { return http.Get(`/models/provider/plugin/names`, { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取mcp接入点 export function getMcpAddress(agentId: string) { return http.Get(`/agent/mcp/address/${agentId}`, { meta: { ignoreAuth: false, toast: false, }, }) } // 获取mcp工具 export function getMcpTools(agentId: string) { return http.Get(`/agent/mcp/tools/${agentId}`, { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取声纹列表 export function getVoicePrintList(agentId: string) { return http.Get(`/agent/voice-print/list/${agentId}`, { meta: { ignoreAuth: false, toast: false, }, cacheFor: { expire: 0, }, }) } // 获取语音对话记录 export function getChatHistoryUser(agentId: string) { return http.Get(`/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, }, }) }