From 9e218281da5fc16e19d41117b90a82a8deb7b575 Mon Sep 17 00:00:00 2001 From: LiJinHui <166460433+stu-rgsze@users.noreply.github.com> Date: Sat, 20 Sep 2025 17:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/src/apis/module/agent.js | 35 ++ main/manager-web/src/i18n/en.js | 35 +- main/manager-web/src/i18n/zh_CN.js | 34 +- main/manager-web/src/i18n/zh_TW.js | 35 +- .../src/views/AgentTemplateManagement.vue | 12 +- .../src/views/TemplateQuickConfig.vue | 549 +++++------------- 6 files changed, 208 insertions(+), 492 deletions(-) diff --git a/main/manager-web/src/apis/module/agent.js b/main/manager-web/src/apis/module/agent.js index ec7201c3..2a4ae9f9 100644 --- a/main/manager-web/src/apis/module/agent.js +++ b/main/manager-web/src/apis/module/agent.js @@ -97,6 +97,25 @@ export default { }); }).send(); }, + // 删除以下重复定义的方法 + // 保留此方法以保持向后兼容性,但内部使用分页API + // getAgentTemplate(callback) { + // // 内部调用分页API获取所有模板 + // this.getAgentTemplatesPage({ pageNum: 1, pageSize: 100 }, (res) => { + // if (res && res.data && res.data.code === 0) { + // // 转换响应格式以保持兼容性 + // const compatibleRes = { + // data: { + // code: 0, + // data: res.data.data?.records || [] + // } + // }; + // callback(compatibleRes); + // } else { + // callback(res); + // } + // }); + // }, // 新增:获取智能体模板分页列表 getAgentTemplatesPage(params, callback) { @@ -350,4 +369,20 @@ export default { }); }).send(); }, + // 在getAgentTemplate方法后添加获取单个模板的方法 + getAgentTemplateById(templateId, callback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/agent/template/${templateId}`) + .method('GET') + .success((res) => { + RequestService.clearRequestTime(); + callback(res); + }) + .networkFail((err) => { + console.error('获取单个模板失败:', err); + RequestService.reAjaxFun(() => { + this.getAgentTemplateById(templateId, callback); + }); + }).send(); + }, } diff --git a/main/manager-web/src/i18n/en.js b/main/manager-web/src/i18n/en.js index 8cf50ae5..cc522420 100644 --- a/main/manager-web/src/i18n/en.js +++ b/main/manager-web/src/i18n/en.js @@ -852,30 +852,8 @@ export default { 'agentTemplateManagement.confirmBatchDelete': 'Are you sure you want to delete the selected {count} templates?', 'agentTemplateManagement.deleteFailed': 'Template deletion failed', 'agentTemplateManagement.batchDeleteFailed': 'Template batch deletion failed', - 'agentTemplateManagement.deleteBackendError': 'Deletion failed, please check if the backend service is working properly', - - // agentTemplateManagement Dialog - 'agentTemplateManagement.templateDialog.title': 'Template Configuration', - 'agentTemplateManagement.templateDialog.templateName': 'Template Name', - 'agentTemplateManagement.templateDialog.templateNamePlaceholder': 'Please enter template name', - 'agentTemplateManagement.templateDialog.description': 'Description', - 'agentTemplateManagement.templateDialog.descriptionPlaceholder': 'Please enter description', - 'agentTemplateManagement.templateDialog.roleName': 'Role Name', - 'agentTemplateManagement.templateDialog.roleNamePlaceholder': 'Please enter role name', - 'agentTemplateManagement.templateDialog.avatar': 'Avatar', - 'agentTemplateManagement.templateDialog.selectAvatar': 'Select Avatar', - 'agentTemplateManagement.templateDialog.systemPrompt': 'System Prompt', - 'agentTemplateManagement.templateDialog.systemPromptPlaceholder': 'Please enter system prompt', - 'agentTemplateManagement.templateDialog.modelConfig': 'Model Configuration', - 'agentTemplateManagement.templateDialog.modelName': 'Model Name', - 'agentTemplateManagement.templateDialog.temperature': 'Temperature', - 'agentTemplateManagement.templateDialog.topP': 'Top P', - 'agentTemplateManagement.templateDialog.maxTokens': 'Max Tokens', - 'agentTemplateManagement.templateDialog.save': 'Save', - 'agentTemplateManagement.templateDialog.cancel': 'Cancel', - 'agentTemplateManagement.templateDialog.nameRequired': 'Please enter template name', - 'agentTemplateManagement.templateDialog.roleNameRequired': 'Please enter role name', - 'agentTemplateManagement.templateDialog.systemPromptRequired': 'Please enter system prompt', + 'agentTemplateManagement.deleteBackendError': 'Deletion failed, please check if the backend service is normal', + 'agentTemplateManagement.deleteCancelled': 'Deletion cancelled', // templateQuickConfig 'templateQuickConfig.title': 'Module Quick Configuration', @@ -895,7 +873,14 @@ export default { 'templateQuickConfig.configReset': 'Configuration has been reset', 'templateQuickConfig.confirmReset': 'Are you sure you want to reset the configuration?', 'templateQuickConfig.success': 'Success', - 'error': 'Error', + 'templateQuickConfig.error': 'Error', + 'templateQuickConfig.configSaveFailed': 'Template configuration save failed', + 'templateQuickConfig.saveBackendError': 'Save failed, please check if the backend service is normal', + 'templateQuickConfig.confirm': 'Confirm', + 'templateQuickConfig.cancel': 'Cancel', + 'templateQuickConfig.templateNotFound': 'Template not found', + 'templateQuickConfig.fetchTemplateFailed': 'Failed to fetch template', + 'templateQuickConfig.fetchTemplateBackendError': 'Failed to fetch template, please check if the backend service is normal', 'warning': 'Warning', 'info': 'Info' } diff --git a/main/manager-web/src/i18n/zh_CN.js b/main/manager-web/src/i18n/zh_CN.js index 8b97989c..efd3836e 100644 --- a/main/manager-web/src/i18n/zh_CN.js +++ b/main/manager-web/src/i18n/zh_CN.js @@ -853,29 +853,6 @@ export default { 'agentTemplateManagement.batchDeleteFailed': '模板批量删除失败', 'agentTemplateManagement.deleteBackendError': '删除失败,请检查后端服务是否正常', - // 默认角色模版对话框文本 - 'agentTemplateManagement.templateDialog.title': '模板配置', - 'agentTemplateManagement.templateDialog.templateName': '模板名称', - 'agentTemplateManagement.templateDialog.templateNamePlaceholder': '请输入模板名称', - 'agentTemplateManagement.templateDialog.description': '模板描述', - 'agentTemplateManagement.templateDialog.descriptionPlaceholder': '请输入模板描述', - 'agentTemplateManagement.templateDialog.roleName': '角色名称', - 'agentTemplateManagement.templateDialog.roleNamePlaceholder': '请输入角色名称', - 'agentTemplateManagement.templateDialog.avatar': '头像', - 'agentTemplateManagement.templateDialog.selectAvatar': '选择头像', - 'agentTemplateManagement.templateDialog.systemPrompt': '系统提示词', - 'agentTemplateManagement.templateDialog.systemPromptPlaceholder': '请输入系统提示词', - 'agentTemplateManagement.templateDialog.modelConfig': '模型配置', - 'agentTemplateManagement.templateDialog.modelName': '模型名称', - 'agentTemplateManagement.templateDialog.temperature': '温度', - 'agentTemplateManagement.templateDialog.topP': 'Top P', - 'agentTemplateManagement.templateDialog.maxTokens': '最大 tokens', - 'agentTemplateManagement.templateDialog.save': '保存', - 'agentTemplateManagement.templateDialog.cancel': '取消', - 'agentTemplateManagement.templateDialog.nameRequired': '请输入模板名称', - 'agentTemplateManagement.templateDialog.roleNameRequired': '请输入角色名称', - 'agentTemplateManagement.templateDialog.systemPromptRequired': '请输入系统提示词', - // 模板快速配置页面文本 'templateQuickConfig.title': '模块快速配置', 'templateQuickConfig.basicSettings': '基本设置', @@ -889,12 +866,17 @@ export default { 'templateQuickConfig.deviceSettings': '设备设置', 'templateQuickConfig.pluginSettings': '插件设置', 'templateQuickConfig.saveConfig': '保存配置', - 'templateQuickConfig.resetConfig': '重置配置', - 'templateQuickConfig.configSaved': '配置保存成功', - 'templateQuickConfig.configReset': '配置已重置', + 'templateQuickConfig.resetConfig': '配置已重置', 'templateQuickConfig.confirmReset': '确定要重置配置吗?', 'templateQuickConfig.success': '成功', 'templateQuickConfig.error': '错误', + 'templateQuickConfig.configSaveFailed': '模板配置保存失败', + 'templateQuickConfig.saveBackendError': '保存失败,请检查后端服务是否正常', + 'templateQuickConfig.confirm': '确定', + 'templateQuickConfig.cancel': '取消', + 'templateQuickConfig.templateNotFound': '未找到指定模板', + 'templateQuickConfig.fetchTemplateFailed': '获取模板失败', + 'templateQuickConfig.fetchTemplateBackendError': '获取模板失败,请检查后端服务是否正常', 'warning': '警告', 'info': '提示' } \ No newline at end of file diff --git a/main/manager-web/src/i18n/zh_TW.js b/main/manager-web/src/i18n/zh_TW.js index 83aae70e..43061c1b 100644 --- a/main/manager-web/src/i18n/zh_TW.js +++ b/main/manager-web/src/i18n/zh_TW.js @@ -855,31 +855,8 @@ export default { 'agentTemplateManagement.deleteBackendError': '刪除失敗,請檢查後端服務是否正常', 'agentTemplateManagement.deleteCancelled': '已取消刪除', - // 預設角色管理對話框文本 - 'agentTemplateManagement.templateDialog.title': '模板配置', - 'agentTemplateManagement.templateDialog.templateName': '模板名稱', - 'agentTemplateManagement.templateDialog.templateNamePlaceholder': '請輸入模板名稱', - 'agentTemplateManagement.templateDialog.description': '模板描述', - 'agentTemplateManagement.templateDialog.descriptionPlaceholder': '請輸入模板描述', - 'agentTemplateManagement.templateDialog.roleName': '角色名稱', - 'agentTemplateManagement.templateDialog.roleNamePlaceholder': '請輸入角色名稱', - 'agentTemplateManagement.templateDialog.avatar': '頭像', - 'agentTemplateManagement.templateDialog.selectAvatar': '選擇頭像', - 'agentTemplateManagement.templateDialog.systemPrompt': '系統提示詞', - 'agentTemplateManagement.templateDialog.systemPromptPlaceholder': '請輸入系統提示詞', - 'agentTemplateManagement.templateDialog.modelConfig': '模型配置', - 'agentTemplateManagement.templateDialog.modelName': '模型名稱', - 'agentTemplateManagement.templateDialog.temperature': '溫度', - 'agentTemplateManagement.templateDialog.topP': 'Top P', - 'agentTemplateManagement.templateDialog.maxTokens': '最大 tokens', - 'agentTemplateManagement.templateDialog.save': '保存', - 'agentTemplateManagement.templateDialog.cancel': '取消', - 'agentTemplateManagement.templateDialog.nameRequired': '請輸入模板名稱', - 'agentTemplateManagement.templateDialog.roleNameRequired': '請輸入角色名稱', - 'agentTemplateManagement.templateDialog.systemPromptRequired': '請輸入系統提示詞', - - // 模組快速配置頁面文本 - 'templateQuickConfig.title': '模組快速配置', + // 模板快速配置 + 'templateQuickConfig.title': '模組快速設定', 'templateQuickConfig.basicSettings': '基本設置', 'templateQuickConfig.agentSettings.agentName': '助手暱稱', 'templateQuickConfig.agentSettings.agentNamePlaceholder': '請輸入助手暱稱', @@ -896,6 +873,14 @@ export default { 'templateQuickConfig.configReset': '配置已重置', 'templateQuickConfig.confirmReset': '確定要重置配置嗎?', 'templateQuickConfig.success': '成功', + 'templateQuickConfig.error': '錯誤', + 'templateQuickConfig.configSaveFailed': '模板配置保存失敗', + 'templateQuickConfig.saveBackendError': '保存失敗,請檢查後端服務是否正常', + 'templateQuickConfig.confirm': '確定', + 'templateQuickConfig.cancel': '取消', + 'templateQuickConfig.templateNotFound': '未找到指定模板', + 'templateQuickConfig.fetchTemplateFailed': '獲取模板失敗', + 'templateQuickConfig.fetchTemplateBackendError': '獲取模板失敗,請檢查後端服務是否正常', 'error': '錯誤', 'warning': '警告', 'info': '提示' diff --git a/main/manager-web/src/views/AgentTemplateManagement.vue b/main/manager-web/src/views/AgentTemplateManagement.vue index 170041b7..47a40bc2 100644 --- a/main/manager-web/src/views/AgentTemplateManagement.vue +++ b/main/manager-web/src/views/AgentTemplateManagement.vue @@ -30,22 +30,16 @@ - - - - - - + + diff --git a/main/manager-web/src/views/TemplateQuickConfig.vue b/main/manager-web/src/views/TemplateQuickConfig.vue index e9e30d58..024e120f 100644 --- a/main/manager-web/src/views/TemplateQuickConfig.vue +++ b/main/manager-web/src/views/TemplateQuickConfig.vue @@ -57,210 +57,145 @@ \ No newline at end of file