diff --git a/main/manager-mobile/src/api/agent/agent.ts b/main/manager-mobile/src/api/agent/agent.ts index 2ec9d34d7..32b72ad7c 100644 --- a/main/manager-mobile/src/api/agent/agent.ts +++ b/main/manager-mobile/src/api/agent/agent.ts @@ -7,7 +7,7 @@ import type { } from './types' import { http } from '@/http/request/alova' -// Get agent details +// 获取智能体详情 export function getAgentDetail(id: string) { return http.Get(`/agent/${id}`, { meta: { @@ -20,7 +20,7 @@ export function getAgentDetail(id: string) { }) } -// Get role template list +// 获取角色模板列表 export function getRoleTemplates() { return http.Get('/agent/template', { meta: { @@ -33,7 +33,7 @@ export function getRoleTemplates() { }) } -// Get model options +// 获取模型选项 export function getModelOptions(modelType: string, modelName: string = '') { return http.Get('/models/names', { params: { @@ -50,7 +50,7 @@ export function getModelOptions(modelType: string, modelName: string = '') { }) } -// Get agent list +// 获取智能体列表 export function getAgentList() { return http.Get('/agent/list', { meta: { @@ -63,7 +63,7 @@ export function getAgentList() { }) } -// Create agent +// 创建智能体 export function createAgent(data: AgentCreateData) { return http.Post('/agent', data, { meta: { @@ -73,7 +73,7 @@ export function createAgent(data: AgentCreateData) { }) } -// Delete agent +// 删除智能体 export function deleteAgent(id: string) { return http.Delete(`/agent/${id}`, { meta: { @@ -83,7 +83,7 @@ export function deleteAgent(id: string) { }) } -// Get TTS voice list +// 获取TTS音色列表 export function getTTSVoices(ttsModelId: string, voiceName: string = '') { return http.Get<{ id: string, name: string }[]>(`/models/${ttsModelId}/voices`, { params: { @@ -99,7 +99,7 @@ export function getTTSVoices(ttsModelId: string, voiceName: string = '') { }) } -// Update agent +// 更新智能体 export function updateAgent(id: string, data: Partial) { return http.Put(`/agent/${id}`, data, { meta: { @@ -112,7 +112,7 @@ export function updateAgent(id: string, data: Partial) { }) } -// Get plugin list +// 获取插件列表 export function getPluginFunctions() { return http.Get(`/models/provider/plugin/names`, { meta: { @@ -125,17 +125,18 @@ export function getPluginFunctions() { }) } -// Get MCP access point +// 获取mcp接入点 export function getMcpAddress(agentId: string) { return http.Get(`/agent/mcp/address/${agentId}`, { meta: { ignoreAuth: false, toast: false, + isExposeError: true, }, }) } -// Get MCP tools +// 获取mcp工具 export function getMcpTools(agentId: string) { return http.Get(`/agent/mcp/tools/${agentId}`, { meta: { @@ -148,7 +149,7 @@ export function getMcpTools(agentId: string) { }) } -// Get voiceprint list +// 获取声纹列表 export function getVoicePrintList(agentId: string) { return http.Get(`/agent/voice-print/list/${agentId}`, { meta: { @@ -161,7 +162,7 @@ export function getVoicePrintList(agentId: string) { }) } -// Get voice conversation records +// 获取语音对话记录 export function getChatHistoryUser(agentId: string) { return http.Get(`/agent/${agentId}/chat-history/user`, { meta: { @@ -174,7 +175,7 @@ export function getChatHistoryUser(agentId: string) { }) } -// Add voiceprint speaker +// 新增声纹说话人 export function createVoicePrint(data: { agentId: string, audioId: string, sourceName: string, introduce: string }) { return http.Post('/agent/voice-print', data, { meta: { @@ -183,3 +184,39 @@ export function createVoicePrint(data: { agentId: string, audioId: string, sourc }, }) } + +// 获取智能体标签 +export function getAgentTags(agentId: string) { + return http.Get(`/agent/${agentId}/tags`, { + meta: { + ignoreAuth: false, + toast: false, + }, + cacheFor: { + expire: 0, + }, + }) +} + +// 更新智能体标签 +export function updateAgentTags(agentId: string, data) { + return http.Put(`/agent/${agentId}/tags`, data, { + meta: { + ignoreAuth: false, + isExposeError: true, + }, + }) +} + +// 获取所有语言 +export function getAllLanguage(modelId: string) { + return http.Get<{ id: string, name: string, languages: string }[]>(`/models/${modelId}/voices`, { + meta: { + ignoreAuth: false, + toast: false, + }, + cacheFor: { + expire: 0, + }, + }) +} diff --git a/main/manager-mobile/src/api/agent/types.ts b/main/manager-mobile/src/api/agent/types.ts index b64b820c7..f04ef3d1c 100644 --- a/main/manager-mobile/src/api/agent/types.ts +++ b/main/manager-mobile/src/api/agent/types.ts @@ -1,4 +1,4 @@ -// Agent list data type +// 智能体列表数据类型 export interface Agent { id: string agentName: string @@ -11,14 +11,15 @@ export interface Agent { summaryMemory: string | null lastConnectedAt: string | null deviceCount: number + tags: Record[] } -// Agent creation data type +// 智能体创建数据类型 export interface AgentCreateData { agentName: string } -// Agent details data type +// 智能体详情数据类型 export interface AgentDetail { id: string userId: string @@ -43,7 +44,20 @@ export interface AgentDetail { createdAt: string updater: string updatedAt: string + ttsLanguage: string + ttsVolume: number + ttsRate: number + ttsPitch: number functions: AgentFunction[] + contextProviders: Providers[] +} + +export interface Providers { + url: string + headers: Array<{ + key: string + value: string + }> } export interface AgentFunction { @@ -53,7 +67,7 @@ export interface AgentFunction { paramInfo: Record | null } -// Role template data type +// 角色模板数据类型 export interface RoleTemplate { id: string agentCode: string @@ -78,7 +92,7 @@ export interface RoleTemplate { updatedAt: string } -// Model options data type +// 模型选项数据类型 export interface ModelOption { id: string modelName: string @@ -98,7 +112,7 @@ export interface PluginDefinition { modelType: string providerCode: string name: string - fields: PluginField[] // Note: Original is string, need to JSON.parse first + fields: PluginField[] // 注意:原始是字符串,需要先 JSON.parse sort: number updater: string updateDate: string diff --git a/main/manager-mobile/src/pages.json b/main/manager-mobile/src/pages.json index 2ab728f18..312f4795c 100644 --- a/main/manager-mobile/src/pages.json +++ b/main/manager-mobile/src/pages.json @@ -176,7 +176,7 @@ "type": "page", "layout": "default", "style": { - "navigationBarTitleText": "Settings", + "navigationBarTitleText": "设置", "navigationStyle": "custom" } }, diff --git a/main/manager-mobile/src/pages/agent/edit.vue b/main/manager-mobile/src/pages/agent/edit.vue index 09f2b724b..964ad0b2b 100644 --- a/main/manager-mobile/src/pages/agent/edit.vue +++ b/main/manager-mobile/src/pages/agent/edit.vue @@ -1,8 +1,9 @@