Merge pull request #2251 from xinnan-tech/LJH

update:新增调整角色模版的功能,添加新功能的国际化
This commit is contained in:
hrz
2025-09-21 18:10:05 +08:00
committed by GitHub
14 changed files with 1616 additions and 10 deletions
@@ -247,7 +247,7 @@ public interface Constant {
/**
* 版本号
*/
public static final String VERSION = "0.8.2";
public static final String VERSION = "0.8.3";
/**
* 无效固件URL
@@ -0,0 +1,158 @@
package xiaozhi.modules.agent.controller;
import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import xiaozhi.common.constant.Constant;
import xiaozhi.common.page.PageData;
import xiaozhi.common.utils.ConvertUtils;
import xiaozhi.common.utils.Result;
import xiaozhi.common.utils.ResultUtils;
import xiaozhi.modules.agent.entity.AgentTemplateEntity;
import xiaozhi.modules.agent.service.AgentTemplateService;
import xiaozhi.modules.agent.vo.AgentTemplateVO;
@Tag(name = "智能体模板管理")
@AllArgsConstructor
@RestController
@RequestMapping("/agent/template")
public class AgentTemplateController {
private final AgentTemplateService agentTemplateService;
@GetMapping("/page")
@Operation(summary = "获取模板分页列表")
@RequiresPermissions("sys:role:superAdmin")
@Parameters({
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true),
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true),
@Parameter(name = "agentName", description = "模板名称,模糊查询")
})
public Result<PageData<AgentTemplateVO>> getAgentTemplatesPage(
@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
// 创建分页对象
int page = Integer.parseInt(params.getOrDefault(Constant.PAGE, "1").toString());
int limit = Integer.parseInt(params.getOrDefault(Constant.LIMIT, "10").toString());
Page<AgentTemplateEntity> pageInfo = new Page<>(page, limit);
// 创建查询条件
QueryWrapper<AgentTemplateEntity> wrapper = new QueryWrapper<>();
String agentName = (String) params.get("agentName");
if (agentName != null && !agentName.isEmpty()) {
wrapper.like("agent_name", agentName);
}
wrapper.orderByAsc("sort");
// 执行分页查询
IPage<AgentTemplateEntity> pageResult = agentTemplateService.page(pageInfo, wrapper);
// 使用ConvertUtils转换为VO列表
List<AgentTemplateVO> voList = ConvertUtils.sourceToTarget(pageResult.getRecords(), AgentTemplateVO.class);
// 修复:使用构造函数创建PageData对象,而不是无参构造+setter
PageData<AgentTemplateVO> pageData = new PageData<>(voList, pageResult.getTotal());
return new Result<PageData<AgentTemplateVO>>().ok(pageData);
}
@GetMapping("/{id}")
@Operation(summary = "获取模板详情")
@RequiresPermissions("sys:role:superAdmin")
public Result<AgentTemplateVO> getAgentTemplateById(@PathVariable("id") String id) {
AgentTemplateEntity template = agentTemplateService.getById(id);
if (template == null) {
return ResultUtils.error("模板不存在");
}
// 使用ConvertUtils转换为VO
AgentTemplateVO vo = ConvertUtils.sourceToTarget(template, AgentTemplateVO.class);
return ResultUtils.success(vo);
}
@PostMapping
@Operation(summary = "创建模板")
@RequiresPermissions("sys:role:superAdmin")
public Result<AgentTemplateEntity> createAgentTemplate(@Valid @RequestBody AgentTemplateEntity template) {
// 设置排序值为下一个可用的序号
template.setSort(agentTemplateService.getNextAvailableSort());
boolean saved = agentTemplateService.save(template);
if (saved) {
return ResultUtils.success(template);
} else {
return ResultUtils.error("创建模板失败");
}
}
@PutMapping
@Operation(summary = "更新模板")
@RequiresPermissions("sys:role:superAdmin")
public Result<AgentTemplateEntity> updateAgentTemplate(@Valid @RequestBody AgentTemplateEntity template) {
boolean updated = agentTemplateService.updateById(template);
if (updated) {
return ResultUtils.success(template);
} else {
return ResultUtils.error("更新模板失败");
}
}
@DeleteMapping("/{id}")
@Operation(summary = "删除模板")
@RequiresPermissions("sys:role:superAdmin")
public Result<String> deleteAgentTemplate(@PathVariable("id") String id) {
// 先查询要删除的模板信息,获取其排序值
AgentTemplateEntity template = agentTemplateService.getById(id);
if (template == null) {
return ResultUtils.error("模板不存在");
}
Integer deletedSort = template.getSort();
// 执行删除操作
boolean deleted = agentTemplateService.removeById(id);
if (deleted) {
// 删除成功后,重新排序剩余模板
agentTemplateService.reorderTemplatesAfterDelete(deletedSort);
return ResultUtils.success("删除模板成功");
} else {
return ResultUtils.error("删除模板失败");
}
}
// 添加新的批量删除方法,使用不同的URL
@PostMapping("/batch-remove")
@Operation(summary = "批量删除模板")
@RequiresPermissions("sys:role:superAdmin")
public Result<String> batchRemoveAgentTemplates(@RequestBody List<String> ids) {
boolean deleted = agentTemplateService.removeByIds(ids);
if (deleted) {
return ResultUtils.success("批量删除成功");
} else {
return ResultUtils.error("批量删除模板失败");
}
}
}
@@ -25,4 +25,18 @@ public interface AgentTemplateService extends IService<AgentTemplateEntity> {
* @param modelId 模型ID
*/
void updateDefaultTemplateModelId(String modelType, String modelId);
/**
* 删除模板后重新排序剩余模板
*
* @param deletedSort 被删除模板的排序值
*/
void reorderTemplatesAfterDelete(Integer deletedSort);
/**
* 获取下一个可用的排序序号(寻找最小的未使用序号)
*
* @return 下一个可用的排序序号
*/
Integer getNextAvailableSort();
}
@@ -10,6 +10,11 @@ import xiaozhi.modules.agent.dao.AgentTemplateDao;
import xiaozhi.modules.agent.entity.AgentTemplateEntity;
import xiaozhi.modules.agent.service.AgentTemplateService;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* @author chenerlei
* @description 针对表【ai_agent_template(智能体配置模板表)】的数据库操作Service实现
@@ -69,4 +74,48 @@ public class AgentTemplateServiceImpl extends ServiceImpl<AgentTemplateDao, Agen
wrapper.ge("sort", 0);
update(wrapper);
}
@Override
public void reorderTemplatesAfterDelete(Integer deletedSort) {
if (deletedSort == null) {
return;
}
// 查询所有排序值大于被删除模板的记录
UpdateWrapper<AgentTemplateEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.gt("sort", deletedSort)
.setSql("sort = sort - 1");
// 执行批量更新,将这些记录的排序值减1
this.update(updateWrapper);
}
@Override
public Integer getNextAvailableSort() {
// 查询所有已存在的排序值并按升序排序
List<Integer> sortValues = baseMapper.selectList(new QueryWrapper<AgentTemplateEntity>())
.stream()
.map(AgentTemplateEntity::getSort)
.filter(Objects::nonNull)
.sorted()
.collect(Collectors.toList());
// 如果没有排序值,返回1
if (sortValues.isEmpty()) {
return 1;
}
// 寻找最小的未使用序号
int expectedSort = 1;
for (Integer sort : sortValues) {
if (sort > expectedSort) {
// 找到空缺的序号
return expectedSort;
}
expectedSort = sort + 1;
}
// 如果没有空缺,返回最大序号+1
return expectedSort;
}
}
@@ -222,7 +222,7 @@ function showAbout() {
title: `关于${import.meta.env.VITE_APP_TITLE}`,
content: `${import.meta.env.VITE_APP_TITLE}\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server`,
title: `关于小智智控台`,
content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.8.2`,
content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.8.3`,
showCancel: false,
confirmText: '确定',
})
+102 -1
View File
@@ -1,5 +1,5 @@
import { getServiceUrl } from '../api';
import RequestService from '../httpRequest';
import { getServiceUrl } from '../api';
export default {
@@ -97,6 +97,24 @@ export default {
});
}).send();
},
// 新增:获取智能体模板分页列表
getAgentTemplatesPage(params, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/template/page`)
.method('GET')
.data(params)
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail((err) => {
console.error('获取模板分页列表失败:', err);
RequestService.reAjaxFun(() => {
this.getAgentTemplatesPage(params, callback);
});
}).send();
},
// 获取智能体会话列表
getAgentSessions(agentId, params, callback) {
RequestService.sendRequest()
@@ -265,4 +283,87 @@ export default {
});
}).send();
},
// 在文件末尾(在最后一个方法后,大括号前)添加以下方法:
// 新增智能体模板
addAgentTemplate(templateData, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/template`)
.method('POST')
.data(templateData)
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.addAgentTemplate(templateData, callback);
});
}).send();
},
// 更新智能体模板
updateAgentTemplate(templateData, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/template`)
.method('PUT')
.data(templateData)
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.updateAgentTemplate(templateData, callback);
});
}).send();
},
// 删除智能体模板
deleteAgentTemplate(id, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/template/${id}`)
.method('DELETE')
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.deleteAgentTemplate(id, callback);
});
}).send();
},
// 批量删除智能体模板
batchDeleteAgentTemplate(ids, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/template/batch-remove`) // 修改为新的URL
.method('POST')
.data(Array.isArray(ids) ? ids : [ids]) // 确保是数组格式
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.batchDeleteAgentTemplate(ids, callback);
});
}).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();
},
}
@@ -35,11 +35,11 @@
<span class="nav-text">{{ $t('header.otaManagement') }}</span>
</div>
<el-dropdown v-if="isSuperAdmin" trigger="click" class="equipment-management more-dropdown"
:class="{ 'active-tab': $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' }"
:class="{ 'active-tab': $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' }"
@visible-change="handleParamDropdownVisibleChange">
<span class="el-dropdown-link">
<img loading="lazy" alt="" src="@/assets/header/param_management.png"
:style="{ filter: $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' ? 'brightness(0) invert(1)' : 'None' }" />
:style="{ filter: $route.path === '/dict-management' || $route.path === '/params-management' || $route.path === '/provider-management' || $route.path === '/server-side-management' || $route.path === '/agent-template-management' ? 'brightness(0) invert(1)' : 'None' }" />
<span class="nav-text">{{ $t('header.paramDictionary') }}</span>
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': paramDropdownVisible }"></i>
</span>
@@ -53,6 +53,9 @@
<el-dropdown-item @click.native="goProviderManagement">
{{ $t('header.providerManagement') }}
</el-dropdown-item>
<el-dropdown-item @click.native="goAgentTemplateManagement">
{{ $t('header.agentTemplate') }}
</el-dropdown-item>
<el-dropdown-item @click.native="goServerSideManagement">
{{ $t('header.serverSideManagement') }}
</el-dropdown-item>
@@ -193,6 +196,10 @@ export default {
goServerSideManagement() {
this.$router.push('/server-side-management')
},
// 添加默认角色模板管理导航方法
goAgentTemplateManagement() {
this.$router.push('/agent-template-management')
},
// 获取用户信息
fetchUserInfo() {
userApi.getUserInfo(({ data }) => {
+49 -1
View File
@@ -7,6 +7,7 @@ export default {
'login.loginSuccess': 'Login successful!',
// HeaderBar组件文本
// 在header相关翻译中添加
'header.smartManagement': 'Agents',
'header.modelConfig': 'Models',
'header.userManagement': 'Users',
@@ -14,6 +15,7 @@ export default {
'header.paramDictionary': 'More',
'header.paramManagement': 'Params Management',
'header.dictManagement': 'Dict Management',
'header.agentTemplate': 'Default Role Templates', // 添加这一行
// McpToolCallDialog component text
'mcpToolCall.title': 'Tool Call',
@@ -619,6 +621,7 @@ export default {
'common.deleteFailure': 'Delete Failed, Please Try Again',
'common.deleteCancelled': 'Delete Cancelled',
'common.warning': 'Warning',
'common.tip': 'Tip',
'common.confirm': 'Confirm',
'common.cancel': 'Cancel',
'common.sensitive': 'Sensitive',
@@ -998,4 +1001,49 @@ export default {
'providerDialog.selectFieldsToDelete': 'Please select fields to delete first',
'providerDialog.confirmBatchDeleteFields': 'Are you sure to delete {count} selected fields?',
'providerDialog.batchDeleteFieldsSuccess': 'Successfully deleted {count} fields',
};
// agentTemplateManagement
'agentTemplateManagement.title': 'Default Role Management',
'agentTemplateManagement.templateName': 'Template Name',
'agentTemplateManagement.action': 'Action',
'agentTemplateManagement.createTemplate': 'Create Template',
'templateQuickConfig.newTemplate': 'New Template',
'agentTemplateManagement.editTemplate': 'Edit Template',
'agentTemplateManagement.deleteTemplate': 'Delete Template',
'agentTemplateManagement.deleteSuccess': 'Template deleted successfully',
'agentTemplateManagement.batchDelete': 'Batch Delete',
'agentTemplateManagement.batchDeleteSuccess': 'Batch deletion successful',
'agentTemplateManagement.selectTemplate': 'Please select a template',
'agentTemplateManagement.select': 'Select',
'agentTemplateManagement.searchPlaceholder': 'Please enter template name to search',
'agentTemplateManagement.search': 'Search',
'agentTemplateManagement.serialNumber': 'Serial Number',
'agentTemplateManagement.selectAll': 'Select All',
'agentTemplateManagement.deselectAll': 'Deselect All',
'agentTemplateManagement.loading': 'Loading...',
'agentTemplateManagement.confirmSingleDelete': 'Are you sure you want to delete this template?',
'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 normal',
'agentTemplateManagement.deleteCancelled': 'Deletion cancelled',
// templateQuickConfig
'templateQuickConfig.title': 'Module Quick Configuration',
'templateQuickConfig.agentSettings.agentName': 'Nickname',
'templateQuickConfig.agentSettings.agentNamePlaceholder': 'Please enter nickname',
'templateQuickConfig.agentSettings.systemPrompt': 'Introduction',
'templateQuickConfig.agentSettings.systemPromptPlaceholder': 'Please enter ntroduction',
'templateQuickConfig.saveConfig': 'Save Configuration',
'templateQuickConfig.resetConfig': 'Reset Configuration',
'templateQuickConfig.configSaved': 'Configuration saved successfully',
'templateQuickConfig.configReset': 'Configuration has been reset',
'templateQuickConfig.confirmReset': 'Are you sure you want to reset the configuration?',
'templateQuickConfig.saveFailed': 'Configuration save failed',
'templateQuickConfig.confirm': 'Confirm',
'templateQuickConfig.cancel': 'Cancel',
'templateQuickConfig.templateNotFound': 'Template not found',
'warning': 'Warning',
'info': 'Info',
'common.networkError': 'Network request failed'
}
+49 -2
View File
@@ -14,6 +14,7 @@ export default {
'header.paramDictionary': '参数字典',
'header.paramManagement': '参数管理',
'header.dictManagement': '字典管理',
'header.agentTemplate': '默认角色模板',
// McpToolCallDialog组件文本
'mcpToolCall.title': '工具调用',
@@ -558,7 +559,7 @@ export default {
'dictManagement.dictValue': '字典值',
'dictManagement.sort': '排序',
'dictManagement.delete': '删除',
'dictManagement.selectAll': '全选',
'dictManagement.selectAll': '默认角色管理',
'dictManagement.deselectAll': '取消全选',
'dictManagement.addDictType': '新增字典类型',
'dictManagement.batchDeleteDictType': '批量删除字典类型',
@@ -620,6 +621,7 @@ export default {
'common.deleteFailure': '删除失败,请重试',
'common.deleteCancelled': '已取消删除',
'common.warning': '警告',
'common.tip': '提示',
'common.confirm': '确定',
'common.cancel': '取消',
'common.sensitive': '敏感',
@@ -998,4 +1000,49 @@ export default {
'providerDialog.selectFieldsToDelete': '请先选择要删除的字段',
'providerDialog.confirmBatchDeleteFields': '确定要删除选中的{count}个字段吗?',
'providerDialog.batchDeleteFieldsSuccess': '成功删除{count}个字段',
};
// 默认角色模版页面文本
'agentTemplateManagement.title': '默认角色管理',
'agentTemplateManagement.templateName': '模板名称',
'agentTemplateManagement.action': '操作',
'templateQuickConfig.saveSuccess': '配置保存成功',
'templateQuickConfig.saveFailed': '配置保存失败',
'agentTemplateManagement.createTemplate': '创建模板',
'agentTemplateManagement.editTemplate': '编辑模板',
'agentTemplateManagement.deleteTemplate': '删除模板',
'agentTemplateManagement.deleteSuccess': '模板删除成功',
'agentTemplateManagement.batchDelete': '批量删除',
'agentTemplateManagement.batchDeleteSuccess': '批量删除成功',
'agentTemplateManagement.selectTemplate': '请选择模板',
'agentTemplateManagement.select': '选择',
'agentTemplateManagement.searchPlaceholder': '请输入模板名称搜索',
'agentTemplateManagement.search': '搜索',
'agentTemplateManagement.serialNumber': '序号',
'agentTemplateManagement.selectAll': '全选',
'agentTemplateManagement.deselectAll': '取消全选',
'agentTemplateManagement.loading': '拼命加载中',
'agentTemplateManagement.confirmSingleDelete': '确定要删除这个模板吗?',
'agentTemplateManagement.confirmBatchDelete': '确定要删除选中的 {count} 个模板吗?',
'agentTemplateManagement.deleteFailed': '模板删除失败',
'agentTemplateManagement.batchDeleteFailed': '模板批量删除失败',
'agentTemplateManagement.deleteBackendError': '删除失败,请检查后端服务是否正常',
// 模板快速配置页面文本
'templateQuickConfig.title': '模块快速配置',
'templateQuickConfig.agentSettings.agentName': '助手昵称',
'templateQuickConfig.agentSettings.agentNamePlaceholder': '请输入助手昵称',
'templateQuickConfig.agentSettings.systemPrompt': '角色介绍',
'templateQuickConfig.agentSettings.systemPromptPlaceholder': '请输入角色介绍',
'templateQuickConfig.saveConfig': '保存配置',
'templateQuickConfig.resetConfig': '重置配置',
'templateQuickConfig.confirmReset': '确定要重置配置吗?',
'templateQuickConfig.confirm': '确定',
'templateQuickConfig.cancel': '取消',
'templateQuickConfig.templateNotFound': '未找到指定模板',
'templateQuickConfig.newTemplate': '新模板',
'templateQuickConfig.saveSuccess': '保存成功',
'templateQuickConfig.resetSuccess': '重置成功',
'warning': '警告',
'info': '提示',
'common.networkError': '网络请求失败'
}
+49 -1
View File
@@ -7,6 +7,7 @@ export default {
'login.loginSuccess': '登錄成功!',
// HeaderBar组件文本
// 在header相关翻译中添加
'header.smartManagement': '智能體管理',
'header.modelConfig': '模型配置',
'header.userManagement': '用戶管理',
@@ -14,6 +15,7 @@ export default {
'header.paramDictionary': '參數字典',
'header.paramManagement': '參數管理',
'header.dictManagement': '字典管理',
'header.agentTemplate': '預設角色模板', // 添加这一行
// McpToolCallDialog组件文本
'mcpToolCall.title': '工具調用',
@@ -655,6 +657,7 @@ export default {
'common.deleteFailure': '刪除失敗,請重試',
'common.deleteCancelled': '已取消刪除',
'common.warning': '警告',
'common.tip': '提示',
'common.confirm': '確定',
'common.cancel': '取消',
'common.sensitive': '敏感',
@@ -998,4 +1001,49 @@ export default {
'providerDialog.selectFieldsToDelete': '請先選擇要刪除的字段',
'providerDialog.confirmBatchDeleteFields': '確定要刪除選中的{count}個字段嗎?',
'providerDialog.batchDeleteFieldsSuccess': '成功刪除{count}個字段',
};
// 預設角色管理頁面文本
'agentTemplateManagement.title': '預設角色管理',
'agentTemplateManagement.templateName': '模板名稱',
'agentTemplateManagement.action': '操作',
'agentTemplateManagement.createTemplate': '建立模板',
'agentTemplateManagement.editTemplate': '編輯模板',
'agentTemplateManagement.deleteTemplate': '刪除模板',
'agentTemplateManagement.deleteSuccess': '模板刪除成功',
'agentTemplateManagement.batchDelete': '批次刪除',
'agentTemplateManagement.batchDeleteSuccess': '批次刪除成功',
'agentTemplateManagement.selectTemplate': '請選擇模板',
'agentTemplateManagement.select': '選擇',
'agentTemplateManagement.searchPlaceholder': '請輸入模板名稱搜尋',
'agentTemplateManagement.search': '搜尋',
'agentTemplateManagement.serialNumber': '序號',
'agentTemplateManagement.selectAll': '全選',
'agentTemplateManagement.deselectAll': '取消全選',
'agentTemplateManagement.loading': '拼命加載中',
'agentTemplateManagement.confirmSingleDelete': '確定要刪除這個模板嗎?',
'agentTemplateManagement.confirmBatchDelete': '確定要刪除選中的 {count} 個模板嗎?',
'agentTemplateManagement.deleteFailed': '模板刪除失敗',
'agentTemplateManagement.batchDeleteFailed': '批次刪除失敗',
'agentTemplateManagement.deleteBackendError': '刪除失敗,請檢查後端服務是否正常',
'agentTemplateManagement.deleteCancelled': '已取消刪除',
// 模板快速配置
'templateQuickConfig.title': '模組快速設定',
'templateQuickConfig.agentSettings.agentName': '助手暱稱',
'templateQuickConfig.agentSettings.agentNamePlaceholder': '請輸入助手暱稱',
'templateQuickConfig.agentSettings.systemPrompt': '角色介紹',
'templateQuickConfig.agentSettings.systemPromptPlaceholder': '請輸入角色介紹',
'templateQuickConfig.saveConfig': '保存配置',
'templateQuickConfig.resetConfig': '重置配置',
'templateQuickConfig.configSaved': '配置保存成功',
'templateQuickConfig.configReset': '配置已重置',
'templateQuickConfig.confirmReset': '確定要重置配置嗎?',
'templateQuickConfig.confirm': '確定',
'templateQuickConfig.cancel': '取消',
'templateQuickConfig.templateNotFound': '未找到指定模板',
'templateQuickConfig.newTemplate': '新模板',
'error': '錯誤',
'warning': '警告',
'info': '提示',
'common.networkError': '網路請求失敗'
}
+23
View File
@@ -124,6 +124,29 @@ const routes = [
return import('../views/ProviderManagement.vue')
}
},
// 添加默认角色管理路由
{
path: '/agent-template-management',
name: 'AgentTemplateManagement',
component: function () {
return import('../views/AgentTemplateManagement.vue')
}
},
// 添加模板快速配置路由
{
path: '/template-quick-config',
name: 'TemplateQuickConfig',
component: function () {
return import('../views/TemplateQuickConfig.vue')
}
},
{
path: '/provider-management',
name: 'ProviderManagement',
component: function () {
return import('../views/ProviderManagement.vue')
}
},
]
const router = new VueRouter({
base: process.env.VUE_APP_PUBLIC_PATH || '/',
@@ -0,0 +1,633 @@
<template>
<div class="welcome">
<HeaderBar />
<div class="operation-bar">
<h2 class="page-title">{{ $t("agentTemplateManagement.title") }}</h2>
<div class="right-operations">
<el-input
:placeholder="$t('agentTemplateManagement.searchPlaceholder')"
v-model="search"
class="search-input"
clearable
@keyup.enter.native="handleSearch"
style="width: 240px"
/>
<el-button class="btn-search" @click="handleSearch">
{{ $t("agentTemplateManagement.search") }}
</el-button>
</div>
</div>
<!-- 主体内容 -->
<div class="main-wrapper">
<div class="content-panel">
<div class="content-area">
<el-card class="template-card" shadow="never">
<el-table
ref="templateTable"
:data="templateList"
style="width: 100%"
v-loading="templateLoading"
:element-loading-text="$t('agentTemplateManagement.loading')"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.7)"
class="transparent-table"
:header-cell-style="{ padding: '10px 20px' }"
:cell-style="{ padding: '10px 20px' }"
>
<!-- 移除@row-click="handleRowClick" -->
<!-- 自定义选择列实现表头是"选择"文字数据行是小方框 -->
<el-table-column
:label="$t('agentTemplateManagement.select')"
align="center"
min-width="100"
>
<template slot-scope="scope">
<el-checkbox
v-model="scope.row.selected"
@change="handleRowSelectionChange(scope.row)"
@click.stop
></el-checkbox>
</template>
</el-table-column>
<!-- 模板名称 -->
<el-table-column
:label="$t('agentTemplateManagement.templateName')"
prop="agentName"
min-width="250"
show-overflow-tooltip
>
<template slot-scope="scope">
<span>{{ scope.row.agentName }}</span>
</template>
</el-table-column>
<!-- 修改为序号列并移动到此处 -->
<el-table-column
:label="$t('agentTemplateManagement.serialNumber')"
min-width="120"
align="center"
>
<template slot-scope="scope">
<span>{{ (currentPage - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<!-- 操作列 -->
<el-table-column
:label="$t('agentTemplateManagement.action')"
min-width="250"
align="center"
>
<template slot-scope="scope">
<div style="display: flex; justify-content: center; gap: 15px">
<el-button type="text" @click="editTemplate(scope.row)">{{
$t("agentTemplateManagement.editTemplate")
}}</el-button>
<el-button type="text" @click="deleteTemplate(scope.row)">{{
$t("agentTemplateManagement.deleteTemplate")
}}</el-button>
</div>
</template>
</el-table-column>
</el-table>
<!-- 表格底部操作栏 -->
<div class="table_bottom">
<div class="ctrl_btn">
<el-button
type="primary"
@click="handleSelectAll"
size="mini"
class="select-all-btn"
>
{{
isAllSelected
? $t("agentTemplateManagement.deselectAll")
: $t("agentTemplateManagement.selectAll")
}}
</el-button>
<el-button type="success" @click="showAddTemplateDialog" size="mini">
{{ $t("agentTemplateManagement.createTemplate") }}
</el-button>
<el-button
type="danger"
@click="batchDeleteTemplate"
:disabled="!hasSelected"
size="mini"
>
{{ $t("agentTemplateManagement.batchDelete") }}
</el-button>
</div>
<!-- 分页 -->
<div class="custom-pagination">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="pageSizeOptions"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handlePageSizeChange"
@current-change="handlePageChange"
/>
</div>
</div>
</el-card>
</div>
</div>
</div>
</div>
</template>
<script>
import HeaderBar from "@/components/HeaderBar";
import agentApi from "@/apis/module/agent";
export default {
name: "AgentTemplateManagement",
components: {
HeaderBar,
},
data() {
return {
// 模板相关
templateList: [],
templateLoading: false,
selectedTemplates: [],
isAllSelected: false, // 添加全选状态
search: "",
// 分页相关数据
pageSizeOptions: [10, 20, 50, 100],
currentPage: 1,
pageSize: 10,
total: 0,
};
},
created() {
this.loadTemplateList();
},
// 在computed部分添加hasSelected属性
computed: {
pageCount() {
return Math.ceil(this.total / this.pageSize);
},
visiblePages() {
return this.getVisiblePages();
},
hasSelected() {
return this.selectedTemplates.length > 0;
},
},
methods: {
// 加载模板列表
// 改进loadTemplateList方法的错误处理逻辑
loadTemplateList() {
this.templateLoading = true;
const params = {
page: this.currentPage,
limit: this.pageSize,
};
if (this.search) {
params.agentName = this.search;
}
try {
agentApi.getAgentTemplatesPage(
params,
(res) => {
// 更健壮的响应处理逻辑
if (res && typeof res === "object") {
if (res.data && res.data.code === 0) {
const responseData = res.data.data || {};
// 为每个模板添加selected属性
this.templateList = Array.isArray(responseData.list)
? responseData.list.map((item) => ({ ...item, selected: false }))
: [];
this.total =
typeof responseData.total === "number" ? responseData.total : 0;
} else {
this.templateList = [];
this.total = 0;
this.$message.error(
res?.data?.msg || this.$t("agentTemplateManagement.fetchTemplateFailed")
);
}
} else {
this.templateList = [];
this.total = 0;
this.$message.error(
this.$t("agentTemplateManagement.fetchTemplateBackendError")
);
}
this.templateLoading = false;
},
(error) => {
this.templateList = [];
this.total = 0;
this.templateLoading = false;
this.$message.error(this.$t("common.networkError"));
}
);
} catch (error) {
this.templateList = [];
this.total = 0;
this.templateLoading = false;
this.$message.error(this.$t("agentTemplateManagement.fetchTemplateBackendError"));
}
},
// 搜索模板
handleSearch() {
if (this.search) {
const searchValue = this.search.toLowerCase();
const filteredList = this.templateList.filter((template) =>
template.agentName.toLowerCase().includes(searchValue)
);
this.templateList = filteredList;
this.total = filteredList.length;
} else {
this.loadTemplateList();
}
},
// 修改showAddTemplateDialog方法,使其跳转到与编辑页面相同的页面
// 显示新增模板弹窗
showAddTemplateDialog() {
// 跳转到模板快速配置页面,不传递templateId参数表示新增
this.$router.push({
path: "/template-quick-config",
});
},
// 编辑模板
editTemplate(row) {
// 跳转到模板快速配置页面,并传递模板ID参数
this.$router.push({
path: "/template-quick-config",
query: { templateId: row.id },
});
},
// 删除模板
deleteTemplate(row) {
this.$confirm(
this.$t("agentTemplateManagement.confirmSingleDelete"),
this.$t("common.warning"),
{
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning",
}
)
.then(() => {
agentApi.deleteAgentTemplate(row.id, (res) => {
if (res && typeof res === "object") {
// 检查res.data是否存在且包含code=0
if (res.data && res.data.code === 0) {
this.$message.success(this.$t("agentTemplateManagement.deleteSuccess"));
this.loadTemplateList();
} else {
this.$message.error(
res?.data?.msg || this.$t("agentTemplateManagement.deleteFailed")
);
}
} else {
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
}
});
})
.catch(() => {
this.$message.info(this.$t("common.deleteCancelled"));
});
},
// 批量删除模板
batchDeleteTemplate() {
if (this.selectedTemplates.length === 0) {
this.$message.warning(this.$t("agentTemplateManagement.selectTemplate"));
return;
}
this.$confirm(
this.$t("agentTemplateManagement.confirmBatchDelete", {
count: this.selectedTemplates.length,
}),
this.$t("common.warning"),
{
confirmButtonText: this.$t("common.confirm"),
cancelButtonText: this.$t("common.cancel"),
type: "warning",
}
)
.then(() => {
// 确保参数格式正确 - 将id数组作为请求体
const ids = this.selectedTemplates.map((template) => template.id);
agentApi.batchDeleteAgentTemplate(ids, (res) => {
if (res && typeof res === "object") {
if (res.data && res.data.code === 0) {
this.$message.success(
this.$t("agentTemplateManagement.batchDeleteSuccess")
);
// 重新加载模板列表
this.loadTemplateList();
// 清空选中状态
this.selectedTemplates = [];
this.isAllSelected = false;
} else {
this.$message.error(
res?.data?.msg || this.$t("agentTemplateManagement.batchDeleteFailed")
);
}
} else {
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
}
});
})
.catch(() => {
this.$message.info(this.$t("common.deleteCancelled"));
});
},
// 完善分页相关方法
handlePageChange(page) {
this.currentPage = page;
this.loadTemplateList();
},
handlePageSizeChange(size) {
this.pageSize = size;
this.currentPage = 1;
this.loadTemplateList();
},
goFirst() {
this.currentPage = 1;
},
goPrev() {
this.currentPage--;
},
goNext() {
this.currentPage++;
},
goToPage(page) {
this.currentPage = page;
},
getVisiblePages() {
const pages = [];
const totalPages = this.pageCount;
const currentPage = this.currentPage;
if (totalPages <= 7) {
for (let i = 1; i <= totalPages; i++) {
pages.push(i);
}
} else {
if (currentPage <= 4) {
for (let i = 1; i <= 5; i++) {
pages.push(i);
}
pages.push("...");
pages.push(totalPages);
} else if (currentPage >= totalPages - 3) {
pages.push(1);
pages.push("...");
for (let i = totalPages - 4; i <= totalPages; i++) {
pages.push(i);
}
} else {
pages.push(1);
pages.push("...");
for (let i = currentPage - 1; i <= currentPage + 1; i++) {
pages.push(i);
}
pages.push("...");
pages.push(totalPages);
}
}
return pages;
},
// 修改handleSelectAll方法
handleSelectAll() {
this.isAllSelected = !this.isAllSelected;
this.templateList.forEach((row) => {
row.selected = this.isAllSelected;
});
// 更新选中的模板列表
this.selectedTemplates = this.isAllSelected ? [...this.templateList] : [];
},
// 处理行选择变化
handleRowSelectionChange(row) {
// 查找选中的模板
this.selectedTemplates = this.templateList.filter((template) => template.selected);
// 更新全选状态
this.isAllSelected =
this.templateList.length > 0 &&
this.selectedTemplates.length === this.templateList.length;
},
},
};
</script>
<style scoped lang="scss">
/* 基础背景和布局设置 */
.welcome {
min-height: 100vh;
display: flex;
flex-direction: column;
position: relative;
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
background-size: cover;
overflow: hidden;
width: 100%;
}
/* 操作栏样式 */
.operation-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 24px;
}
.page-title {
font-size: 24px;
margin: 0;
}
.right-operations {
display: flex;
align-items: center;
gap: 10px;
}
.search-input {
width: 200px;
}
.btn-search {
background: linear-gradient(135deg, #6b8cff, #a966ff);
border: none;
color: white;
}
/* 主容器样式 */
.main-wrapper {
margin: 5px 22px;
border-radius: 15px;
min-height: calc(100vh - 24vh);
height: auto;
max-height: 80vh;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
position: relative;
background: rgba(237, 242, 255, 0.5);
display: flex;
flex-direction: column;
}
.content-panel {
width: 100%;
flex: 1;
display: flex;
overflow: hidden;
border-radius: 15px;
background: transparent;
border: 1px solid #fff;
}
.content-area {
flex: 1;
min-width: 600px;
overflow-x: auto;
background-color: white;
display: flex;
flex-direction: column;
position: relative;
}
/* 模板卡片样式 */
.template-card {
border: none;
box-shadow: none;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
:deep(.el-card__body) {
padding: 15px;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
}
/* 表格样式 - 优化整合版 */
.transparent-table {
width: 100%;
flex: 1;
min-height: 0;
}
:deep(.el-table) {
height: 100%;
display: flex;
flex-direction: column;
--table-max-height: calc(100vh - 42vh);
max-height: var(--table-max-height);
/* 表格头部样式 */
.el-table__header th {
padding: 8px 0 !important;
height: 40px !important;
}
.el-table__header th .cell {
color: #303133 !important;
font-weight: 600;
}
/* 表格主体样式 */
.el-table__body {
.el-table__row td {
padding: 12px 0 !important;
border-bottom: 1px solid #ebeef5;
}
.el-table__row:hover {
background-color: #f5f7fa;
}
}
/* 表格按钮样式 */
.el-button--text {
color: #7079aa;
}
.el-button--text:hover {
color: #5a64b5;
}
/* 单元格文本样式 */
.cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
/* 表格底部操作栏 */
.table_bottom {
display: flex;
justify-content: space-between !important;
align-items: center;
margin-top: auto;
padding: 0 20px 15px !important;
width: 100% !important;
box-sizing: border-box !important;
}
/* 控制按钮样式 */
.ctrl_btn {
display: flex;
gap: 8px;
padding-left: 0 !important;
margin-left: 0 !important;
.el-button {
min-width: 72px;
height: 32px;
padding: 7px 12px 7px 10px;
font-size: 12px;
border-radius: 4px;
line-height: 1;
font-weight: 500;
border: none;
transition: all 0.3s ease;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
&:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
}
.el-button--primary {
background: #5f70f3;
color: white;
}
.el-button--success {
background: #5bc98c;
color: white;
}
.el-button--danger {
background: #fd5b63;
color: white;
}
}
</style>
@@ -0,0 +1,478 @@
<template>
<div class="welcome">
<HeaderBar />
<div class="operation-bar">
<h2 class="page-title">{{ $t('templateQuickConfig.title') }}</h2>
</div>
<div class="main-wrapper">
<div class="content-panel">
<div class="content-area">
<el-card class="config-card" shadow="never">
<div class="config-header">
<!-- 使用角色配置页面相同的彩色图标效果 -->
<div class="header-icon">
<img loading="lazy" src="@/assets/home/setting-user.png" alt="">
</div>
<span class="header-title">{{ form.agentName }}</span>
<div class="header-actions">
<el-button type="primary" class="save-btn" @click="saveConfig">{{ $t('templateQuickConfig.saveConfig') }}</el-button>
<el-button class="reset-btn" @click="resetConfig">{{ $t('templateQuickConfig.resetConfig') }}</el-button>
<button class="custom-close-btn" @click="goToHome">
×
</button>
</div>
</div>
<div class="divider"></div>
<el-form ref="form" :model="form" label-width="72px" class="full-height-form">
<!-- 助手昵称 -->
<el-form-item :label="$t('templateQuickConfig.agentSettings.agentName')" prop="agentName" class="nickname-item">
<el-input
v-model="form.agentName"
:placeholder="$t('templateQuickConfig.agentSettings.agentNamePlaceholder')"
:validate-event="false"
class="form-input"
/>
</el-form-item>
<!-- 角色介绍 -->
<el-form-item :label="$t('templateQuickConfig.agentSettings.systemPrompt')" prop="systemPrompt" class="description-item">
<el-input
v-model="form.systemPrompt"
type="textarea"
:placeholder="$t('templateQuickConfig.agentSettings.systemPromptPlaceholder')"
:validate-event="false"
show-word-limit
maxlength="2000"
/>
</el-form-item>
</el-form>
</el-card>
</div>
</div>
</div>
</div>
</template>
<script>
import HeaderBar from "@/components/HeaderBar.vue";
import agentApi from '@/apis/module/agent';
// 默认模型配置常量
const DEFAULT_MODEL_CONFIG = {
ttsModelId: "TTS_EdgeTTS",
vadModelId: "VAD_SileroVAD",
asrModelId: "ASR_FunASR",
llmModelId: "LLM_ChatGLMLLM",
vllmModelId: "VLLM_ChatGLMVLLM",
memModelId: "Memory_nomem",
intentModelId: "Intent_function_call"
};
export default {
name: 'TemplateQuickConfig',
components: { HeaderBar },
data() {
return {
form: {
agentCode: "小智",
agentName: "",
systemPrompt: "",
sort: 0,
model: { ...DEFAULT_MODEL_CONFIG }
},
templateId: '',
originalForm: null
};
},
methods: {
// 返回模板管理页面
goToHome() {
this.$router.push('/agent-template-management');
},
// 保存配置
saveConfig() {
const configData = this.prepareConfigData();
if (this.templateId) {
this.updateExistingTemplate(configData);
} else {
this.createNewTemplate(configData);
}
},
// 准备配置数据
prepareConfigData() {
return {
id: this.templateId || '',
agentCode: this.form.agentCode,
agentName: this.form.agentName,
systemPrompt: this.form.systemPrompt,
sort: this.form.sort,
functions: [],
// 包含必要的模型字段以确保API调用成功
...this.form.model
};
},
// 更新现有模板
updateExistingTemplate(configData) {
agentApi.updateAgentTemplate(configData, (res) => {
if (res && res.data && res.data.code === 0) {
this.$message.success({
message: this.$t('templateQuickConfig.saveSuccess'),
showClose: true
});
this.originalForm = JSON.parse(JSON.stringify(this.form));
} else {
this.$message.error({
message: res?.data?.msg || this.$t('templateQuickConfig.saveFailed'),
showClose: true
});
}
});
},
// 创建新模板
createNewTemplate(configData) {
agentApi.addAgentTemplate(configData, (res) => {
if (res && res.data && res.data.code === 0) {
this.$message.success({
message: this.$t('templateQuickConfig.saveSuccess'),
showClose: true
});
this.goToHome();
} else {
this.$message.error({
message: res?.data?.msg || this.$t('templateQuickConfig.saveFailed'),
showClose: true
});
}
});
},
// 重置配置
resetConfig() {
this.$confirm(
this.$t('templateQuickConfig.confirmReset'),
this.$t('common.tip'),
{
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
type: 'warning'
}
).then(() => {
if (this.originalForm) {
this.form = JSON.parse(JSON.stringify(this.originalForm));
}
this.$message.success({
message: this.$t('templateQuickConfig.resetSuccess'),
showClose: true
});
}).catch(() => {});
},
// 根据ID获取模板
fetchTemplateById(templateId) {
agentApi.getAgentTemplateById(templateId, (res) => {
if (res && res.data && res.data.code === 0 && res.data.data) {
const template = res.data.data;
this.applyTemplateData(template);
this.templateId = templateId;
this.originalForm = JSON.parse(JSON.stringify(this.form));
} else {
this.$message.error(res?.data?.msg || this.$t('templateQuickConfig.templateNotFound'));
}
});
},
// 应用模板数据
applyTemplateData(templateData) {
this.form = {
...this.form,
agentName: templateData.agentName || this.form.agentName,
agentCode: templateData.agentCode || this.form.agentCode,
systemPrompt: templateData.systemPrompt || this.form.systemPrompt,
sort: templateData.sort || this.form.sort,
model: {
ttsModelId: templateData.ttsModelId || this.form.model.ttsModelId,
vadModelId: templateData.vadModelId || this.form.model.vadModelId,
asrModelId: templateData.asrModelId || this.form.model.asrModelId,
llmModelId: templateData.llmModelId || this.form.model.llmModelId,
vllmModelId: templateData.vllmModelId || this.form.model.vllmModelId,
memModelId: templateData.memModelId || this.form.model.memModelId,
intentModelId: templateData.intentModelId || this.form.model.intentModelId
}
};
},
// 设置默认模板值
setDefaultTemplateValues() {
this.form = {
...this.form,
agentName: this.$t('templateQuickConfig.newTemplate'),
agentCode: '小智',
systemPrompt: '',
sort: 1
};
this.originalForm = JSON.parse(JSON.stringify(this.form));
},
// 获取模板列表并设置排序号
fetchTemplateListForSort() {
agentApi.getAgentTemplate((res) => {
if (res && res.data && res.data.code === 0) {
const templateList = res.data.data || [];
if (templateList.length > 0) {
const maxSort = Math.max(...templateList.map(t => t.sort || 0));
this.form.sort = maxSort + 1;
} else {
this.form.sort = 1;
}
} else {
this.form.sort = 1;
}
this.originalForm = JSON.parse(JSON.stringify(this.form));
});
}
},
// 组件挂载时执行初始化
mounted() {
const templateId = this.$route.query.templateId;
if (templateId) {
// 编辑模式:加载现有模板
this.fetchTemplateById(templateId);
} else {
// 新建模式:设置默认值并获取排序号
this.form.agentName = this.$t('templateQuickConfig.newTemplate');
this.fetchTemplateListForSort();
}
}
};
</script>
<style scoped>
.welcome {
min-width: 900px;
height: 100vh;
display: flex;
position: relative;
flex-direction: column;
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd);
background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
overflow: hidden;
}
.operation-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5vh 24px;
}
.page-title {
font-size: 24px;
margin: 0;
color: #2c3e50;
}
.main-wrapper {
margin: 1vh 22px;
border-radius: 15px;
height: calc(100vh - 24vh);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
position: relative;
background: rgba(237, 242, 255, 0.5);
display: flex;
flex-direction: column;
padding: 0 !important;
}
.content-panel {
flex: 1;
display: flex;
overflow: hidden;
height: 100%;
border-radius: 15px;
background: transparent;
border: 1px solid #fff;
}
.content-area {
flex: 1;
height: 100%;
overflow: auto;
background-color: white;
display: flex;
flex-direction: column;
}
.config-card {
background: white !important;
border-radius: 15px !important;
overflow: hidden !important;
height: 100% !important;
margin: 0 !important;
border: none !important;
box-shadow: none !important;
}
.full-height-form {
display: flex;
flex-direction: column;
padding: 20px;
gap: 20px;
height: calc(100% - 120px);
}
.nickname-item {
margin-bottom: 0 !important;
}
.description-item {
margin-bottom: 0 !important;
display: flex;
flex-direction: column;
}
::v-deep .description-item .el-textarea {
height: 300px;
min-height: 200px;
max-height: 400px;
display: flex;
flex-direction: column;
}
::v-deep .description-item .el-textarea__inner {
height: 100% !important;
min-height: 200px !important;
max-height: 400px !important;
resize: vertical !important;
line-height: 1.6;
font-size: 14px;
padding: 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #fff;
color: #303133;
}
::v-deep .el-form-item__label {
font-size: 12px !important;
color: #3d4566 !important;
font-weight: 400;
line-height: 22px;
padding-bottom: 2px;
}
::v-deep .el-textarea .el-input__count {
color: #909399;
background: rgba(255, 255, 255, 0.8);
position: absolute;
font-size: 12px;
right: 10px;
bottom: 10px;
padding: 2px 5px;
border-radius: 3px;
}
.config-header {
padding: 20px;
display: flex;
align-items: center;
gap: 15px;
background: #f8f9ff;
position: relative;
}
.header-icon {
width: 37px;
height: 37px;
background: #5778ff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.header-icon img {
width: 19px;
height: 19px;
}
.header-title {
font-size: 20px;
font-weight: 600;
color: #2c3e50;
}
.custom-close-btn {
position: absolute;
top: 25%;
right: 0;
transform: translateY(-50%);
width: 35px;
height: 35px;
border-radius: 50%;
border: 2px solid #cfcfcf;
background: none;
font-size: 30px;
font-weight: lighter;
color: #cfcfcf;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
padding: 0;
outline: none;
}
.custom-close-btn:hover {
color: #409EFF;
border-color: #409EFF;
}
.header-actions {
display: flex;
align-items: center;
gap: 8px;
margin-left: auto;
}
.header-actions .save-btn {
background: #5778ff;
color: white;
border: none;
border-radius: 18px;
padding: 8px 16px;
height: 32px;
font-size: 14px;
}
.header-actions .reset-btn {
background: #e6ebff;
color: #5778ff;
border: 1px solid #adbdff;
border-radius: 18px;
padding: 8px 16px;
height: 32px;
}
.header-actions .custom-close-btn {
position: static;
transform: none;
width: 32px;
height: 32px;
margin-left: 8px;
}
</style>
+1 -1
View File
@@ -5,7 +5,7 @@ from config.config_loader import load_config
from config.settings import check_config_file
from datetime import datetime
SERVER_VERSION = "0.8.2"
SERVER_VERSION = "0.8.3"
_logger_initialized = False