mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
tables are translated
This commit is contained in:
parent
25b24261b9
commit
e6704657fd
53 changed files with 2046 additions and 585 deletions
|
|
@ -232,7 +232,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| 意图识别系统 | 支持LLM意图识别、Function Call函数调用,提供插件化意图处理机制 |
|
| 意图识别系统 | 支持LLM意图识别、Function Call函数调用,提供插件化意图处理机制 |
|
||||||
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆,具备记忆总结功能 |
|
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆,具备记忆总结功能 |
|
||||||
| 工具调用 | 支持客户端IOT协议、客户MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
| 工具调用 | 支持客户端IOT协议、客户MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
||||||
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和设备管理 |
|
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和Device Management |
|
||||||
| 测试工具 | 提供性能测试工具、视觉模型测试工具和音频交互测试工具 |
|
| 测试工具 | 提供性能测试工具、视觉模型测试工具和音频交互测试工具 |
|
||||||
| 部署支持 | 支持Docker部署和本地部署,提供完整的配置文件管理 |
|
| 部署支持 | 支持Docker部署和本地部署,提供完整的配置文件管理 |
|
||||||
| 插件系统 | 支持功能插件扩展、自定义插件开发和插件热加载 |
|
| 插件系统 | 支持功能插件扩展、自定义插件开发和插件热加载 |
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ xiaozhi-esp32-server
|
||||||
* **关键实现细节:**
|
* **关键实现细节:**
|
||||||
|
|
||||||
1. **模块化项目结构 (`modules/` 包):**
|
1. **模块化项目结构 (`modules/` 包):**
|
||||||
* `manager-api` 的核心业务逻辑被清晰地划分到 `src/main/java/xiaozhi/modules/` 目录下的不同模块中。这种按功能领域划分模块的方式(例如 `sys` 负责系统管理,`agent` 负责智能体配置,`device` 负责设备管理,`config` 负责为`xiaozhi-server`提供配置,`security` 负责安全,`timbre` 负责音色管理,`ota` 负责固件升级)极大地提高了代码的可维护性和可扩展性。
|
* `manager-api` 的核心业务逻辑被清晰地划分到 `src/main/java/xiaozhi/modules/` 目录下的不同模块中。这种按功能领域划分模块的方式(例如 `sys` 负责系统管理,`agent` 负责智能体配置,`device` 负责Device Management,`config` 负责为`xiaozhi-server`提供配置,`security` 负责安全,`timbre` 负责音色管理,`ota` 负责固件升级)极大地提高了代码的可维护性和可扩展性。
|
||||||
* **各模块内部结构:** 每个业务模块通常遵循经典的三层架构或其变体:
|
* **各模块内部结构:** 每个业务模块通常遵循经典的三层架构或其变体:
|
||||||
* **Controller (控制层):** 位于 `xiaozhi.modules.[模块名].controller`。
|
* **Controller (控制层):** 位于 `xiaozhi.modules.[模块名].controller`。
|
||||||
* **Service (服务层):** 位于 `xiaozhi.modules.[模块名].service`。
|
* **Service (服务层):** 位于 `xiaozhi.modules.[模块名].service`。
|
||||||
|
|
@ -257,7 +257,7 @@ xiaozhi-esp32-server
|
||||||
* 用户界面由一系列可复用的Vue组件 (`.vue` 单文件组件) 构成,形成一个组件树。这种方式提高了代码的模块化程度、可维护性和复用性。
|
* 用户界面由一系列可复用的Vue组件 (`.vue` 单文件组件) 构成,形成一个组件树。这种方式提高了代码的模块化程度、可维护性和复用性。
|
||||||
* **`src/main.js`:** 应用的入口JS文件。它负责创建和初始化根Vue实例,注册全局插件(如Vue Router, Vuex, Element UI),并把根Vue实例挂载到 `public/index.html` 中的某个DOM元素上(通常是 `#app`)。
|
* **`src/main.js`:** 应用的入口JS文件。它负责创建和初始化根Vue实例,注册全局插件(如Vue Router, Vuex, Element UI),并把根Vue实例挂载到 `public/index.html` 中的某个DOM元素上(通常是 `#app`)。
|
||||||
* **`src/App.vue`:** 应用的根组件。它通常定义了应用的基础布局结构(如包含导航栏、侧边栏、主内容区),并通过 `<router-view></router-view>` 标签来显示当前路由匹配到的视图组件。
|
* **`src/App.vue`:** 应用的根组件。它通常定义了应用的基础布局结构(如包含导航栏、侧边栏、主内容区),并通过 `<router-view></router-view>` 标签来显示当前路由匹配到的视图组件。
|
||||||
* **视图组件 (`src/views/`):** 这些组件代表了应用中的各个“页面”或主要功能区(例如 `Login.vue` 登录页, `DeviceManagement.vue` 设备管理页, `UserManagement.vue` 用户管理页, `ModelConfig.vue` 模型配置页)。它们通常由Vue Router直接映射。
|
* **视图组件 (`src/views/`):** 这些组件代表了应用中的各个“页面”或主要功能区(例如 `Login.vue` 登录页, `DeviceManagement.vue` Device Management页, `UserManagement.vue` 用户管理页, `ModelConfig.vue` 模型配置页)。它们通常由Vue Router直接映射。
|
||||||
* **可复用UI组件 (`src/components/`):** 包含了在不同视图之间共享的、更小粒度的UI组件(例如 `HeaderBar.vue` 顶部导航栏, `AddDeviceDialog.vue` 添加设备对话框, `AudioPlayer.vue` 音频播放器组件)。
|
* **可复用UI组件 (`src/components/`):** 包含了在不同视图之间共享的、更小粒度的UI组件(例如 `HeaderBar.vue` 顶部导航栏, `AddDeviceDialog.vue` 添加设备对话框, `AudioPlayer.vue` 音频播放器组件)。
|
||||||
|
|
||||||
3. **客户端路由 (`src/router/index.js`):**
|
3. **客户端路由 (`src/router/index.js`):**
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import xiaozhi.modules.agent.vo.AgentVoicePrintVO;
|
||||||
import xiaozhi.modules.security.user.SecurityUser;
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
import xiaozhi.modules.sys.service.SysParamsService;
|
import xiaozhi.modules.sys.service.SysParamsService;
|
||||||
|
|
||||||
@Tag(name = "智能体声纹管理")
|
@Tag(name = "Agent Voice Print Management")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/agent/voice-print")
|
@RequestMapping("/agent/voice-print")
|
||||||
|
|
@ -35,18 +35,18 @@ public class AgentVoicePrintController {
|
||||||
private final SysParamsService sysParamsService;
|
private final SysParamsService sysParamsService;
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "创建智能体的声纹")
|
@Operation(summary = "Create agent voice print")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> save(@RequestBody @Valid AgentVoicePrintSaveDTO dto) {
|
public Result<Void> save(@RequestBody @Valid AgentVoicePrintSaveDTO dto) {
|
||||||
boolean b = agentVoicePrintService.insert(dto);
|
boolean b = agentVoicePrintService.insert(dto);
|
||||||
if (b) {
|
if (b) {
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
return new Result<Void>().error("智能体的声纹创建失败");
|
return new Result<Void>().error("Failed to create agent voice print");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Operation(summary = "更新智能体的对应声纹")
|
@Operation(summary = "Update agent voice print")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> update(@RequestBody @Valid AgentVoicePrintUpdateDTO dto) {
|
public Result<Void> update(@RequestBody @Valid AgentVoicePrintUpdateDTO dto) {
|
||||||
Long userId = SecurityUser.getUserId();
|
Long userId = SecurityUser.getUserId();
|
||||||
|
|
@ -54,29 +54,29 @@ public class AgentVoicePrintController {
|
||||||
if (b) {
|
if (b) {
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
return new Result<Void>().error("智能体的对应声纹更新失败");
|
return new Result<Void>().error("Failed to update agent voice print");
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@Operation(summary = "删除智能体对应声纹")
|
@Operation(summary = "Delete agent voice print")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> delete(@PathVariable String id) {
|
public Result<Void> delete(@PathVariable String id) {
|
||||||
Long userId = SecurityUser.getUserId();
|
Long userId = SecurityUser.getUserId();
|
||||||
// 先删除关联的设备
|
// First delete associated devices
|
||||||
boolean delete = agentVoicePrintService.delete(userId, id);
|
boolean delete = agentVoicePrintService.delete(userId, id);
|
||||||
if (delete) {
|
if (delete) {
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
return new Result<Void>().error("智能体的对应声纹删除失败");
|
return new Result<Void>().error("Failed to delete agent voice print");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list/{id}")
|
@GetMapping("/list/{id}")
|
||||||
@Operation(summary = "获取用户指定智能体声纹列表")
|
@Operation(summary = "Get user specified agent voice print list")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<List<AgentVoicePrintVO>> list(@PathVariable String id) {
|
public Result<List<AgentVoicePrintVO>> list(@PathVariable String id) {
|
||||||
String voiceprintUrl = sysParamsService.getValue("server.voice_print", true);
|
String voiceprintUrl = sysParamsService.getValue("server.voice_print", true);
|
||||||
if (StringUtils.isBlank(voiceprintUrl) || "null".equals(voiceprintUrl)) {
|
if (StringUtils.isBlank(voiceprintUrl) || "null".equals(voiceprintUrl)) {
|
||||||
throw new RenException("声纹接口未配置,请先在参数配置中配置声纹接口地址(server.voice_print)");
|
throw new RenException("Voice print interface not configured, please configure the voice print interface address in parameter settings (server.voice_print)");
|
||||||
}
|
}
|
||||||
Long userId = SecurityUser.getUserId();
|
Long userId = SecurityUser.getUserId();
|
||||||
List<AgentVoicePrintVO> list = agentVoicePrintService.list(userId, id);
|
List<AgentVoicePrintVO> list = agentVoicePrintService.list(userId, id);
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,11 @@ public class ConfigServiceImpl implements ConfigService {
|
||||||
null,
|
null,
|
||||||
agent.getVadModelId(),
|
agent.getVadModelId(),
|
||||||
agent.getAsrModelId(),
|
agent.getAsrModelId(),
|
||||||
null,
|
agent.getLlmModelId(), // Add this
|
||||||
null,
|
agent.getVllmModelId(), // Add this
|
||||||
null,
|
agent.getTtsModelId(), // Add this
|
||||||
null,
|
agent.getMemModelId(), // Add this
|
||||||
null,
|
agent.getIntentModelId(), // Add this
|
||||||
result,
|
result,
|
||||||
isCache);
|
isCache);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import xiaozhi.modules.device.entity.DeviceEntity;
|
||||||
import xiaozhi.modules.device.service.DeviceService;
|
import xiaozhi.modules.device.service.DeviceService;
|
||||||
import xiaozhi.modules.security.user.SecurityUser;
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
|
|
||||||
@Tag(name = "设备管理")
|
@Tag(name = "Device Management")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/device")
|
@RequestMapping("/device")
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import xiaozhi.modules.device.entity.DeviceEntity;
|
||||||
import xiaozhi.modules.device.service.DeviceService;
|
import xiaozhi.modules.device.service.DeviceService;
|
||||||
import xiaozhi.modules.sys.service.SysParamsService;
|
import xiaozhi.modules.sys.service.SysParamsService;
|
||||||
|
|
||||||
@Tag(name = "设备管理", description = "OTA 相关接口")
|
@Tag(name = "Device Management", description = "OTA 相关接口")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import xiaozhi.common.validator.ValidatorUtils;
|
||||||
import xiaozhi.modules.device.entity.OtaEntity;
|
import xiaozhi.modules.device.entity.OtaEntity;
|
||||||
import xiaozhi.modules.device.service.OtaService;
|
import xiaozhi.modules.device.service.OtaService;
|
||||||
|
|
||||||
@Tag(name = "设备管理", description = "OTA 相关接口")
|
@Tag(name = "Device Management", description = "OTA 相关接口")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
|
||||||
|
|
@ -315,12 +315,15 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
||||||
String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true);
|
String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true);
|
||||||
code.setMessage(frontedUrl + "\n" + cachedCode);
|
code.setMessage(frontedUrl + "\n" + cachedCode);
|
||||||
code.setChallenge(deviceId);
|
code.setChallenge(deviceId);
|
||||||
|
log.info("📱 Device {} requesting activation - Using cached code: {}", deviceId, cachedCode);
|
||||||
} else {
|
} else {
|
||||||
String newCode = RandomUtil.randomNumbers(6);
|
String newCode = RandomUtil.randomNumbers(6);
|
||||||
code.setCode(newCode);
|
code.setCode(newCode);
|
||||||
String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true);
|
String frontedUrl = sysParamsService.getValue(Constant.SERVER_FRONTED_URL, true);
|
||||||
code.setMessage(frontedUrl + "\n" + newCode);
|
code.setMessage(frontedUrl + "\n" + newCode);
|
||||||
code.setChallenge(deviceId);
|
code.setChallenge(deviceId);
|
||||||
|
log.info("🔐 Generated NEW activation code for device {}: {}", deviceId, newCode);
|
||||||
|
log.info("📱 Please bind device using code: {} at {}", newCode, frontedUrl);
|
||||||
|
|
||||||
Map<String, Object> dataMap = new HashMap<>();
|
Map<String, Object> dataMap = new HashMap<>();
|
||||||
dataMap.put("id", deviceId);
|
dataMap.put("id", deviceId);
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ const tabList = [
|
||||||
activeIcon: '/static/tabbar/robot_activate.png',
|
activeIcon: '/static/tabbar/robot_activate.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '设备管理',
|
label: 'Device Management',
|
||||||
value: 'category',
|
value: 'category',
|
||||||
icon: '/static/tabbar/device.png',
|
icon: '/static/tabbar/device.png',
|
||||||
activeIcon: '/static/tabbar/device_activate.png',
|
activeIcon: '/static/tabbar/device_activate.png',
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ const tabList = [
|
||||||
activeIcon: '/static/tabbar/robot_activate.png',
|
activeIcon: '/static/tabbar/robot_activate.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '设备管理',
|
label: 'Device Management',
|
||||||
value: 'device-management',
|
value: 'device-management',
|
||||||
icon: '/static/tabbar/device.png',
|
icon: '/static/tabbar/device.png',
|
||||||
activeIcon: '/static/tabbar/device_activate.png',
|
activeIcon: '/static/tabbar/device_activate.png',
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ onShow(() => {
|
||||||
<view class="stat-chip">
|
<view class="stat-chip">
|
||||||
<wd-icon name="phone" custom-class="chip-icon" />
|
<wd-icon name="phone" custom-class="chip-icon" />
|
||||||
<text class="chip-text">
|
<text class="chip-text">
|
||||||
设备管理({{ agent.deviceCount }})
|
Device Management({{ agent.deviceCount }})
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="agent.lastConnectedAt" class="stat-chip">
|
<view v-if="agent.lastConnectedAt" class="stat-chip">
|
||||||
|
|
|
||||||
|
|
@ -220,9 +220,9 @@ async function clearCache() {
|
||||||
function showAbout() {
|
function showAbout() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: `关于${import.meta.env.VITE_APP_TITLE}`,
|
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`,
|
content: `${import.meta.env.VITE_APP_TITLE}\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供Device Management、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server`,
|
||||||
title: `关于小智智控台`,
|
title: `关于小智智控台`,
|
||||||
content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供设备管理、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.7.5`,
|
content: `小智智控台\n\n基于 Vue.js 3 + uni-app 构建的跨平台移动端管理应用,为小智ESP32智能硬件提供Device Management、智能体配置等功能。\n\n© 2025 xiaozhi-esp32-server 0.7.5`,
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
confirmText: '确定',
|
confirmText: '确定',
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
33
main/manager-web/src/assets/xiaozhi-logo.svg
Normal file
33
main/manager-web/src/assets/xiaozhi-logo.svg
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg id="Layer_2" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 294.92 113.13">
|
||||||
|
<defs>
|
||||||
|
<style>
|
||||||
|
.cls-1 {
|
||||||
|
fill: #ffbe06;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cls-2 {
|
||||||
|
fill: #d61a1a;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<g id="Layer_1-2" data-name="Layer 1">
|
||||||
|
<g>
|
||||||
|
<path class="cls-2" d="M287.57,20.27l-6.67-3c-1.32-.59-2.36-1.65-2.93-2.99l-2.87-6.73c-1.96-4.59-6.46-7.56-11.45-7.56s-9.35,2.89-11.36,7.35l-2.99,6.67c-.59,1.32-1.65,2.36-2.99,2.93l-6.73,2.87c-3.13,1.34-5.51,3.86-6.7,6.91-2.34.43-4.7,1.2-7.05,2.3-2.31,1.09-4.5,2.51-6.54,4.24-.9-1.03-1.93-2.01-3.11-2.93-3.53-2.8-7.35-4.22-11.34-4.22-3.18,0-6.3.92-9.02,2.67-.67.43-1.32.9-1.96,1.41-.06-.05-.13-.11-.19-.16-3.12-2.6-7.12-3.91-11.9-3.91s-8.43,1.22-11.43,3.62c-1.4-1.79-3.15-3.31-5.21-4.52-2.06-1.21-4.4-2.1-6.96-2.65-2.15-.46-4.46-.69-6.88-.69-3.22,0-6.45.45-9.6,1.35-3.17.9-6.08,2.33-8.68,4.24-.93-.84-1.96-1.59-3.09-2.26-2.06-1.21-4.4-2.1-6.95-2.64-2.15-.46-4.46-.69-6.88-.69-3.22,0-6.45.45-9.6,1.35-3.64,1.03-6.95,2.76-9.81,5.13-1.11.92-2.14,1.93-3.09,3.04-2.88-1.94-6.42-2.93-10.55-2.93-4.49,0-8.27,1.18-11.26,3.51-3.04-2.33-6.87-3.51-11.4-3.51-5.06,0-9.21,1.48-12.33,4.39-.07.07-.13.14-.2.2-.4-.26-.8-.51-1.22-.75-4.43-2.55-9.85-3.84-16.11-3.84-5.49,0-10.33,1.03-14.37,3.08-4.14,2.09-7.52,4.99-10.06,8.62-2.33,3.33-3.98,7.2-4.91,11.5-.78,3.63-1.18,7.52-1.18,11.55,0,11.06,2.61,19.99,7.77,26.55,5.7,7.26,13.98,11.1,23.93,11.1,4.78,0,9.07-.87,12.74-2.59.96-.45,1.88-.95,2.76-1.48,1.48,1.18,3.2,2.13,5.13,2.83,2.31.84,4.87,1.24,7.84,1.24,4.55,0,8.28-.94,11.37-2.86,3.03,1.92,6.73,2.86,11.29,2.86s8.49-1.02,11.59-3.04c.55-.36,1.08-.74,1.58-1.15,3.79,4.5,8.66,8.26,14.4,11.05,7.23,3.52,15.47,5.38,23.83,5.38.27,0,.55,0,.82,0,8.85,0,18.05-2.28,25.24-6.26,4.9-2.71,8.89-6.19,11.82-10.24.52.24,1.04.46,1.6.66,2.31.84,4.87,1.24,7.84,1.24,4.7,0,8.51-1,11.66-3.04.34-.22.67-.45.99-.68.69.56,1.42,1.08,2.18,1.55,2.64,1.62,5.63,2.45,8.87,2.45s6.41-.87,9.74-2.58c1.59-.81,3.01-1.72,4.26-2.71,1.99,1.37,4.15,2.48,6.48,3.3,3.65,1.28,7.64,1.94,11.87,1.94s8.26-.67,11.85-1.98c4.03-1.47,7.54-3.8,10.43-6.93,2.8-3.03,4.92-6.77,6.31-11.15,1.23-3.9,1.86-8.42,1.86-13.45,0-1.11-.04-2.19-.1-3.26,2.92-1.18,5.36-3.45,6.69-6.43l2.99-6.67c.59-1.32,1.65-2.36,2.99-2.93l6.73-2.87c4.55-1.94,7.51-6.39,7.56-11.33.04-4.94-2.84-9.44-7.35-11.47Z"/>
|
||||||
|
<g>
|
||||||
|
<path class="cls-1" d="M47.01,66.45c-1.29-1.55-2.91-2.64-4.85-3.29-1.2-.37-2.24-.55-3.12-.55-1.52,0-2.84.52-3.95,1.56-1.11,1.04-1.96,2.69-2.56,4.95-.79,2.82-1.8,4.23-3.05,4.23-.42,0-.87-.18-1.35-.55-.49-.37-.92-.98-1.32-1.84-.39-.85-.73-1.95-1-3.29-.28-1.34-.42-2.98-.42-4.92,0-.97.06-2.14.17-3.5.11-1.36.33-2.64.66-3.85.32-1.2.78-2.23,1.39-3.08.6-.85,1.39-1.28,2.36-1.28.55,0,1.07.22,1.56.66.49.44.77,1.4.87,2.88.09,1.89.58,3.16,1.46,3.81.88.65,2.15.86,3.81.62,1.43-.18,2.75-.59,3.95-1.21,1.2-.62,2.21-1.42,3.01-2.39.81-.97,1.37-2.05,1.7-3.26.32-1.2.32-2.49,0-3.88-.65-2.72-2.36-4.88-5.13-6.48-2.77-1.59-6.33-2.39-10.67-2.39-3.79,0-6.94.64-9.46,1.91-2.52,1.27-4.53,2.98-6.03,5.13-1.5,2.15-2.56,4.67-3.19,7.55-.62,2.89-.94,5.97-.94,9.25,0,8.59,1.81,15.2,5.44,19.82,3.63,4.62,8.74,6.93,15.35,6.93,3.19,0,5.89-.52,8.11-1.56,2.22-1.04,4.02-2.37,5.4-3.98,1.39-1.62,2.38-3.42,2.98-5.4.6-1.99.88-3.93.83-5.82-.05-2.96-.72-5.21-2.01-6.76Z"/>
|
||||||
|
<path class="cls-1" d="M91.56,75.49c-.51-3.33-.85-6.99-1.04-10.98-.19-3.99-.16-8,.07-12.02.09-1.2.15-2.55.17-4.05.02-1.5-.17-2.92-.59-4.26-.42-1.34-1.17-2.47-2.25-3.39-1.09-.92-2.71-1.39-4.88-1.39s-3.79.48-4.85,1.45c-1.06.97-1.77,2.18-2.11,3.64-.35,1.45-.47,3.05-.38,4.78.09,1.73.18,3.38.28,4.95.09,1.2-.23,2.17-.97,2.91-.74.74-1.73,1.11-2.98,1.11-1.43,0-2.47-.4-3.12-1.21-.65-.81-.97-1.88-.97-3.22l.07-.9v-.42c.09-1.2.15-2.55.17-4.05.02-1.5-.17-2.92-.59-4.26-.42-1.34-1.18-2.47-2.29-3.39-1.11-.92-2.75-1.39-4.92-1.39s-3.85.48-4.88,1.45c-1.04.97-1.73,2.19-2.08,3.67-.35,1.48-.47,3.08-.38,4.82.09,1.73.18,3.38.28,4.95.23,3.09.24,6.69.03,10.77s-.64,8.46-1.28,13.13c-.09.69-.2,1.47-.31,2.32-.12.85-.15,1.72-.1,2.6.05.88.21,1.72.48,2.53.28.81.73,1.54,1.35,2.18.62.65,1.48,1.17,2.56,1.56,1.08.39,2.46.59,4.12.59,2.49,0,4.4-.43,5.72-1.28,1.32-.85,2.24-1.96,2.77-3.33.53-1.36.77-2.91.73-4.64-.05-1.73-.21-3.48-.48-5.23-.09-.42-.16-.85-.21-1.32-.05-.46-.09-.92-.14-1.39-.09-1.11.16-2,.76-2.67.6-.67,1.46-1,2.56-1,1.2,0,2.09.34,2.67,1,.58.67.82,1.56.73,2.67-.09.92-.18,1.83-.28,2.7-.09.88-.21,1.78-.35,2.7-.14,1.02-.27,2.21-.38,3.57-.12,1.36.05,2.66.48,3.88.44,1.22,1.27,2.25,2.49,3.08,1.22.83,3.08,1.25,5.58,1.25s4.33-.43,5.65-1.28c1.32-.85,2.24-1.96,2.77-3.33.53-1.36.77-2.91.73-4.64-.05-1.73-.19-3.48-.42-5.23Z"/>
|
||||||
|
<path class="cls-1" d="M107.88,67.69c2.1.86,4.45,1.28,7.03,1.28,1.8,0,3.61-.23,5.44-.69,1.82-.46,3.46-1.18,4.92-2.15,1.46-.97,2.63-2.23,3.53-3.78.9-1.55,1.35-3.38,1.35-5.51,0-1.94-.38-3.38-1.14-4.33-.76-.95-1.93-1.53-3.5-1.77-1.43-.23-2.82-.14-4.16.28-1.34.42-2.33,1.04-2.98,1.87-.28.42-.69.79-1.25,1.11-.55.32-1.2.48-1.94.48-.55,0-1.1-.15-1.63-.45-.53-.3-.98-.84-1.35-1.63,1.89-.09,3.76-.5,5.61-1.21,1.85-.72,3.51-1.64,4.99-2.77,1.48-1.13,2.68-2.41,3.6-3.85.92-1.43,1.39-2.91,1.39-4.43,0-1.2-.3-2.26-.9-3.19-.6-.92-1.43-1.7-2.49-2.32-1.06-.62-2.3-1.08-3.71-1.39-1.41-.3-2.94-.45-4.61-.45-2.22,0-4.42.31-6.62.94-2.19.62-4.15,1.64-5.85,3.05-1.71,1.41-3.1,3.26-4.16,5.54-1.06,2.29-1.59,5.07-1.59,8.35,0,2.82.4,5.35,1.21,7.59.81,2.24,1.95,4.16,3.43,5.75,1.48,1.59,3.27,2.82,5.37,3.67ZM113.14,44.38c.67-.51,1.28-.76,1.84-.76.32,0,.65.07.97.21.32.14.48.44.48.9s-.35.94-1.04,1.42c-.69.49-1.92.82-3.67,1,.28-1.34.75-2.26,1.42-2.77Z"/>
|
||||||
|
<path class="cls-1" d="M137.7,64.02c1.48,1.59,3.27,2.82,5.37,3.67,2.1.86,4.44,1.28,7.03,1.28,1.8,0,3.61-.23,5.44-.69,1.82-.46,3.46-1.18,4.92-2.15,1.46-.97,2.63-2.23,3.53-3.78.9-1.55,1.35-3.38,1.35-5.51,0-1.94-.38-3.38-1.14-4.33-.76-.95-1.93-1.53-3.5-1.77-1.43-.23-2.82-.14-4.16.28-1.34.42-2.33,1.04-2.98,1.87-.28.42-.69.79-1.25,1.11-.55.32-1.2.48-1.94.48-.55,0-1.1-.15-1.63-.45-.53-.3-.98-.84-1.35-1.63,1.89-.09,3.76-.5,5.61-1.21,1.85-.72,3.51-1.64,4.99-2.77,1.48-1.13,2.68-2.41,3.6-3.85.92-1.43,1.39-2.91,1.39-4.43,0-1.2-.3-2.26-.9-3.19-.6-.92-1.43-1.7-2.49-2.32-1.06-.62-2.3-1.08-3.71-1.39-1.41-.3-2.94-.45-4.61-.45-2.22,0-4.42.31-6.62.94-2.19.62-4.15,1.64-5.85,3.05-1.71,1.41-3.1,3.26-4.16,5.54-1.06,2.29-1.59,5.07-1.59,8.35,0,2.82.4,5.35,1.21,7.59.81,2.24,1.95,4.16,3.43,5.75ZM148.34,44.38c.67-.51,1.28-.76,1.84-.76.32,0,.65.07.97.21.32.14.49.44.49.9s-.35.94-1.04,1.42c-.69.49-1.92.82-3.67,1,.28-1.34.75-2.26,1.42-2.77Z"/>
|
||||||
|
<path class="cls-1" d="M213.66,74.07c-.9-1.41-1.93-2.67-3.08-3.78-.83-.83-1.82-1.71-2.98-2.63-1.16-.92-2.36-1.86-3.6-2.81-1.25-.95-2.47-1.87-3.67-2.77-1.2-.9-2.29-1.77-3.26-2.6-.65-.55-.53-.99.35-1.32,2.26-.92,4.5-1.93,6.72-3.01,2.22-1.08,3.99-2.32,5.33-3.71.23-.28.67-.83,1.32-1.66.65-.83,1.15-1.84,1.52-3.01.37-1.18.4-2.45.1-3.81-.3-1.36-1.31-2.71-3.01-4.05-1.57-1.25-3.09-1.87-4.57-1.87-1.11,0-2.15.31-3.12.94-.97.62-1.89,1.41-2.77,2.36-.88.95-1.71,2-2.49,3.15-.79,1.16-1.55,2.26-2.29,3.33-.42.55-.95,1.27-1.59,2.15-.65.88-1.43,1.78-2.36,2.7-.6.6-.9.44-.9-.49v-.28l.07-.48v-.28c.09-1.2.15-2.55.17-4.05.02-1.5-.17-2.92-.59-4.26-.42-1.34-1.18-2.47-2.29-3.39-1.11-.92-2.75-1.39-4.92-1.39s-3.85.48-4.88,1.45c-1.04.97-1.73,2.19-2.08,3.67-.35,1.48-.47,3.08-.38,4.82.09,1.73.18,3.38.28,4.95.23,3.09.24,6.69.03,10.77-.21,4.09-.64,8.46-1.28,13.13-.09.69-.2,1.47-.31,2.32-.12.86-.15,1.72-.1,2.6.05.88.21,1.72.48,2.53.28.81.73,1.54,1.35,2.18.62.65,1.48,1.17,2.56,1.56,1.08.39,2.46.59,4.12.59,2.49,0,4.4-.43,5.72-1.28,1.32-.85,2.24-1.96,2.77-3.33.53-1.36.77-2.91.73-4.64-.05-1.73-.21-3.47-.48-5.23-.14-.97-.27-1.96-.38-2.98-.12-1.02-.22-2.05-.31-3.12-.05-.42-.02-.63.07-.66.09-.02.23.15.42.52.55,1.11,1.11,2.26,1.66,3.46.55,1.2,1.11,2.37,1.66,3.5.55,1.13,1.1,2.21,1.63,3.22.53,1.02,1,1.87,1.42,2.56.46.79.96,1.66,1.49,2.63.53.97,1.13,1.87,1.8,2.7.67.83,1.46,1.52,2.36,2.08.9.55,1.95.83,3.15.83,1.39,0,2.98-.46,4.78-1.39,2.17-1.11,3.64-2.37,4.4-3.78.76-1.41,1.05-2.85.87-4.33-.18-1.48-.73-2.92-1.63-4.33Z"/>
|
||||||
|
<path class="cls-1" d="M255.23,52.7c-1.27-3.51-2.89-6.41-4.85-8.7-1.96-2.29-4.11-3.98-6.44-5.09-2.33-1.11-4.58-1.66-6.75-1.66s-4.37.55-6.72,1.66c-2.36,1.11-4.53,2.78-6.51,5.02-1.99,2.24-3.61,5.09-4.88,8.56-1.27,3.46-1.91,7.55-1.91,12.26,0,4.06.51,7.55,1.52,10.46,1.02,2.91,2.43,5.3,4.23,7.17,1.8,1.87,3.95,3.25,6.44,4.12,2.49.88,5.24,1.32,8.25,1.32s5.7-.44,8.11-1.32c2.4-.88,4.46-2.24,6.17-4.09,1.71-1.85,3.01-4.19,3.91-7.03.9-2.84,1.35-6.22,1.35-10.15,0-4.85-.64-9.03-1.91-12.54ZM240.93,66.56c-.23,1.29-.52,2.29-.87,2.98-.35.69-.75,1.14-1.21,1.35-.46.21-.92.31-1.39.31-.51,0-1.03-.11-1.56-.35-.53-.23-1-.72-1.42-1.45-.42-.74-.76-1.8-1.04-3.19-.28-1.39-.42-3.21-.42-5.47s.14-4.26.42-5.85.62-2.89,1.04-3.88c.42-.99.87-1.72,1.35-2.18.48-.46.94-.69,1.35-.69s.87.23,1.35.69c.48.46.92,1.22,1.32,2.29.39,1.06.73,2.43,1,4.09.28,1.66.42,3.72.42,6.17,0,2.17-.12,3.9-.35,5.2Z"/>
|
||||||
|
<path class="cls-1" d="M164.6,74.3c-6.27-4.88-15.15-.27-22.54.65-18.62,2.32-24.64-.98-36.86-1.99-6.82-.37-6.7,7.51-4.12,11.87,6.33,11.99,20.86,17.6,33.89,17.38,12.98.03,29.73-6.14,31.84-20.62.2-2.46.16-5.44-2.21-7.28ZM131.49,99.87c-29.31-2.71,11.52-16.36,22.31-11.6,13.62,6.01-12.35,12.52-22.31,11.6Z"/>
|
||||||
|
</g>
|
||||||
|
<path class="cls-1" d="M265.05,11.84l2.87,6.73c1.65,3.85,4.68,6.94,8.5,8.66l6.67,3c1.22.55,1.21,2.29-.03,2.81l-6.73,2.87c-3.85,1.65-6.94,4.68-8.66,8.5l-3,6.67c-.55,1.22-2.29,1.21-2.81-.03l-2.87-6.73c-1.65-3.85-4.68-6.94-8.5-8.66l-6.67-3c-1.22-.55-1.21-2.29.03-2.81l6.73-2.87c3.85-1.65,6.94-4.68,8.66-8.5l3-6.67c.55-1.22,2.29-1.21,2.81.03Z"/>
|
||||||
|
<g>
|
||||||
|
<path class="cls-2" d="M259.53,25.94c.19-.49.53-.66,1.06-.66h.52c.49,0,.93.12,1.16.79l2.62,7.29c.08.21.21.6.21.83,0,.53-.46.95-1.02.95-.48,0-.82-.17-.98-.6l-.56-1.59h-3.49l-.57,1.59c-.15.42-.45.6-.97.6-.6,0-1.01-.37-1.01-.95,0-.24.13-.62.21-.83l2.81-7.42ZM260.84,27.64h-.03l-1.28,3.82h2.54l-1.23-3.82Z"/>
|
||||||
|
<path class="cls-2" d="M266.22,26.37c0-.65.42-1.08,1.08-1.08s1.09.44,1.09,1.08v7.7c0,.65-.42,1.08-1.09,1.08s-1.08-.44-1.08-1.08v-7.7Z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 9.8 KiB |
|
|
@ -21,7 +21,7 @@
|
||||||
{{ message.content }}
|
{{ message.content }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="message-item" :class="{ 'user-message': message.chatType === 1 }">
|
<div v-else class="message-item" :class="{ 'user-message': message.chatType === 1 }">
|
||||||
<img :src="message.chatType === 1 ? getUserAvatar(currentSessionId) : require('@/assets/xiaozhi-logo.png')"
|
<img :src="message.chatType === 1 ? getUserAvatar(currentSessionId) : require('@/assets/xiaozhi-logo.svg')"
|
||||||
class="avatar" />
|
class="avatar" />
|
||||||
<div class="message-content">
|
<div class="message-content">
|
||||||
{{ extractContentFromString(message.content) }}
|
{{ extractContentFromString(message.content) }}
|
||||||
|
|
|
||||||
|
|
@ -14,31 +14,31 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="device-name">
|
<div class="device-name">
|
||||||
语言模型:{{ device.llmModelName }}
|
Language Model: {{ device.llmModelName }}
|
||||||
</div>
|
</div>
|
||||||
<div class="device-name">
|
<div class="device-name">
|
||||||
音色模型:{{ device.ttsModelName }} ({{ device.ttsVoiceName }})
|
Voice Model: {{ device.ttsModelName }} ({{ device.ttsVoiceName }})
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;gap: 10px;align-items: center;">
|
<div style="display: flex;gap: 8px;align-items: center;flex-wrap: wrap;">
|
||||||
<div class="settings-btn" @click="handleConfigure">
|
<div class="settings-btn" @click="handleConfigure">
|
||||||
配置角色
|
Configure Role
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-btn" @click="handleVoicePrint">
|
<div class="settings-btn" @click="handleVoicePrint">
|
||||||
声纹识别
|
Voice Recognition
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-btn" @click="handleDeviceManage">
|
<div class="settings-btn" @click="handleDeviceManage">
|
||||||
设备管理({{ device.deviceCount }})
|
Devices ({{ device.deviceCount }})
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-btn" @click="handleChatHistory"
|
<div class="settings-btn" @click="handleChatHistory"
|
||||||
:class="{ 'disabled-btn': device.memModelId === 'Memory_nomem' }">
|
:class="{ 'disabled-btn': device.memModelId === 'Memory_nomem' }">
|
||||||
<el-tooltip v-if="device.memModelId === 'Memory_nomem'" content="请先在“配置角色”界面开启记忆" placement="top">
|
<el-tooltip v-if="device.memModelId === 'Memory_nomem'" content="Please enable memory in 'Configure Role' first" placement="top">
|
||||||
<span>聊天记录</span>
|
<span>Chat History</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span v-else>聊天记录</span>
|
<span v-else>Chat History</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="version-info">
|
<div class="version-info">
|
||||||
<div>最近对话:{{ formattedLastConnectedTime }}</div>
|
<div>Last Conversation: {{ formattedLastConnectedTime }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -54,20 +54,20 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formattedLastConnectedTime() {
|
formattedLastConnectedTime() {
|
||||||
if (!this.device.lastConnectedAt) return '暂未对话';
|
if (!this.device.lastConnectedAt) return 'No conversations yet';
|
||||||
|
|
||||||
const lastTime = new Date(this.device.lastConnectedAt);
|
const lastTime = new Date(this.device.lastConnectedAt);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const diffMinutes = Math.floor((now - lastTime) / (1000 * 60));
|
const diffMinutes = Math.floor((now - lastTime) / (1000 * 60));
|
||||||
|
|
||||||
if (diffMinutes <= 1) {
|
if (diffMinutes <= 1) {
|
||||||
return '刚刚';
|
return 'Just now';
|
||||||
} else if (diffMinutes < 60) {
|
} else if (diffMinutes < 60) {
|
||||||
return `${diffMinutes}分钟前`;
|
return `${diffMinutes} minute${diffMinutes > 1 ? 's' : ''} ago`;
|
||||||
} else if (diffMinutes < 24 * 60) {
|
} else if (diffMinutes < 24 * 60) {
|
||||||
const hours = Math.floor(diffMinutes / 60);
|
const hours = Math.floor(diffMinutes / 60);
|
||||||
const minutes = diffMinutes % 60;
|
const minutes = diffMinutes % 60;
|
||||||
return `${hours}小时${minutes > 0 ? minutes + '分钟' : ''}前`;
|
return `${hours} hour${hours > 1 ? 's' : ''} ${minutes > 0 ? minutes + ' minute' + (minutes > 1 ? 's' : '') : ''} ago`;
|
||||||
} else {
|
} else {
|
||||||
return this.device.lastConnectedAt;
|
return this.device.lastConnectedAt;
|
||||||
}
|
}
|
||||||
|
|
@ -114,15 +114,17 @@ export default {
|
||||||
|
|
||||||
.settings-btn {
|
.settings-btn {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 12px;
|
font-size: 11px;
|
||||||
color: #5778ff;
|
color: #5778ff;
|
||||||
background: #e6ebff;
|
background: #e6ebff;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 0 12px;
|
padding: 0 10px;
|
||||||
height: 21px;
|
height: 22px;
|
||||||
line-height: 21px;
|
line-height: 22px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 14px;
|
border-radius: 11px;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-info {
|
.version-info {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose">
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose">
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
|
<el-form :model="form" :rules="rules" ref="form" label-width="100px">
|
||||||
<el-form-item label="字典标签" prop="dictLabel">
|
<el-form-item label="Dictionary Label" prop="dictLabel">
|
||||||
<el-input v-model="form.dictLabel" placeholder="请输入字典标签"></el-input>
|
<el-input v-model="form.dictLabel" placeholder="Enter dictionary label"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字典值" prop="dictValue">
|
<el-form-item label="Dictionary Value" prop="dictValue">
|
||||||
<el-input v-model="form.dictValue" placeholder="请输入字典值"></el-input>
|
<el-input v-model="form.dictValue" placeholder="Enter dictionary value"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="Sort" prop="sort">
|
||||||
<el-input-number v-model="form.sort" :min="0" :max="999" style="width: 100%;"></el-input-number>
|
<el-input-number v-model="form.sort" :min="0" :max="999" style="width: 100%;"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">Cancel</el-button>
|
||||||
<el-button type="primary" @click="handleSave">确 定</el-button>
|
<el-button type="primary" @click="handleSave">Confirm</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -28,7 +28,7 @@ export default {
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '新增字典数据'
|
default: 'Add Dictionary Data'
|
||||||
},
|
},
|
||||||
dictData: {
|
dictData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -50,8 +50,8 @@ export default {
|
||||||
sort: 0
|
sort: 0
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
dictLabel: [{ required: true, message: '请输入字典标签', trigger: 'blur' }],
|
dictLabel: [{ required: true, message: 'Please enter dictionary label', trigger: 'blur' }],
|
||||||
dictValue: [{ required: true, message: '请输入字典值', trigger: 'blur' }]
|
dictValue: [{ required: true, message: 'Please enter dictionary value', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose">
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" @close="handleClose">
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-width="120px">
|
<el-form :model="form" :rules="rules" ref="form" label-width="120px">
|
||||||
<el-form-item label="字典类型名称" prop="dictName">
|
<el-form-item label="Dictionary Type Name" prop="dictName">
|
||||||
<el-input v-model="form.dictName" placeholder="请输入字典类型名称"></el-input>
|
<el-input v-model="form.dictName" placeholder="Enter dictionary type name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字典类型编码" prop="dictType">
|
<el-form-item label="Dictionary Type Code" prop="dictType">
|
||||||
<el-input v-model="form.dictType" placeholder="请输入字典类型编码"></el-input>
|
<el-input v-model="form.dictType" placeholder="Enter dictionary type code"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="handleClose">取 消</el-button>
|
<el-button @click="handleClose">Cancel</el-button>
|
||||||
<el-button type="primary" @click="handleSave">确 定</el-button>
|
<el-button type="primary" @click="handleSave">Confirm</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -25,7 +25,7 @@ export default {
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '新增字典类型'
|
default: 'Add Dictionary Type'
|
||||||
},
|
},
|
||||||
dictTypeData: {
|
dictTypeData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -41,8 +41,8 @@ export default {
|
||||||
dictType: ''
|
dictType: ''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
dictName: [{ required: true, message: '请输入字典类型名称', trigger: 'blur' }],
|
dictName: [{ required: true, message: 'Please enter dictionary type name', trigger: 'blur' }],
|
||||||
dictType: [{ required: true, message: '请输入字典类型编码', trigger: 'blur' }]
|
dictType: [{ required: true, message: 'Please enter dictionary type code', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<!-- 自定义标题区域 -->
|
<!-- 自定义标题区域 -->
|
||||||
<div class="custom-header">
|
<div class="custom-header">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<h3 class="bold-title">功能管理</h3>
|
<h3 class="bold-title">Function Management</h3>
|
||||||
</div>
|
</div>
|
||||||
<button class="custom-close-btn" @click="closeDialog">×</button>
|
<button class="custom-close-btn" @click="closeDialog">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
<!-- 左侧:未选功能 -->
|
<!-- 左侧:未选功能 -->
|
||||||
<div class="function-column">
|
<div class="function-column">
|
||||||
<div class="column-header">
|
<div class="column-header">
|
||||||
<h4 class="column-title">未选功能</h4>
|
<h4 class="column-title">Unselected Functions</h4>
|
||||||
<el-button type="text" @click="selectAll" class="select-all-btn">全选</el-button>
|
<el-button type="text" @click="selectAll" class="select-all-btn">Select All</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="function-list">
|
<div class="function-list">
|
||||||
<div v-if="unselected.length">
|
<div v-if="unselected.length">
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else style="display: flex; justify-content: center; align-items: center;">
|
<div v-else style="display: flex; justify-content: center; align-items: center;">
|
||||||
<el-empty description="没有更多的插件了" />
|
<el-empty description="No more plugins available" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
<!-- 中间:已选功能 -->
|
<!-- 中间:已选功能 -->
|
||||||
<div class="function-column">
|
<div class="function-column">
|
||||||
<div class="column-header">
|
<div class="column-header">
|
||||||
<h4 class="column-title">已选功能</h4>
|
<h4 class="column-title">Selected Functions</h4>
|
||||||
<el-button type="text" @click="deselectAll" class="select-all-btn">全选</el-button>
|
<el-button type="text" @click="deselectAll" class="select-all-btn">Select All</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="function-list">
|
<div class="function-list">
|
||||||
<div v-if="selectedList.length > 0">
|
<div v-if="selectedList.length > 0">
|
||||||
|
|
@ -50,19 +50,19 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else style="display: flex; justify-content: center; align-items: center;">
|
<div v-else style="display: flex; justify-content: center; align-items: center;">
|
||||||
<el-empty description="请选择插件功能" />
|
<el-empty description="Please select plugin functions" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 右侧:参数配置 -->
|
<!-- 右侧:参数配置 -->
|
||||||
<div class="params-column">
|
<div class="params-column">
|
||||||
<h4 v-if="currentFunction" class="column-title">参数配置 - {{ currentFunction.name }}</h4>
|
<h4 v-if="currentFunction" class="column-title">Parameter Configuration - {{ currentFunction.name }}</h4>
|
||||||
<div v-if="currentFunction" class="params-container">
|
<div v-if="currentFunction" class="params-container">
|
||||||
<el-form :model="currentFunction" class="param-form">
|
<el-form :model="currentFunction" class="param-form">
|
||||||
<!-- 遍历 fieldsMeta,而不是 params 的 keys -->
|
<!-- 遍历 fieldsMeta,而不是 params 的 keys -->
|
||||||
<div v-if="currentFunction.fieldsMeta.length == 0">
|
<div v-if="currentFunction.fieldsMeta.length == 0">
|
||||||
<el-empty :description="currentFunction.name + ' 无需配置参数'" />
|
<el-empty :description="currentFunction.name + ' No parameters required'" />
|
||||||
</div>
|
</div>
|
||||||
<el-form-item v-for="field in currentFunction.fieldsMeta" :key="field.key" :label="field.label"
|
<el-form-item v-for="field in currentFunction.fieldsMeta" :key="field.key" :label="field.label"
|
||||||
class="param-item" :class="{ 'textarea-field': field.type === 'array' || field.type === 'json' }">
|
class="param-item" :class="{ 'textarea-field': field.type === 'array' || field.type === 'json' }">
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
@change="val => handleParamChange(currentFunction, field.key, val)" />
|
@change="val => handleParamChange(currentFunction, field.key, val)" />
|
||||||
|
|
||||||
<!-- JSON -->
|
<!-- JSON -->
|
||||||
<el-input v-else-if="field.type === 'json'" type="textarea" :rows="6" placeholder="请输入合法的 JSON"
|
<el-input v-else-if="field.type === 'json'" type="textarea" :rows="6" placeholder="Enter valid JSON"
|
||||||
v-model="textCache[field.key]" @blur="flushJson(field)" />
|
v-model="textCache[field.key]" @blur="flushJson(field)" />
|
||||||
|
|
||||||
<!-- number -->
|
<!-- number -->
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="empty-tip">请选择已配置的功能进行参数设置</div>
|
<div v-else class="empty-tip">Please select configured functions to set parameters</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -105,21 +105,21 @@
|
||||||
<!-- 左侧区域 -->
|
<!-- 左侧区域 -->
|
||||||
<div class="mcp-left">
|
<div class="mcp-left">
|
||||||
<div class="mcp-header">
|
<div class="mcp-header">
|
||||||
<h3 class="bold-title">MCP接入点</h3>
|
<h3 class="bold-title">MCP Access Point</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="url-header">
|
<div class="url-header">
|
||||||
<div class="address-desc">
|
<div class="address-desc">
|
||||||
<span>以下是智能体的MCP接入点地址。</span>
|
<span>Below is the MCP access point address for the agent.</span>
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mcp-endpoint-enable.md"
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mcp-endpoint-enable.md"
|
||||||
target="_blank" class="doc-link">如何部署MCP接入点</a> |
|
target="_blank" class="doc-link">How to deploy MCP access point</a> |
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mcp-endpoint-integration.md"
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mcp-endpoint-integration.md"
|
||||||
target="_blank" class="doc-link">如何接入MCP功能</a>
|
target="_blank" class="doc-link">How to integrate MCP functions</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-input v-model="mcpUrl" readonly class="url-input">
|
<el-input v-model="mcpUrl" readonly class="url-input">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<el-button @click="copyUrl" class="inner-copy-btn" icon="el-icon-document-copy">
|
<el-button @click="copyUrl" class="inner-copy-btn" icon="el-icon-document-copy">
|
||||||
复制
|
Copy
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
@ -128,17 +128,17 @@
|
||||||
<!-- 右侧区域 -->
|
<!-- 右侧区域 -->
|
||||||
<div class="mcp-right">
|
<div class="mcp-right">
|
||||||
<div class="mcp-header">
|
<div class="mcp-header">
|
||||||
<h3 class="bold-title">接入点状态</h3>
|
<h3 class="bold-title">Access Point Status</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-container">
|
<div class="status-container">
|
||||||
<span class="status-indicator" :class="mcpStatus"></span>
|
<span class="status-indicator" :class="mcpStatus"></span>
|
||||||
<span class="status-text">{{
|
<span class="status-text">{{
|
||||||
mcpStatus === 'connected' ? '已连接' :
|
mcpStatus === 'connected' ? 'Connected' :
|
||||||
mcpStatus === 'loading' ? '加载中...' : '未连接'
|
mcpStatus === 'loading' ? 'Loading...' : 'Not Connected'
|
||||||
}}</span>
|
}}</span>
|
||||||
<button class="refresh-btn" @click="refreshStatus">
|
<button class="refresh-btn" @click="refreshStatus">
|
||||||
<span class="refresh-icon">↻</span>
|
<span class="refresh-icon">↻</span>
|
||||||
<span>刷新</span>
|
<span>Refresh</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="mcp-tools-list">
|
<div class="mcp-tools-list">
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="no-tools">
|
<div v-else class="no-tools">
|
||||||
<span>暂无可用工具</span>
|
<span>No tools available</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -156,8 +156,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="drawer-footer">
|
<div class="drawer-footer">
|
||||||
<el-button @click="closeDialog">取消</el-button>
|
<el-button @click="closeDialog">Cancel</el-button>
|
||||||
<el-button type="primary" @click="saveSelection">保存配置</el-button>
|
<el-button type="primary" @click="saveSelection">Save Configuration</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -264,13 +264,13 @@ export default {
|
||||||
try {
|
try {
|
||||||
const successful = document.execCommand('copy');
|
const successful = document.execCommand('copy');
|
||||||
if (successful) {
|
if (successful) {
|
||||||
this.$message.success('已复制到剪贴板');
|
this.$message.success('Copied to clipboard');
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('复制失败,请手动复制');
|
this.$message.error('Copy failed, please copy manually');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.$message.error('复制失败,请手动复制');
|
this.$message.error('复制失败,请手动复制');
|
||||||
console.error('复制失败:', err);
|
console.error('Copy failed:', err);
|
||||||
} finally {
|
} finally {
|
||||||
document.body.removeChild(textarea);
|
document.body.removeChild(textarea);
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +327,7 @@ export default {
|
||||||
const obj = JSON.parse(text);
|
const obj = JSON.parse(text);
|
||||||
this.handleParamChange(this.currentFunction, key, obj);
|
this.handleParamChange(this.currentFunction, key, obj);
|
||||||
} catch {
|
} catch {
|
||||||
this.$message.error(`${this.currentFunction.name}的${key}字段格式错误:JSON格式有误`);
|
this.$message.error(`${this.currentFunction.name} ${key} field format error: Invalid JSON format`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleFunctionClick(func) {
|
handleFunctionClick(func) {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<!-- 左侧元素 -->
|
<!-- 左侧元素 -->
|
||||||
<div class="header-left" @click="goHome">
|
<div class="header-left" @click="goHome">
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.png" class="logo-img" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.svg" class="logo-img" />
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" class="brand-img" />
|
<!-- <img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" class="brand-img" /> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 中间导航菜单 -->
|
<!-- 中间导航菜单 -->
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
<!-- 右侧元素 -->
|
<!-- 右侧元素 -->
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
<div class="search-container" v-if="$route.path === '/home' && !(isSuperAdmin && isSmallScreen)">
|
<div class="search-container" v-if="$route.path === '/home' && !(isSuperAdmin && isSmallScreen)">
|
||||||
<el-input v-model="search" placeholder="输入名称搜索.." class="custom-search-input"
|
<el-input v-model="search" placeholder="Enter name to search.." class="custom-search-input"
|
||||||
@keyup.enter.native="handleSearch">
|
@keyup.enter.native="handleSearch">
|
||||||
<i slot="suffix" class="el-icon-search search-icon" @click="handleSearch"></i>
|
<i slot="suffix" class="el-icon-search search-icon" @click="handleSearch"></i>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
<img loading="lazy" alt="" src="@/assets/home/avatar.png" class="avatar-img" />
|
<img loading="lazy" alt="" src="@/assets/home/avatar.png" class="avatar-img" />
|
||||||
<el-dropdown trigger="click" class="user-dropdown" @visible-change="handleUserDropdownVisibleChange">
|
<el-dropdown trigger="click" class="user-dropdown" @visible-change="handleUserDropdownVisibleChange">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
{{ userInfo.username || '加载中...' }}
|
{{ userInfo.username || 'Loading...' }}
|
||||||
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': userDropdownVisible }"></i>
|
<i class="el-icon-arrow-down el-icon--right" :class="{ 'rotate-down': userDropdownVisible }"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
|
@ -122,13 +122,13 @@ export default {
|
||||||
this.checkScreenSize();
|
this.checkScreenSize();
|
||||||
window.addEventListener('resize', this.checkScreenSize);
|
window.addEventListener('resize', this.checkScreenSize);
|
||||||
},
|
},
|
||||||
//移除事件监听器
|
// Remove event listener
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener('resize', this.checkScreenSize);
|
window.removeEventListener('resize', this.checkScreenSize);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goHome() {
|
goHome() {
|
||||||
// 跳转到首页
|
// Navigate to home page
|
||||||
this.$router.push('/home')
|
this.$router.push('/home')
|
||||||
},
|
},
|
||||||
goUserManagement() {
|
goUserManagement() {
|
||||||
|
|
@ -152,7 +152,7 @@ export default {
|
||||||
goServerSideManagement() {
|
goServerSideManagement() {
|
||||||
this.$router.push('/server-side-management')
|
this.$router.push('/server-side-management')
|
||||||
},
|
},
|
||||||
// 获取用户信息
|
// Get user information
|
||||||
fetchUserInfo() {
|
fetchUserInfo() {
|
||||||
userApi.getUserInfo(({ data }) => {
|
userApi.getUserInfo(({ data }) => {
|
||||||
this.userInfo = data.data
|
this.userInfo = data.data
|
||||||
|
|
@ -164,46 +164,46 @@ export default {
|
||||||
checkScreenSize() {
|
checkScreenSize() {
|
||||||
this.isSmallScreen = window.innerWidth <= 1386;
|
this.isSmallScreen = window.innerWidth <= 1386;
|
||||||
},
|
},
|
||||||
// 处理搜索
|
// Handle search
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
const searchValue = this.search.trim();
|
const searchValue = this.search.trim();
|
||||||
|
|
||||||
// 如果搜索内容为空,触发重置事件
|
// If search content is empty, trigger reset event
|
||||||
if (!searchValue) {
|
if (!searchValue) {
|
||||||
this.$emit('search-reset');
|
this.$emit('search-reset');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 创建不区分大小写的正则表达式
|
// Create case-insensitive regex
|
||||||
const regex = new RegExp(searchValue, 'i');
|
const regex = new RegExp(searchValue, 'i');
|
||||||
// 触发搜索事件,将正则表达式传递给父组件
|
// Trigger search event, pass regex to parent component
|
||||||
this.$emit('search', regex);
|
this.$emit('search', regex);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('正则表达式创建失败:', error);
|
console.error('Failed to create regex:', error);
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '搜索关键词格式不正确',
|
message: 'Invalid search keyword format',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 显示修改密码弹窗
|
// Show change password dialog
|
||||||
showChangePasswordDialog() {
|
showChangePasswordDialog() {
|
||||||
this.isChangePasswordDialogVisible = true;
|
this.isChangePasswordDialogVisible = true;
|
||||||
},
|
},
|
||||||
// 退出登录
|
// Logout
|
||||||
async handleLogout() {
|
async handleLogout() {
|
||||||
try {
|
try {
|
||||||
// 调用 Vuex 的 logout action
|
// Call Vuex logout action
|
||||||
await this.logout();
|
await this.logout();
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: '退出登录成功',
|
message: 'Logout successful',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('退出登录失败:', error);
|
console.error('Logout failed:', error);
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '退出登录失败,请重试',
|
message: 'Logout failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -211,12 +211,12 @@ export default {
|
||||||
handleUserDropdownVisibleChange(visible) {
|
handleUserDropdownVisibleChange(visible) {
|
||||||
this.userDropdownVisible = visible;
|
this.userDropdownVisible = visible;
|
||||||
},
|
},
|
||||||
// 监听第二个下拉菜单的可见状态变化
|
// Listen to second dropdown menu visibility change
|
||||||
handleParamDropdownVisibleChange(visible) {
|
handleParamDropdownVisibleChange(visible) {
|
||||||
this.paramDropdownVisible = visible;
|
this.paramDropdownVisible = visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 使用 mapActions 引入 Vuex 的 logout action
|
// Use mapActions to import Vuex logout action
|
||||||
...mapActions(['logout'])
|
...mapActions(['logout'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -248,8 +248,8 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-img {
|
.logo-img {
|
||||||
width: 42px;
|
width: 90px;
|
||||||
height: 42px;
|
height: 90px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-img {
|
.brand-img {
|
||||||
|
|
|
||||||
|
|
@ -20,22 +20,22 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-width="110px" label-position="left" class="param-form">
|
<el-form :model="form" :rules="rules" ref="form" label-width="110px" label-position="left" class="param-form">
|
||||||
<el-form-item label="参数编码" prop="paramCode" class="form-item">
|
<el-form-item label="Parameter Code" prop="paramCode" class="form-item">
|
||||||
<el-input v-model="form.paramCode" placeholder="请输入参数编码" class="custom-input"></el-input>
|
<el-input v-model="form.paramCode" placeholder="Enter parameter code" class="custom-input"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="参数值" prop="paramValue" class="form-item">
|
<el-form-item label="Parameter Value" prop="paramValue" class="form-item">
|
||||||
<el-input v-model="form.paramValue" placeholder="请输入参数值" class="custom-input"></el-input>
|
<el-input v-model="form.paramValue" placeholder="Enter parameter value" class="custom-input"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="值类型" prop="valueType" class="form-item">
|
<el-form-item label="Value Type" prop="valueType" class="form-item">
|
||||||
<el-select v-model="form.valueType" placeholder="请选择值类型" class="custom-select">
|
<el-select v-model="form.valueType" placeholder="Select value type" class="custom-select">
|
||||||
<el-option v-for="item in valueTypeOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
<el-option v-for="item in valueTypeOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="备注" prop="remark" class="form-item remark-item">
|
<el-form-item label="Remark" prop="remark" class="form-item remark-item">
|
||||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" :rows="3" class="custom-textarea"></el-input>
|
<el-input type="textarea" v-model="form.remark" placeholder="Enter remark" :rows="3" class="custom-textarea"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|
@ -46,10 +46,10 @@
|
||||||
class="save-btn"
|
class="save-btn"
|
||||||
:loading="saving"
|
:loading="saving"
|
||||||
:disabled="saving">
|
:disabled="saving">
|
||||||
保存
|
Save
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="cancel" class="cancel-btn">
|
<el-button @click="cancel" class="cancel-btn">
|
||||||
取消
|
Cancel
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -61,7 +61,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '新增参数'
|
default: 'Add Parameter'
|
||||||
},
|
},
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
@ -83,21 +83,21 @@ export default {
|
||||||
dialogKey: Date.now(),
|
dialogKey: Date.now(),
|
||||||
saving: false,
|
saving: false,
|
||||||
valueTypeOptions: [
|
valueTypeOptions: [
|
||||||
{ value: 'string', label: '字符串(string)' },
|
{ value: 'string', label: 'String' },
|
||||||
{ value: 'number', label: '数字(number)' },
|
{ value: 'number', label: 'Number' },
|
||||||
{ value: 'boolean', label: '布尔值(boolean)' },
|
{ value: 'boolean', label: 'Boolean' },
|
||||||
{ value: 'array', label: '数组(array)' },
|
{ value: 'array', label: 'Array' },
|
||||||
{ value: 'json', label: 'JSON对象(json)' }
|
{ value: 'json', label: 'JSON Object' }
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
paramCode: [
|
paramCode: [
|
||||||
{ required: true, message: "请输入参数编码", trigger: "blur" }
|
{ required: true, message: "Please enter parameter code", trigger: "blur" }
|
||||||
],
|
],
|
||||||
paramValue: [
|
paramValue: [
|
||||||
{ required: true, message: "请输入参数值", trigger: "blur" }
|
{ required: true, message: "Please enter parameter value", trigger: "blur" }
|
||||||
],
|
],
|
||||||
valueType: [
|
valueType: [
|
||||||
{ required: true, message: "请选择值类型", trigger: "change" }
|
{ required: true, message: "Please select value type", trigger: "change" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ export default {
|
||||||
name: [{ required: true, message: 'Please enter provider name', trigger: 'blur' }]
|
name: [{ required: true, message: 'Please enter provider name', trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
isAllFieldsSelected: false,
|
isAllFieldsSelected: false,
|
||||||
tableKey: 0 // 用于强制表格重新渲染
|
tableKey: 0 // Used to force table re-render
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form :model="form" :rules="rules" ref="form" label-width="110px" label-position="left" class="param-form">
|
<el-form :model="form" :rules="rules" ref="form" label-width="110px" label-position="left" class="param-form">
|
||||||
<el-form-item label="声纹向量" prop="audioId" class="form-item">
|
<el-form-item label="Voice Vector" prop="audioId" class="form-item">
|
||||||
<el-select v-model="form.audioId" placeholder="请选择一条语言消息" class="custom-select">
|
<el-select v-model="form.audioId" placeholder="Please select a voice message" class="custom-select">
|
||||||
<el-option v-for="item in valueTypeOptions" :key="item.audioId" :label="item.content" :value="item.audioId">
|
<el-option v-for="item in valueTypeOptions" :key="item.audioId" :label="item.content" :value="item.audioId">
|
||||||
<span style="float: left">{{ item.content }}</span>
|
<span style="float: left">{{ item.content }}</span>
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px">
|
<span style="float: right; color: #8492a6; font-size: 13px">
|
||||||
|
|
@ -24,22 +24,22 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="姓名" prop="sourceName" class="form-item">
|
<el-form-item label="Name" prop="sourceName" class="form-item">
|
||||||
<el-input v-model="form.sourceName" placeholder="请输入姓名" class="custom-input"></el-input>
|
<el-input v-model="form.sourceName" placeholder="Please enter name" class="custom-input"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="描述" prop="introduce" class="form-item remark-item">
|
<el-form-item label="Description" prop="introduce" class="form-item remark-item">
|
||||||
<el-input type="textarea" v-model="form.introduce" placeholder="请输入描述" :rows="3" class="custom-textarea"
|
<el-input type="textarea" v-model="form.introduce" placeholder="Please enter description" :rows="3" class="custom-textarea"
|
||||||
maxlength="100" show-word-limit></el-input>
|
maxlength="100" show-word-limit></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="submit" class="save-btn" :loading="saving" :disabled="saving">
|
<el-button type="primary" @click="submit" class="save-btn" :loading="saving" :disabled="saving">
|
||||||
保存
|
Save
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="cancel" class="cancel-btn">
|
<el-button @click="cancel" class="cancel-btn">
|
||||||
取消
|
Cancel
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -53,7 +53,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '添加说话人'
|
default: 'Add Speaker'
|
||||||
},
|
},
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
@ -83,13 +83,13 @@ export default {
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
introduce: [
|
introduce: [
|
||||||
{ required: true, message: "请输入描述", trigger: "blur" }
|
{ required: true, message: "Please enter description", trigger: "blur" }
|
||||||
],
|
],
|
||||||
sourceName: [
|
sourceName: [
|
||||||
{ required: true, message: "请输入姓名", trigger: "blur" }
|
{ required: true, message: "Please enter name", trigger: "blur" }
|
||||||
],
|
],
|
||||||
audioId: [
|
audioId: [
|
||||||
{ required: true, message: "请选择音频向量", trigger: "change" }
|
{ required: true, message: "Please select audio vector", trigger: "change" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -103,7 +103,7 @@ export default {
|
||||||
},
|
},
|
||||||
playAudio(audioId) {
|
playAudio(audioId) {
|
||||||
if (this.playingAudioId === audioId) {
|
if (this.playingAudioId === audioId) {
|
||||||
// 如果正在播放当前音频,则停止播放
|
// If currently playing this audio, stop it
|
||||||
if (this.audioElement) {
|
if (this.audioElement) {
|
||||||
this.audioElement.pause();
|
this.audioElement.pause();
|
||||||
this.audioElement = null;
|
this.audioElement = null;
|
||||||
|
|
@ -112,17 +112,17 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 停止当前正在播放的音频
|
// Stop currently playing audio
|
||||||
if (this.audioElement) {
|
if (this.audioElement) {
|
||||||
this.audioElement.pause();
|
this.audioElement.pause();
|
||||||
this.audioElement = null;
|
this.audioElement = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先获取音频下载ID
|
// First get audio download ID
|
||||||
this.playingAudioId = audioId;
|
this.playingAudioId = audioId;
|
||||||
api.agent.getAudioId(audioId, (res) => {
|
api.agent.getAudioId(audioId, (res) => {
|
||||||
if (res.data && res.data.data) {
|
if (res.data && res.data.data) {
|
||||||
// 使用获取到的下载ID播放音频
|
// Use the obtained download ID to play audio
|
||||||
this.audioElement = new Audio(api.getServiceUrl() + `/agent/play/${res.data.data}`);
|
this.audioElement = new Audio(api.getServiceUrl() + `/agent/play/${res.data.data}`);
|
||||||
|
|
||||||
this.audioElement.onended = () => {
|
this.audioElement.onended = () => {
|
||||||
|
|
@ -137,11 +137,11 @@ export default {
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.saving = true; // 开始加载
|
this.saving = true; // Start loading
|
||||||
this.$emit('submit', {
|
this.$emit('submit', {
|
||||||
form: this.form,
|
form: this.form,
|
||||||
done: () => {
|
done: () => {
|
||||||
this.saving = false; // 加载完成
|
this.saving = false; // Loading complete
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.saving = false; // 取消时重置状态
|
this.saving = false; // Reset status on cancel
|
||||||
this.$emit('cancel');
|
this.$emit('cancel');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const routes = [
|
||||||
return import('../views/retrievePassword.vue')
|
return import('../views/retrievePassword.vue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 设备管理页面路由
|
// Device Management页面路由
|
||||||
{
|
{
|
||||||
path: '/device-management',
|
path: '/device-management',
|
||||||
name: 'DeviceManagement',
|
name: 'DeviceManagement',
|
||||||
|
|
@ -73,7 +73,7 @@ const routes = [
|
||||||
path: '/model-config',
|
path: '/model-config',
|
||||||
name: 'ModelConfig',
|
name: 'ModelConfig',
|
||||||
component: function () {
|
component: function () {
|
||||||
return import('../views/ModelConfig.vue')
|
return import('../views/modelConfig.vue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<HeaderBar/>
|
<HeaderBar/>
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">设备管理</h2>
|
<h2 class="page-title">Device Management</h2>
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-input placeholder="请输入设备型号或Mac地址查询" v-model="searchKeyword" class="search-input"
|
<el-input placeholder="请输入设备型号或Mac地址查询" v-model="searchKeyword" class="search-input"
|
||||||
@keyup.enter.native="handleSearch" clearable/>
|
@keyup.enter.native="handleSearch" clearable/>
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">字典管理</h2>
|
<h2 class="page-title">Dictionary Management</h2>
|
||||||
<div class="action-group">
|
<div class="action-group">
|
||||||
<div class="search-group">
|
<div class="search-group">
|
||||||
<el-input placeholder="请输入字典值标签查询" v-model="search" class="search-input" clearable
|
<el-input placeholder="Enter dictionary label to search" v-model="search" class="search-input" clearable
|
||||||
@keyup.enter.native="handleSearch" style="width: 240px" />
|
@keyup.enter.native="handleSearch" style="width: 240px" />
|
||||||
<el-button class="btn-search" @click="handleSearch">
|
<el-button class="btn-search" @click="handleSearch">
|
||||||
搜索
|
Search
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -21,22 +21,22 @@
|
||||||
<!-- 左侧字典类型列表 -->
|
<!-- 左侧字典类型列表 -->
|
||||||
<div class="dict-type-panel">
|
<div class="dict-type-panel">
|
||||||
<div class="dict-type-header">
|
<div class="dict-type-header">
|
||||||
<el-button type="success" size="mini" @click="showAddDictTypeDialog">新增字典类型</el-button>
|
<el-button type="success" size="mini" @click="showAddDictTypeDialog">Add Dictionary Type</el-button>
|
||||||
<el-button type="danger" size="mini" @click="batchDeleteDictType"
|
<el-button type="danger" size="mini" @click="batchDeleteDictType"
|
||||||
:disabled="selectedDictTypes.length === 0">
|
:disabled="selectedDictTypes.length === 0">
|
||||||
批量删除字典类型
|
Batch Delete Dictionary Types
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table ref="dictTypeTable" :data="dictTypeList" style="width: 100%" v-loading="dictTypeLoading"
|
<el-table ref="dictTypeTable" :data="dictTypeList" style="width: 100%" v-loading="dictTypeLoading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)" @row-click="handleDictTypeRowClick"
|
element-loading-background="rgba(255, 255, 255, 0.7)" @row-click="handleDictTypeRowClick"
|
||||||
@selection-change="handleDictTypeSelectionChange" :row-class-name="tableRowClassName"
|
@selection-change="handleDictTypeSelectionChange" :row-class-name="tableRowClassName"
|
||||||
class="dict-type-table">
|
class="dict-type-table">
|
||||||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||||||
<el-table-column label="字典类型名称" prop="dictName" align="center"></el-table-column>
|
<el-table-column label="Dictionary Type Name" prop="dictName" align="center"></el-table-column>
|
||||||
<el-table-column label="操作" width="100" align="center">
|
<el-table-column label="Actions" width="100" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="mini" @click.stop="editDictType(scope.row)">编辑</el-button>
|
<el-button type="text" size="mini" @click.stop="editDictType(scope.row)">Edit</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -46,27 +46,27 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="dict-data-card" shadow="never">
|
<el-card class="dict-data-card" shadow="never">
|
||||||
<el-table ref="dictDataTable" :data="dictDataList" style="width: 100%"
|
<el-table ref="dictDataTable" :data="dictDataList" style="width: 100%"
|
||||||
v-loading="dictDataLoading" element-loading-text="拼命加载中"
|
v-loading="dictDataLoading" element-loading-text="Loading..."
|
||||||
element-loading-spinner="el-icon-loading"
|
element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)" class="data-table"
|
element-loading-background="rgba(255, 255, 255, 0.7)" class="data-table"
|
||||||
header-row-class-name="table-header">
|
header-row-class-name="table-header">
|
||||||
<el-table-column label="选择" align="center" width="55">
|
<el-table-column label="Select" align="center" width="55">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="字典标签" prop="dictLabel" align="center"></el-table-column>
|
<el-table-column label="Dictionary Label" prop="dictLabel" align="center"></el-table-column>
|
||||||
<el-table-column label="字典值" prop="dictValue" align="center"></el-table-column>
|
<el-table-column label="Dictionary Value" prop="dictValue" align="center"></el-table-column>
|
||||||
<el-table-column label="排序" prop="sort" align="center"></el-table-column>
|
<el-table-column label="Sort" prop="sort" align="center"></el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="180px">
|
<el-table-column label="Actions" align="center" width="180px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="mini" @click="editDictData(scope.row)"
|
<el-button type="text" size="mini" @click="editDictData(scope.row)"
|
||||||
class="edit-btn">
|
class="edit-btn">
|
||||||
修改
|
Edit
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="text" size="mini" @click="deleteDictData(scope.row)"
|
<el-button type="text" size="mini" @click="deleteDictData(scope.row)"
|
||||||
class="delete-btn">
|
class="delete-btn">
|
||||||
删除
|
Delete
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -74,36 +74,36 @@
|
||||||
<div class="table-footer">
|
<div class="table-footer">
|
||||||
<div class="batch-actions">
|
<div class="batch-actions">
|
||||||
<el-button size="mini" type="primary" @click="selectAllDictData">
|
<el-button size="mini" type="primary" @click="selectAllDictData">
|
||||||
{{ isAllDictDataSelected ? '取消全选' : '全选' }}
|
{{ isAllDictDataSelected ? 'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="success" size="mini" @click="showAddDictDataDialog" class="add-btn">
|
<el-button type="success" size="mini" @click="showAddDictDataDialog" class="add-btn">
|
||||||
新增字典数据
|
Add Dictionary Data
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDeleteDictData">
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDeleteDictData">
|
||||||
批量删除字典数据
|
Batch Delete Dictionary Data
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`"
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`"
|
||||||
:value="item">
|
:value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
First
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
||||||
上一页
|
Previous
|
||||||
</button>
|
</button>
|
||||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
||||||
下一页
|
Next
|
||||||
</button>
|
</button>
|
||||||
<span class="total-text">共{{ total }}条记录</span>
|
<span class="total-text">Total {{ total }} records</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -146,7 +146,7 @@ export default {
|
||||||
selectedDictType: null,
|
selectedDictType: null,
|
||||||
selectedDictTypes: [], // 恢复多选数组
|
selectedDictTypes: [], // 恢复多选数组
|
||||||
dictTypeDialogVisible: false,
|
dictTypeDialogVisible: false,
|
||||||
dictTypeDialogTitle: '新增字典类型',
|
dictTypeDialogTitle: 'Add Dictionary Type',
|
||||||
dictTypeForm: {
|
dictTypeForm: {
|
||||||
id: null,
|
id: null,
|
||||||
dictName: '',
|
dictName: '',
|
||||||
|
|
@ -158,7 +158,7 @@ export default {
|
||||||
dictDataLoading: false,
|
dictDataLoading: false,
|
||||||
isAllDictDataSelected: false,
|
isAllDictDataSelected: false,
|
||||||
dictDataDialogVisible: false,
|
dictDataDialogVisible: false,
|
||||||
dictDataDialogTitle: '新增字典数据',
|
dictDataDialogTitle: 'Add Dictionary Data',
|
||||||
dictDataForm: {
|
dictDataForm: {
|
||||||
id: null,
|
id: null,
|
||||||
dictTypeId: null,
|
dictTypeId: null,
|
||||||
|
|
@ -211,7 +211,7 @@ export default {
|
||||||
return row === this.selectedDictType ? 'current-row' : ''
|
return row === this.selectedDictType ? 'current-row' : ''
|
||||||
},
|
},
|
||||||
showAddDictTypeDialog() {
|
showAddDictTypeDialog() {
|
||||||
this.dictTypeDialogTitle = '新增字典类型'
|
this.dictTypeDialogTitle = 'Add Dictionary Type'
|
||||||
this.dictTypeForm = {
|
this.dictTypeForm = {
|
||||||
id: null,
|
id: null,
|
||||||
dictName: '',
|
dictName: '',
|
||||||
|
|
@ -220,7 +220,7 @@ export default {
|
||||||
this.dictTypeDialogVisible = true
|
this.dictTypeDialogVisible = true
|
||||||
},
|
},
|
||||||
editDictType(row) {
|
editDictType(row) {
|
||||||
this.dictTypeDialogTitle = '编辑字典类型'
|
this.dictTypeDialogTitle = 'Edit Dictionary Type'
|
||||||
this.dictTypeForm = { ...row }
|
this.dictTypeForm = { ...row }
|
||||||
this.dictTypeDialogVisible = true
|
this.dictTypeDialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
@ -228,7 +228,7 @@ export default {
|
||||||
const api = formData.id ? dictApi.updateDictType : dictApi.addDictType
|
const api = formData.id ? dictApi.updateDictType : dictApi.addDictType
|
||||||
api(formData, ({ data }) => {
|
api(formData, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('保存成功')
|
this.$message.success('Saved successfully')
|
||||||
this.dictTypeDialogVisible = false
|
this.dictTypeDialogVisible = false
|
||||||
this.loadDictTypeList()
|
this.loadDictTypeList()
|
||||||
}
|
}
|
||||||
|
|
@ -236,19 +236,19 @@ export default {
|
||||||
},
|
},
|
||||||
batchDeleteDictType() {
|
batchDeleteDictType() {
|
||||||
if (this.selectedDictTypes.length === 0) {
|
if (this.selectedDictTypes.length === 0) {
|
||||||
this.$message.warning('请选择要删除的字典类型')
|
this.$message.warning('Please select dictionary types to delete')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$confirm('确定要删除选中的字典类型吗?', '提示', {
|
this.$confirm('Are you sure you want to delete the selected dictionary types?', 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const ids = this.selectedDictTypes.map(item => item.id)
|
const ids = this.selectedDictTypes.map(item => item.id)
|
||||||
dictApi.deleteDictType(ids, ({ data }) => {
|
dictApi.deleteDictType(ids, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('Deleted successfully')
|
||||||
this.loadDictTypeList()
|
this.loadDictTypeList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -289,7 +289,7 @@ export default {
|
||||||
this.$message.warning('请先选择字典类型')
|
this.$message.warning('请先选择字典类型')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.dictDataDialogTitle = '新增字典数据'
|
this.dictDataDialogTitle = 'Add Dictionary Data'
|
||||||
this.dictDataForm = {
|
this.dictDataForm = {
|
||||||
id: null,
|
id: null,
|
||||||
dictTypeId: this.selectedDictType.id,
|
dictTypeId: this.selectedDictType.id,
|
||||||
|
|
@ -300,7 +300,7 @@ export default {
|
||||||
this.dictDataDialogVisible = true
|
this.dictDataDialogVisible = true
|
||||||
},
|
},
|
||||||
editDictData(row) {
|
editDictData(row) {
|
||||||
this.dictDataDialogTitle = '编辑字典数据'
|
this.dictDataDialogTitle = 'Edit Dictionary Data'
|
||||||
this.dictDataForm = { ...row }
|
this.dictDataForm = { ...row }
|
||||||
this.dictDataDialogVisible = true
|
this.dictDataDialogVisible = true
|
||||||
},
|
},
|
||||||
|
|
@ -308,21 +308,21 @@ export default {
|
||||||
const api = formData.id ? dictApi.updateDictData : dictApi.addDictData
|
const api = formData.id ? dictApi.updateDictData : dictApi.addDictData
|
||||||
api(formData, ({ data }) => {
|
api(formData, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('保存成功')
|
this.$message.success('Saved successfully')
|
||||||
this.dictDataDialogVisible = false
|
this.dictDataDialogVisible = false
|
||||||
this.loadDictDataList(formData.dictTypeId)
|
this.loadDictDataList(formData.dictTypeId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteDictData(row) {
|
deleteDictData(row) {
|
||||||
this.$confirm('确定要删除该字典数据吗?', '提示', {
|
this.$confirm('Are you sure you want to delete this dictionary data?', 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
dictApi.deleteDictData([row.id], ({ data }) => {
|
dictApi.deleteDictData([row.id], ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('Deleted successfully')
|
||||||
this.loadDictDataList(row.dictTypeId)
|
this.loadDictDataList(row.dictTypeId)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -331,19 +331,19 @@ export default {
|
||||||
batchDeleteDictData() {
|
batchDeleteDictData() {
|
||||||
const selectedRows = this.dictDataList.filter(row => row.selected)
|
const selectedRows = this.dictDataList.filter(row => row.selected)
|
||||||
if (selectedRows.length === 0) {
|
if (selectedRows.length === 0) {
|
||||||
this.$message.warning('请选择要删除的字典数据')
|
this.$message.warning('Please select dictionary data to delete')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$confirm(`确定要删除选中的${selectedRows.length}个字典数据吗?`, '提示', {
|
this.$confirm(`Are you sure you want to delete ${selectedRows.length} selected dictionary data?`, 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const ids = selectedRows.map(item => item.id)
|
const ids = selectedRows.map(item => item.id)
|
||||||
dictApi.deleteDictData(ids, ({ data }) => {
|
dictApi.deleteDictData(ids, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('Deleted successfully')
|
||||||
this.loadDictDataList(this.selectedDictType.id)
|
this.loadDictDataList(this.selectedDictType.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -6,86 +6,86 @@
|
||||||
<h2 class="page-title">{{ modelTypeText }}</h2>
|
<h2 class="page-title">{{ modelTypeText }}</h2>
|
||||||
<div class="action-group">
|
<div class="action-group">
|
||||||
<div class="search-group">
|
<div class="search-group">
|
||||||
<el-input placeholder="请输入模型名称查询" v-model="search" class="search-input" clearable
|
<el-input placeholder="Enter model name to search" v-model="search" class="search-input" clearable
|
||||||
@keyup.enter.native="handleSearch" style="width: 240px" />
|
@keyup.enter.native="handleSearch" style="width: 240px" />
|
||||||
<el-button class="btn-search" @click="handleSearch">
|
<el-button class="btn-search" @click="handleSearch">
|
||||||
搜索
|
Search
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 主体内容 -->
|
<!-- Main Content -->
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
<div class="content-panel">
|
<div class="content-panel">
|
||||||
<!-- 左侧导航 -->
|
<!-- Left Navigation -->
|
||||||
<el-menu :default-active="activeTab" class="nav-panel" @select="handleMenuSelect"
|
<el-menu :default-active="activeTab" class="nav-panel" @select="handleMenuSelect"
|
||||||
style="background-size: cover; background-position: center;">
|
style="background-size: cover; background-position: center;">
|
||||||
<el-menu-item index="vad">
|
<el-menu-item index="vad">
|
||||||
<span class="menu-text">语言活动检测</span>
|
<span class="menu-text">Voice Activity Detection</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="asr">
|
<el-menu-item index="asr">
|
||||||
<span class="menu-text">语音识别</span>
|
<span class="menu-text">Speech Recognition</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="llm">
|
<el-menu-item index="llm">
|
||||||
<span class="menu-text">大语言模型</span>
|
<span class="menu-text">Large Language Model</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="vllm">
|
<el-menu-item index="vllm">
|
||||||
<span class="menu-text">视觉大模型</span>
|
<span class="menu-text">Vision Language Model</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="intent">
|
<el-menu-item index="intent">
|
||||||
<span class="menu-text">意图识别</span>
|
<span class="menu-text">Intent Recognition</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="tts">
|
<el-menu-item index="tts">
|
||||||
<span class="menu-text">语音合成</span>
|
<span class="menu-text">Text-to-Speech</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="memory">
|
<el-menu-item index="memory">
|
||||||
<span class="menu-text">记忆</span>
|
<span class="menu-text">Memory</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
|
||||||
<!-- 右侧内容 -->
|
<!-- Right Content -->
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="model-card" shadow="never">
|
<el-card class="model-card" shadow="never">
|
||||||
<el-table ref="modelTable" style="width: 100%" v-loading="loading" element-loading-text="拼命加载中"
|
<el-table ref="modelTable" style="width: 100%" v-loading="loading" element-loading-text="Loading..."
|
||||||
element-loading-spinner="el-icon-loading" element-loading-background="rgba(255, 255, 255, 0.7)"
|
element-loading-spinner="el-icon-loading" element-loading-background="rgba(255, 255, 255, 0.7)"
|
||||||
:header-cell-style="{ background: 'transparent' }" :data="modelList" class="data-table"
|
:header-cell-style="{ background: 'transparent' }" :data="modelList" class="data-table"
|
||||||
header-row-class-name="table-header" :header-cell-class-name="headerCellClassName"
|
header-row-class-name="table-header" :header-cell-class-name="headerCellClassName"
|
||||||
@selection-change="handleSelectionChange">
|
@selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||||||
<el-table-column label="模型ID" prop="id" align="center"></el-table-column>
|
<el-table-column label="Model ID" prop="id" align="center"></el-table-column>
|
||||||
<el-table-column label="模型名称" prop="modelName" align="center"></el-table-column>
|
<el-table-column label="Model Name" prop="modelName" align="center"></el-table-column>
|
||||||
<el-table-column label="提供商" align="center">
|
<el-table-column label="Provider" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.configJson.type || '未知' }}
|
{{ scope.row.configJson.type || 'Unknown' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否启用" align="center">
|
<el-table-column label="Enabled" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch v-model="scope.row.isEnabled" class="custom-switch" :active-value="1" :inactive-value="0"
|
<el-switch v-model="scope.row.isEnabled" class="custom-switch" :active-value="1" :inactive-value="0"
|
||||||
@change="handleStatusChange(scope.row)" />
|
@change="handleStatusChange(scope.row)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="是否默认" align="center">
|
<el-table-column label="Default" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch v-model="scope.row.isDefault" class="custom-switch" :active-value="1" :inactive-value="0"
|
<el-switch v-model="scope.row.isDefault" class="custom-switch" :active-value="1" :inactive-value="0"
|
||||||
@change="handleDefaultChange(scope.row)" />
|
@change="handleDefaultChange(scope.row)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="activeTab === 'tts'" label="音色管理" align="center">
|
<el-table-column v-if="activeTab === 'tts'" label="Voice Management" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="mini" @click="openTtsDialog(scope.row)" class="voice-management-btn">
|
<el-button type="text" size="mini" @click="openTtsDialog(scope.row)" class="voice-management-btn">
|
||||||
音色管理
|
Voice Settings
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="150px">
|
<el-table-column label="Actions" align="center" width="150px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="mini" @click="editModel(scope.row)" class="edit-btn">
|
<el-button type="text" size="mini" @click="editModel(scope.row)" class="edit-btn">
|
||||||
修改
|
Edit
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="text" size="mini" @click="deleteModel(scope.row)" class="delete-btn">
|
<el-button type="text" size="mini" @click="deleteModel(scope.row)" class="delete-btn">
|
||||||
删除
|
Delete
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -94,32 +94,32 @@
|
||||||
<div class="batch-actions">
|
<div class="batch-actions">
|
||||||
<el-button size="mini" type="primary" @click="selectAll">
|
<el-button size="mini" type="primary" @click="selectAll">
|
||||||
{{ isAllSelected ?
|
{{ isAllSelected ?
|
||||||
'取消全选' : '全选' }}
|
'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="success" size="mini" @click="addModel" class="add-btn">
|
<el-button type="success" size="mini" @click="addModel" class="add-btn">
|
||||||
新增
|
Add
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">
|
||||||
删除
|
Delete
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
|
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`" :value="item">
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">首页</button>
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">First</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">上一页</button>
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">Previous</button>
|
||||||
|
|
||||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">下一页</button>
|
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">Next</button>
|
||||||
<span class="total-text">共{{ total }}条记录</span>
|
<span class="total-text">Total {{ total }} records</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -174,15 +174,15 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
modelTypeText() {
|
modelTypeText() {
|
||||||
const map = {
|
const map = {
|
||||||
vad: '语言活动检测模型(VAD)',
|
vad: 'Voice Activity Detection (VAD)',
|
||||||
asr: '语音识别模型(ASR)',
|
asr: 'Automatic Speech Recognition (ASR)',
|
||||||
llm: '大语言模型(LLM)',
|
llm: 'Large Language Model (LLM)',
|
||||||
vllm: '视觉大模型(VLLM)',
|
vllm: 'Vision Language Model (VLLM)',
|
||||||
intent: '意图识别模型(Intent)',
|
intent: 'Intent Recognition (Intent)',
|
||||||
tts: '语音合成模型(TTS)',
|
tts: 'Text-to-Speech (TTS)',
|
||||||
memory: '记忆模型(Memory)'
|
memory: 'Memory Model'
|
||||||
}
|
}
|
||||||
return map[this.activeTab] || '模型配置'
|
return map[this.activeTab] || 'Model Configuration'
|
||||||
},
|
},
|
||||||
pageCount() {
|
pageCount() {
|
||||||
return Math.ceil(this.total / this.pageSize);
|
return Math.ceil(this.total / this.pageSize);
|
||||||
|
|
@ -223,24 +223,24 @@ export default {
|
||||||
},
|
},
|
||||||
handleMenuSelect(index) {
|
handleMenuSelect(index) {
|
||||||
this.activeTab = index;
|
this.activeTab = index;
|
||||||
this.currentPage = 1; // 重置到第一页
|
this.currentPage = 1; // Reset to first page
|
||||||
this.pageSize = 10; // 可选:重置每页条数
|
this.pageSize = 10; // Optional: reset page size
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
// 批量删除
|
// Batch delete
|
||||||
batchDelete() {
|
batchDelete() {
|
||||||
if (this.selectedModels.length === 0) {
|
if (this.selectedModels.length === 0) {
|
||||||
this.$message.warning('请先选择要删除的模型')
|
this.$message.warning('Please select models to delete')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$confirm('确定要删除选中的模型吗?', '提示', {
|
this.$confirm('Are you sure you want to delete the selected models?', 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const deletePromises = this.selectedModels.map(model =>
|
const deletePromises = this.selectedModels.map(model =>
|
||||||
|
|
@ -255,19 +255,19 @@ export default {
|
||||||
Promise.all(deletePromises).then(results => {
|
Promise.all(deletePromises).then(results => {
|
||||||
if (results.every(Boolean)) {
|
if (results.every(Boolean)) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: '批量删除成功',
|
message: 'Batch deletion successful',
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
this.loadData()
|
this.loadData()
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '部分删除失败',
|
message: 'Some deletions failed',
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message.info('已取消删除')
|
this.$message.info('Deletion cancelled')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addModel() {
|
addModel() {
|
||||||
|
|
@ -277,11 +277,11 @@ export default {
|
||||||
this.editModelData = JSON.parse(JSON.stringify(model));
|
this.editModelData = JSON.parse(JSON.stringify(model));
|
||||||
this.editDialogVisible = true;
|
this.editDialogVisible = true;
|
||||||
},
|
},
|
||||||
// 删除单个模型
|
// Delete single model
|
||||||
deleteModel(model) {
|
deleteModel(model) {
|
||||||
this.$confirm('确定要删除该模型吗?', '提示', {
|
this.$confirm('Are you sure you want to delete this model?', 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
Api.model.deleteModel(
|
Api.model.deleteModel(
|
||||||
|
|
@ -289,20 +289,20 @@ export default {
|
||||||
({ data }) => {
|
({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: '删除成功',
|
message: 'Deletion successful',
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
this.loadData()
|
this.loadData()
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '删除失败',
|
message: data.msg || 'Deletion failed',
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message.info('已取消删除')
|
this.$message.info('Deletion cancelled')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleCurrentChange(page) {
|
handleCurrentChange(page) {
|
||||||
|
|
@ -317,13 +317,13 @@ export default {
|
||||||
{ modelType, provideCode, id, formData },
|
{ modelType, provideCode, id, formData },
|
||||||
({ data }) => {
|
({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('保存成功');
|
this.$message.success('Saved successfully');
|
||||||
this.loadData();
|
this.loadData();
|
||||||
this.editDialogVisible = false;
|
this.editDialogVisible = false;
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '保存失败');
|
this.$message.error(data.msg || 'Save failed');
|
||||||
}
|
}
|
||||||
done && done(); // 调用done回调关闭加载状态
|
done && done(); // Call done callback to close loading state
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -342,7 +342,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 新增模型配置
|
// Add model configuration
|
||||||
handleAddConfirm(newModel) {
|
handleAddConfirm(newModel) {
|
||||||
const params = {
|
const params = {
|
||||||
modelType: this.activeTab,
|
modelType: this.activeTab,
|
||||||
|
|
@ -371,7 +371,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 分页器
|
// Pagination
|
||||||
goFirst() {
|
goFirst() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.loadData();
|
this.loadData();
|
||||||
|
|
@ -393,9 +393,9 @@ export default {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取模型配置列表
|
// Get model configuration list
|
||||||
loadData() {
|
loadData() {
|
||||||
this.loading = true; // 开始加载
|
this.loading = true; // Start loading
|
||||||
const params = {
|
const params = {
|
||||||
modelType: this.activeTab,
|
modelType: this.activeTab,
|
||||||
modelName: this.search,
|
modelName: this.search,
|
||||||
|
|
@ -404,7 +404,7 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
Api.model.getModelList(params, ({ data }) => {
|
Api.model.getModelList(params, ({ data }) => {
|
||||||
this.loading = false; // 结束加载
|
this.loading = false; // End loading
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.modelList = data.data.list;
|
this.modelList = data.data.list;
|
||||||
this.total = data.data.total;
|
this.total = data.data.total;
|
||||||
|
|
@ -413,7 +413,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 处理启用/禁用状态变更
|
// Handle enable/disable status change
|
||||||
handleStatusChange(model) {
|
handleStatusChange(model) {
|
||||||
const newStatus = model.isEnabled ? 1 : 0
|
const newStatus = model.isEnabled ? 1 : 0
|
||||||
const originalStatus = model.isEnabled
|
const originalStatus = model.isEnabled
|
||||||
|
|
@ -425,13 +425,13 @@ export default {
|
||||||
newStatus,
|
newStatus,
|
||||||
({ data }) => {
|
({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success(newStatus === 1 ? '启用成功' : '禁用成功')
|
this.$message.success(newStatus === 1 ? 'Enabled successfully' : 'Disabled successfully')
|
||||||
// 保持新状态
|
// Keep new status
|
||||||
model.isEnabled = newStatus
|
model.isEnabled = newStatus
|
||||||
} else {
|
} else {
|
||||||
// 操作失败时恢复原状态
|
// Restore original status on operation failure
|
||||||
model.isEnabled = originalStatus
|
model.isEnabled = originalStatus
|
||||||
this.$message.error(data.msg || '操作失败')
|
this.$message.error(data.msg || 'Operation failed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -439,7 +439,7 @@ export default {
|
||||||
handleDefaultChange(model) {
|
handleDefaultChange(model) {
|
||||||
Api.model.setDefaultModel(model.id, ({ data }) => {
|
Api.model.setDefaultModel(model.id, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success('设置默认模型成功')
|
this.$message.success('Default model set successfully')
|
||||||
this.loadData()
|
this.loadData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -741,7 +741,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-table .custom-selection-header .cell::before {
|
::v-deep .el-table .custom-selection-header .cell::before {
|
||||||
content: '选择';
|
content: 'Select';
|
||||||
display: block;
|
display: block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
|
|
@ -808,7 +808,7 @@ export default {
|
||||||
|
|
||||||
.voice-management-btn:hover {
|
.voice-management-btn:hover {
|
||||||
background: #8aa2e0;
|
background: #8aa2e0;
|
||||||
/* 悬停时颜色加深 */
|
/* Darken color on hover */
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -831,13 +831,13 @@ export default {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 分页器 */
|
/* Pagination */
|
||||||
.custom-pagination {
|
.custom-pagination {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
/* 导航按钮样式 (首页、上一页、下一页) */
|
/* Navigation button styles (First, Previous, Next) */
|
||||||
.pagination-btn:first-child,
|
.pagination-btn:first-child,
|
||||||
.pagination-btn:nth-child(2),
|
.pagination-btn:nth-child(2),
|
||||||
.pagination-btn:nth-child(3),
|
.pagination-btn:nth-child(3),
|
||||||
|
|
@ -863,7 +863,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 数字按钮样式 */
|
/* Number button styles */
|
||||||
.pagination-btn:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(:nth-last-child(2)) {
|
.pagination-btn:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(:nth-last-child(2)) {
|
||||||
min-width: 28px;
|
min-width: 28px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">固件管理</h2>
|
<h2 class="page-title">Firmware Management</h2>
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-input placeholder="请输入固件名称查询" v-model="searchName" class="search-input"
|
<el-input placeholder="Enter firmware name to search" v-model="searchName" class="search-input"
|
||||||
@keyup.enter.native="handleSearch" clearable />
|
@keyup.enter.native="handleSearch" clearable />
|
||||||
<el-button class="btn-search" @click="handleSearch">搜索</el-button>
|
<el-button class="btn-search" @click="handleSearch">Search</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -16,44 +16,44 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="params-card" shadow="never">
|
<el-card class="params-card" shadow="never">
|
||||||
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)"
|
element-loading-background="rgba(255, 255, 255, 0.7)"
|
||||||
:header-cell-class-name="headerCellClassName">
|
:header-cell-class-name="headerCellClassName">
|
||||||
<el-table-column label="选择" align="center" width="120">
|
<el-table-column label="Select" align="center" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="固件名称" prop="firmwareName" align="center"></el-table-column>
|
<el-table-column label="Firmware Name" prop="firmwareName" align="center"></el-table-column>
|
||||||
<el-table-column label="固件类型" prop="type" align="center">
|
<el-table-column label="Firmware Type" prop="type" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ getFirmwareTypeName(scope.row.type) }}
|
{{ getFirmwareTypeName(scope.row.type) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="版本号" prop="version" align="center"></el-table-column>
|
<el-table-column label="Version" prop="version" align="center"></el-table-column>
|
||||||
<el-table-column label="文件大小" prop="size" align="center">
|
<el-table-column label="File Size" prop="size" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatFileSize(scope.row.size) }}
|
{{ formatFileSize(scope.row.size) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" prop="remark" align="center"
|
<el-table-column label="Remark" prop="remark" align="center"
|
||||||
show-overflow-tooltip></el-table-column>
|
show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column label="创建时间" prop="createDate" align="center">
|
<el-table-column label="Create Time" prop="createDate" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatDate(scope.row.createDate) }}
|
{{ formatDate(scope.row.createDate) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="更新时间" prop="updateDate" align="center">
|
<el-table-column label="Update Time" prop="updateDate" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatDate(scope.row.updateDate) }}
|
{{ formatDate(scope.row.updateDate) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="Actions" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text"
|
<el-button size="mini" type="text"
|
||||||
@click="downloadFirmware(scope.row)">下载</el-button>
|
@click="downloadFirmware(scope.row)">Download</el-button>
|
||||||
<el-button size="mini" type="text" @click="editParam(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" @click="editParam(scope.row)">Edit</el-button>
|
||||||
<el-button size="mini" type="text" @click="deleteParam(scope.row)">删除</el-button>
|
<el-button size="mini" type="text" @click="deleteParam(scope.row)">Delete</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -61,33 +61,33 @@
|
||||||
<div class="table_bottom">
|
<div class="table_bottom">
|
||||||
<div class="ctrl_btn">
|
<div class="ctrl_btn">
|
||||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||||
{{ isAllSelected ? '取消全选' : '全选' }}
|
{{ isAllSelected ? 'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="success" @click="showAddDialog"
|
<el-button size="mini" type="success" @click="showAddDialog"
|
||||||
style="background: #5bc98c;border: None;">新增</el-button>
|
style="background: #5bc98c;border: None;">Add</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete"
|
<el-button size="mini" type="danger" icon="el-icon-delete"
|
||||||
@click="deleteSelectedParams">删除</el-button>
|
@click="deleteSelectedParams">Delete</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`"
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`"
|
||||||
:value="item">
|
:value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
First
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
||||||
上一页
|
Previous
|
||||||
</button>
|
</button>
|
||||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
||||||
下一页
|
Next
|
||||||
</button>
|
</button>
|
||||||
<span class="total-text">共{{ total }}条记录</span>
|
<span class="total-text">Total {{ total }} records</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增/编辑固件对话框 -->
|
<!-- Add/Edit Firmware Dialog -->
|
||||||
<firmware-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="firmwareForm"
|
<firmware-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="firmwareForm"
|
||||||
:firmware-types="firmwareTypes" @submit="handleSubmit" @cancel="dialogVisible = false" />
|
:firmware-types="firmwareTypes" @submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||||
<el-footer>
|
<el-footer>
|
||||||
|
|
@ -193,7 +193,7 @@ export default {
|
||||||
this.paramsList = [];
|
this.paramsList = [];
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: res?.data?.msg || '获取固件列表失败',
|
message: res?.data?.msg || 'Failed to get firmware list',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -222,7 +222,7 @@ export default {
|
||||||
firmwarePath: ""
|
firmwarePath: ""
|
||||||
};
|
};
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// 重置表单的校验状态
|
// Reset form validation state
|
||||||
if (this.$refs.firmwareDialog && this.$refs.firmwareDialog.$refs.form) {
|
if (this.$refs.firmwareDialog && this.$refs.firmwareDialog.$refs.form) {
|
||||||
this.$refs.firmwareDialog.$refs.form.clearValidate();
|
this.$refs.firmwareDialog.$refs.form.clearValidate();
|
||||||
}
|
}
|
||||||
|
|
@ -236,37 +236,37 @@ export default {
|
||||||
},
|
},
|
||||||
handleSubmit(form) {
|
handleSubmit(form) {
|
||||||
if (form.id) {
|
if (form.id) {
|
||||||
// 编辑
|
// Edit
|
||||||
Api.ota.updateOta(form.id, form, (res) => {
|
Api.ota.updateOta(form.id, form, (res) => {
|
||||||
res = res.data;
|
res = res.data;
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "修改成功",
|
message: "Update successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.fetchFirmwareList();
|
this.fetchFirmwareList();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: res.msg || "修改失败",
|
message: res.msg || "Update failed",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// Add
|
||||||
Api.ota.saveOta(form, (res) => {
|
Api.ota.saveOta(form, (res) => {
|
||||||
res = res.data;
|
res = res.data;
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "新增成功",
|
message: "Add successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.fetchFirmwareList();
|
this.fetchFirmwareList();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: res.msg || "新增失败",
|
message: res.msg || "Add failed",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -278,7 +278,7 @@ export default {
|
||||||
const selectedRows = this.firmwareList.filter(row => row.selected);
|
const selectedRows = this.firmwareList.filter(row => row.selected);
|
||||||
if (selectedRows.length === 0) {
|
if (selectedRows.length === 0) {
|
||||||
this.$message.warning({
|
this.$message.warning({
|
||||||
message: "请先选择需要删除的固件",
|
message: "Please select firmware to delete first",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -286,28 +286,28 @@ export default {
|
||||||
this.deleteParam(selectedRows);
|
this.deleteParam(selectedRows);
|
||||||
},
|
},
|
||||||
deleteParam(row) {
|
deleteParam(row) {
|
||||||
// 处理单个参数或参数数组
|
// Handle single parameter or parameter array
|
||||||
const params = Array.isArray(row) ? row : [row];
|
const params = Array.isArray(row) ? row : [row];
|
||||||
|
|
||||||
if (Array.isArray(row) && row.length === 0) {
|
if (Array.isArray(row) && row.length === 0) {
|
||||||
this.$message.warning({
|
this.$message.warning({
|
||||||
message: "请先选择需要删除的参数",
|
message: "Please select parameters to delete first",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const paramCount = params.length;
|
const paramCount = params.length;
|
||||||
this.$confirm(`确定要删除选中的${paramCount}个固件吗?`, '警告', {
|
this.$confirm(`Are you sure you want to delete ${paramCount} selected firmware?`, 'Warning', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
distinguishCancelAndClose: true
|
distinguishCancelAndClose: true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const ids = params.map(param => param.id);
|
const ids = params.map(param => param.id);
|
||||||
if (ids.some(id => !id)) {
|
if (ids.some(id => !id)) {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '存在无效的参数ID',
|
message: 'Invalid parameter ID exists',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -317,13 +317,13 @@ export default {
|
||||||
res = res.data;
|
res = res.data;
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功删除${paramCount}个固件`,
|
message: `Successfully deleted ${paramCount} firmware`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchFirmwareList();
|
this.fetchFirmwareList();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: res.msg || '删除失败,请重试',
|
message: res.msg || 'Delete failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -332,13 +332,13 @@ export default {
|
||||||
if (action === 'cancel') {
|
if (action === 'cancel') {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除操作',
|
message: 'Delete operation cancelled',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '操作已关闭',
|
message: 'Operation closed',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -372,17 +372,17 @@ export default {
|
||||||
},
|
},
|
||||||
downloadFirmware(firmware) {
|
downloadFirmware(firmware) {
|
||||||
if (!firmware || !firmware.id) {
|
if (!firmware || !firmware.id) {
|
||||||
this.$message.error('固件信息不完整');
|
this.$message.error('Incomplete firmware information');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 先获取下载链接
|
// First get download link
|
||||||
Api.ota.getDownloadUrl(firmware.id, (res) => {
|
Api.ota.getDownloadUrl(firmware.id, (res) => {
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
const uuid = res.data.data;
|
const uuid = res.data.data;
|
||||||
const baseUrl = process.env.VUE_APP_API_BASE_URL || '';
|
const baseUrl = process.env.VUE_APP_API_BASE_URL || '';
|
||||||
window.open(`${window.location.origin}${baseUrl}/otaMag/download/${uuid}`);
|
window.open(`${window.location.origin}${baseUrl}/otaMag/download/${uuid}`);
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('获取下载链接失败');
|
this.$message.error('Failed to get download link');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -393,8 +393,8 @@ export default {
|
||||||
const res = await Api.dict.getDictDataByType('FIRMWARE_TYPE')
|
const res = await Api.dict.getDictDataByType('FIRMWARE_TYPE')
|
||||||
this.firmwareTypes = res.data
|
this.firmwareTypes = res.data
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取固件类型失败:', error)
|
console.error('Failed to get firmware types:', error)
|
||||||
this.$message.error(error.message || '获取固件类型失败')
|
this.$message.error(error.message || 'Failed to get firmware types')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getFirmwareTypeName(type) {
|
getFirmwareTypeName(type) {
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">参数管理</h2>
|
<h2 class="page-title">Parameter Management</h2>
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-input placeholder="请输入参数编码或备注查询" v-model="searchCode" class="search-input"
|
<el-input placeholder="Enter parameter code or remark to search" v-model="searchCode" class="search-input"
|
||||||
@keyup.enter.native="handleSearch" clearable />
|
@keyup.enter.native="handleSearch" clearable />
|
||||||
<el-button class="btn-search" @click="handleSearch">搜索</el-button>
|
<el-button class="btn-search" @click="handleSearch">Search</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -16,33 +16,33 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="params-card" shadow="never">
|
<el-card class="params-card" shadow="never">
|
||||||
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)"
|
element-loading-background="rgba(255, 255, 255, 0.7)"
|
||||||
:header-cell-class-name="headerCellClassName">
|
:header-cell-class-name="headerCellClassName">
|
||||||
<el-table-column label="选择" align="center" width="120">
|
<el-table-column label="Select" align="center" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="参数编码" prop="paramCode" align="center"></el-table-column>
|
<el-table-column label="Parameter Code" prop="paramCode" align="center"></el-table-column>
|
||||||
<el-table-column label="参数值" prop="paramValue" align="center" show-overflow-tooltip>
|
<el-table-column label="Parameter Value" prop="paramValue" align="center" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div v-if="isSensitiveParam(scope.row.paramCode)">
|
<div v-if="isSensitiveParam(scope.row.paramCode)">
|
||||||
<span v-if="!scope.row.showValue">{{ maskSensitiveValue(scope.row.paramValue)
|
<span v-if="!scope.row.showValue">{{ maskSensitiveValue(scope.row.paramValue)
|
||||||
}}</span>
|
}}</span>
|
||||||
<span v-else>{{ scope.row.paramValue }}</span>
|
<span v-else>{{ scope.row.paramValue }}</span>
|
||||||
<el-button size="mini" type="text" @click="toggleSensitiveValue(scope.row)">
|
<el-button size="mini" type="text" @click="toggleSensitiveValue(scope.row)">
|
||||||
{{ scope.row.showValue ? '隐藏' : '查看' }}
|
{{ scope.row.showValue ? 'Hide' : 'View' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<span v-else>{{ scope.row.paramValue }}</span>
|
<span v-else>{{ scope.row.paramValue }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" prop="remark" align="center"></el-table-column>
|
<el-table-column label="Remark" prop="remark" align="center"></el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="Actions" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="editParam(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" @click="editParam(scope.row)">Edit</el-button>
|
||||||
<el-button size="mini" type="text" @click="deleteParam(scope.row)">删除</el-button>
|
<el-button size="mini" type="text" @click="deleteParam(scope.row)">Delete</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -50,32 +50,32 @@
|
||||||
<div class="table_bottom">
|
<div class="table_bottom">
|
||||||
<div class="ctrl_btn">
|
<div class="ctrl_btn">
|
||||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||||
{{ isAllSelected ? '取消全选' : '全选' }}
|
{{ isAllSelected ? 'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="success" @click="showAddDialog">新增</el-button>
|
<el-button size="mini" type="success" @click="showAddDialog">Add</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete"
|
<el-button size="mini" type="danger" icon="el-icon-delete"
|
||||||
@click="deleteSelectedParams">删除</el-button>
|
@click="deleteSelectedParams">Delete</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`"
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`"
|
||||||
:value="item">
|
:value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
First
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
||||||
上一页
|
Previous
|
||||||
</button>
|
</button>
|
||||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
<button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
||||||
下一页
|
Next
|
||||||
</button>
|
</button>
|
||||||
<span class="total-text">共{{ total }}条记录</span>
|
<span class="total-text">Total {{ total }} records</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -109,7 +109,7 @@ export default {
|
||||||
pageSizeOptions: [10, 20, 50, 100],
|
pageSizeOptions: [10, 20, 50, 100],
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: "新增参数",
|
dialogTitle: "Add Parameter",
|
||||||
isAllSelected: false,
|
isAllSelected: false,
|
||||||
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
|
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
|
||||||
paramForm: {
|
paramForm: {
|
||||||
|
|
@ -170,7 +170,7 @@ export default {
|
||||||
this.total = data.data.total;
|
this.total = data.data.total;
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '获取参数列表失败',
|
message: data.msg || 'Failed to get parameter list',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showAddDialog() {
|
showAddDialog() {
|
||||||
this.dialogTitle = "新增参数";
|
this.dialogTitle = "Add Parameter";
|
||||||
this.paramForm = {
|
this.paramForm = {
|
||||||
id: null,
|
id: null,
|
||||||
paramCode: "",
|
paramCode: "",
|
||||||
|
|
@ -198,7 +198,7 @@ export default {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
editParam(row) {
|
editParam(row) {
|
||||||
this.dialogTitle = "编辑参数";
|
this.dialogTitle = "Edit Parameter";
|
||||||
this.paramForm = { ...row };
|
this.paramForm = { ...row };
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
|
|
@ -209,7 +209,7 @@ export default {
|
||||||
Api.admin.updateParam(form, ({ data }) => {
|
Api.admin.updateParam(form, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "修改成功",
|
message: "Update successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
|
@ -222,7 +222,7 @@ export default {
|
||||||
Api.admin.addParam(form, ({ data }) => {
|
Api.admin.addParam(form, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "新增成功",
|
message: "Added successfully",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
|
@ -237,7 +237,7 @@ export default {
|
||||||
const selectedRows = this.paramsList.filter(row => row.selected);
|
const selectedRows = this.paramsList.filter(row => row.selected);
|
||||||
if (selectedRows.length === 0) {
|
if (selectedRows.length === 0) {
|
||||||
this.$message.warning({
|
this.$message.warning({
|
||||||
message: "请先选择需要删除的参数",
|
message: "Please select parameters to delete",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -250,23 +250,23 @@ export default {
|
||||||
|
|
||||||
if (Array.isArray(row) && row.length === 0) {
|
if (Array.isArray(row) && row.length === 0) {
|
||||||
this.$message.warning({
|
this.$message.warning({
|
||||||
message: "请先选择需要删除的参数",
|
message: "Please select parameters to delete",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const paramCount = params.length;
|
const paramCount = params.length;
|
||||||
this.$confirm(`确定要删除选中的${paramCount}个参数吗?`, '警告', {
|
this.$confirm(`Are you sure you want to delete ${paramCount} selected parameter(s)?`, 'Warning', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
distinguishCancelAndClose: true
|
distinguishCancelAndClose: true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const ids = params.map(param => param.id);
|
const ids = params.map(param => param.id);
|
||||||
if (ids.some(id => isNaN(id))) {
|
if (ids.some(id => isNaN(id))) {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '存在无效的参数ID',
|
message: 'Invalid parameter ID exists',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
@ -275,13 +275,13 @@ export default {
|
||||||
Api.admin.deleteParam(ids, ({ data }) => {
|
Api.admin.deleteParam(ids, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功删除${paramCount}个参数`,
|
message: `Successfully deleted ${paramCount} parameter(s)`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchParams();
|
this.fetchParams();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '删除失败,请重试',
|
message: data.msg || 'Delete failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -290,13 +290,13 @@ export default {
|
||||||
if (action === 'cancel') {
|
if (action === 'cancel') {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除操作',
|
message: 'Delete operation cancelled',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '操作已关闭',
|
message: 'Operation closed',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,19 @@
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-dropdown trigger="click" @command="handleSelectModelType" @visible-change="handleDropdownVisibleChange">
|
<el-dropdown trigger="click" @command="handleSelectModelType" @visible-change="handleDropdownVisibleChange">
|
||||||
<el-button class="category-btn">
|
<el-button class="category-btn">
|
||||||
类别筛选 {{ selectedModelTypeLabel }}<i class="el-icon-arrow-down el-icon--right"
|
Category Filter {{ selectedModelTypeLabel }}<i class="el-icon-arrow-down el-icon--right"
|
||||||
:class="{ 'rotate-down': DropdownVisible }"></i>
|
:class="{ 'rotate-down': DropdownVisible }"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="">全部</el-dropdown-item>
|
<el-dropdown-item command="">All</el-dropdown-item>
|
||||||
<el-dropdown-item v-for="item in modelTypes" :key="item.value" :command="item.value">
|
<el-dropdown-item v-for="item in modelTypes" :key="item.value" :command="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-input placeholder="请输入供应器名称查询" v-model="searchName" class="search-input" @keyup.enter.native="handleSearch"
|
<el-input placeholder="Enter provider name to search" v-model="searchName" class="search-input" @keyup.enter.native="handleSearch"
|
||||||
clearable />
|
clearable />
|
||||||
<el-button class="btn-search" @click="handleSearch">搜索</el-button>
|
<el-button class="btn-search" @click="handleSearch">Search</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -28,24 +28,24 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="provider-card" shadow="never">
|
<el-card class="provider-card" shadow="never">
|
||||||
<el-table ref="providersTable" :data="filteredProvidersList" class="transparent-table" v-loading="loading"
|
<el-table ref="providersTable" :data="filteredProvidersList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)" :header-cell-class-name="headerCellClassName">
|
element-loading-background="rgba(255, 255, 255, 0.7)" :header-cell-class-name="headerCellClassName">
|
||||||
<el-table-column label="选择" align="center" width="120">
|
<el-table-column label="Select" align="center" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="类别" prop="modelType" align="center" width="200">
|
<el-table-column label="Category" prop="modelType" align="center" width="200">
|
||||||
<template slot="header" slot-scope="scope">
|
<template slot="header" slot-scope="scope">
|
||||||
<el-dropdown trigger="click" @command="handleSelectModelType"
|
<el-dropdown trigger="click" @command="handleSelectModelType"
|
||||||
@visible-change="isDropdownOpen = $event">
|
@visible-change="isDropdownOpen = $event">
|
||||||
<span class="dropdown-trigger" :class="{ 'active': isDropdownOpen }">
|
<span class="dropdown-trigger" :class="{ 'active': isDropdownOpen }">
|
||||||
类别{{ selectedModelTypeLabel }} <i class="dropdown-arrow"
|
Category{{ selectedModelTypeLabel }} <i class="dropdown-arrow"
|
||||||
:class="{ 'is-active': isDropdownOpen }"></i>
|
:class="{ 'is-active': isDropdownOpen }"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="">全部</el-dropdown-item>
|
<el-dropdown-item command="">All</el-dropdown-item>
|
||||||
<el-dropdown-item v-for="item in modelTypes" :key="item.value" :command="item.value">
|
<el-dropdown-item v-for="item in modelTypes" :key="item.value" :command="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
|
@ -58,25 +58,25 @@
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="供应器编码" prop="providerCode" align="center" width="150"></el-table-column>
|
<el-table-column label="Provider Code" prop="providerCode" align="center" width="150"></el-table-column>
|
||||||
<el-table-column label="名称" prop="name" align="center"></el-table-column>
|
<el-table-column label="Name" prop="name" align="center"></el-table-column>
|
||||||
<el-table-column label="字段配置" align="center">
|
<el-table-column label="Field Configuration" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-popover placement="top-start" width="400" trigger="hover">
|
<el-popover placement="top-start" width="400" trigger="hover">
|
||||||
<div v-for="field in scope.row.fields" :key="field.key" class="field-item">
|
<div v-for="field in scope.row.fields" :key="field.key" class="field-item">
|
||||||
<span class="field-label">{{ field.label }}:</span>
|
<span class="field-label">{{ field.label }}:</span>
|
||||||
<span class="field-type">{{ field.type }}</span>
|
<span class="field-type">{{ field.type }}</span>
|
||||||
<span v-if="isSensitiveField(field.key)" class="sensitive-tag">敏感</span>
|
<span v-if="isSensitiveField(field.key)" class="sensitive-tag">Sensitive</span>
|
||||||
</div>
|
</div>
|
||||||
<el-button slot="reference" size="mini" type="text">查看字段</el-button>
|
<el-button slot="reference" size="mini" type="text">View Fields</el-button>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="排序" prop="sort" align="center" width="80"></el-table-column>
|
<el-table-column label="Sort" prop="sort" align="center" width="80"></el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="180">
|
<el-table-column label="Actions" align="center" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="editProvider(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" @click="editProvider(scope.row)">Edit</el-button>
|
||||||
<el-button size="mini" type="text" @click="deleteProvider(scope.row)">删除</el-button>
|
<el-button size="mini" type="text" @click="deleteProvider(scope.row)">Delete</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -84,19 +84,19 @@
|
||||||
<div class="table_bottom">
|
<div class="table_bottom">
|
||||||
<div class="ctrl_btn">
|
<div class="ctrl_btn">
|
||||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||||
{{ isAllSelected ? '取消全选' : '全选' }}
|
{{ isAllSelected ? 'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="success" @click="showAddDialog">新增</el-button>
|
<el-button size="mini" type="success" @click="showAddDialog">Add</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteSelectedProviders">删除
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteSelectedProviders">Delete
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`" :value="item">
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
First
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
||||||
Previous
|
Previous
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增/编辑供应器对话框 -->
|
<!-- Add/Edit Provider Dialog -->
|
||||||
<provider-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="providerForm" :model-types="modelTypes"
|
<provider-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="providerForm" :model-types="modelTypes"
|
||||||
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||||
|
|
||||||
|
|
@ -175,7 +175,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
selectedModelTypeLabel() {
|
selectedModelTypeLabel() {
|
||||||
if (!this.searchModelType) return "(全部)";
|
if (!this.searchModelType) return "(All)";
|
||||||
const selectedType = this.modelTypes.find(item => item.value === this.searchModelType);
|
const selectedType = this.modelTypes.find(item => item.value === this.searchModelType);
|
||||||
return selectedType ? `(${selectedType.label})` : "";
|
return selectedType ? `(${selectedType.label})` : "";
|
||||||
},
|
},
|
||||||
|
|
@ -208,7 +208,7 @@ export default {
|
||||||
|
|
||||||
// list.sort((a, b) => a.sort - b.sort);
|
// list.sort((a, b) => a.sort - b.sort);
|
||||||
|
|
||||||
// // 分页处理
|
// // Pagination processing
|
||||||
// const start = (this.currentPage - 1) * this.pageSize;
|
// const start = (this.currentPage - 1) * this.pageSize;
|
||||||
// return list.slice(start, start + this.pageSize);
|
// return list.slice(start, start + this.pageSize);
|
||||||
}
|
}
|
||||||
|
|
@ -324,9 +324,9 @@ export default {
|
||||||
const providers = Array.isArray(row) ? row : [row];
|
const providers = Array.isArray(row) ? row : [row];
|
||||||
const providerCount = providers.length;
|
const providerCount = providers.length;
|
||||||
|
|
||||||
this.$confirm(`确定要删除选中的${providerCount}个供应器吗?`, '警告', {
|
this.$confirm(`Are you sure you want to delete ${providerCount} selected provider(s)?`, 'Warning', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const ids = providers.map(provider => provider.id);
|
const ids = providers.map(provider => provider.id);
|
||||||
|
|
@ -334,15 +334,15 @@ export default {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
|
|
||||||
this.isAllSelected = false;
|
this.isAllSelected = false;
|
||||||
this.fetchProviders(); // 刷新表格
|
this.fetchProviders(); // Refresh table
|
||||||
|
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功删除${providerCount}个参数`,
|
message: `Successfully deleted ${providerCount} provider(s)`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '删除失败,请重试',
|
message: data.msg || 'Delete failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -350,7 +350,7 @@ export default {
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除',
|
message: 'Delete cancelled',
|
||||||
showClose: true,
|
showClose: true,
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">服务端管理</h2>
|
<h2 class="page-title">Server Management</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
|
|
@ -11,19 +11,19 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="params-card" shadow="never">
|
<el-card class="params-card" shadow="never">
|
||||||
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
<el-table ref="paramsTable" :data="paramsList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)" :header-cell-class-name="headerCellClassName">
|
element-loading-background="rgba(255, 255, 255, 0.7)" :header-cell-class-name="headerCellClassName">
|
||||||
<el-table-column label="选择" align="center" width="120">
|
<el-table-column label="Select" align="center" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="ws地址" prop="address" align="center"></el-table-column>
|
<el-table-column label="WS Address" prop="address" align="center"></el-table-column>
|
||||||
<el-table-column label="操作" prop="operator" align="center" show-overflow-tooltip>
|
<el-table-column label="Actions" prop="operator" align="center" show-overflow-tooltip>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="medium" type="text" @click="emitAction(scope.row, actionMap.restart)">重启</el-button>
|
<el-button size="medium" type="text" @click="emitAction(scope.row, actionMap.restart)">Restart</el-button>
|
||||||
<el-button size="medium" type="text"
|
<el-button size="medium" type="text"
|
||||||
@click="emitAction(scope.row, actionMap.update_config)">更新配置</el-button>
|
@click="emitAction(scope.row, actionMap.update_config)">Update Config</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -53,15 +53,15 @@ export default {
|
||||||
actionMap: {
|
actionMap: {
|
||||||
restart: {
|
restart: {
|
||||||
value: 'restart',
|
value: 'restart',
|
||||||
title: "重启服务端",
|
title: "Restart Server",
|
||||||
message: "确定要重启服务端吗?",
|
message: "Are you sure you want to restart the server?",
|
||||||
confirmText: "重启",
|
confirmText: "Restart",
|
||||||
},
|
},
|
||||||
update_config: {
|
update_config: {
|
||||||
value: 'update_config',
|
value: 'update_config',
|
||||||
title: "更新配置",
|
title: "Update Configuration",
|
||||||
message: "确定要更新配置吗?",
|
message: "Are you sure you want to update the configuration?",
|
||||||
confirmText: "更新",
|
confirmText: "Update",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
|
|
@ -70,7 +70,7 @@ export default {
|
||||||
pageSizeOptions: [10, 20, 50, 100],
|
pageSizeOptions: [10, 20, 50, 100],
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: "新增参数",
|
dialogTitle: "Add Parameter",
|
||||||
isAllSelected: false,
|
isAllSelected: false,
|
||||||
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
|
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
|
||||||
paramForm: {
|
paramForm: {
|
||||||
|
|
@ -122,7 +122,7 @@ export default {
|
||||||
this.total = data.data.length;
|
this.total = data.data.length;
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '获取参数列表失败',
|
message: data.msg || 'Failed to get parameter list',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -133,24 +133,25 @@ export default {
|
||||||
if (actionItem === undefined || rowItem.address === undefined) {
|
if (actionItem === undefined || rowItem.address === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 弹开询问框
|
// Show confirmation dialog
|
||||||
this.$confirm(actionItem.message, actionItem.title, {
|
this.$confirm(actionItem.message, actionItem.title, {
|
||||||
confirmButtonText: actionItem.confirmText, // 确认按钮文本
|
confirmButtonText: actionItem.confirmText, // Confirm button text
|
||||||
|
cancelButtonText: 'Cancel'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
// 用户点击了确认按钮
|
// User clicked confirm button
|
||||||
Api.admin.sendWsServerAction({
|
Api.admin.sendWsServerAction({
|
||||||
targetWs: rowItem.address,
|
targetWs: rowItem.address,
|
||||||
action: actionItem.value
|
action: actionItem.value
|
||||||
}, ({ data }) => {
|
}, ({ data }) => {
|
||||||
if (data.code !== 0) {
|
if (data.code !== 0) {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '操作失败',
|
message: data.msg || 'Operation failed',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `${actionItem.title}成功`,
|
message: `${actionItem.title} successful`,
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">用户管理</h2>
|
<h2 class="page-title">User Management</h2>
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-input placeholder="请输入手机号码查询" v-model="searchPhone" class="search-input" clearable
|
<el-input placeholder="Enter phone number to search" v-model="searchPhone" class="search-input" clearable
|
||||||
@keyup.enter.native="handleSearch" />
|
@keyup.enter.native="handleSearch" />
|
||||||
<el-button class="btn-search" @click="handleSearch">搜索</el-button>
|
<el-button class="btn-search" @click="handleSearch">Search</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -16,31 +16,31 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="user-card" shadow="never">
|
<el-card class="user-card" shadow="never">
|
||||||
<el-table ref="userTable" :data="userList" class="transparent-table" v-loading="loading"
|
<el-table ref="userTable" :data="userList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)">
|
element-loading-background="rgba(255, 255, 255, 0.7)">
|
||||||
<el-table-column label="选择" align="center" width="120">
|
<el-table-column label="Select" align="center" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="用户Id" prop="userid" align="center"></el-table-column>
|
<el-table-column label="User ID" prop="userid" align="center"></el-table-column>
|
||||||
<el-table-column label="手机号码" prop="mobile" align="center"></el-table-column>
|
<el-table-column label="Phone Number" prop="mobile" align="center"></el-table-column>
|
||||||
<el-table-column label="设备数量" prop="deviceCount" align="center"></el-table-column>
|
<el-table-column label="Device Count" prop="deviceCount" align="center"></el-table-column>
|
||||||
<el-table-column label="注册时间" prop="createDate" align="center"></el-table-column>
|
<el-table-column label="Registration Time" prop="createDate" align="center"></el-table-column>
|
||||||
<el-table-column label="状态" prop="status" align="center">
|
<el-table-column label="Status" prop="status" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="scope.row.status === 1" type="success">正常</el-tag>
|
<el-tag v-if="scope.row.status === 1" type="success">Active</el-tag>
|
||||||
<el-tag v-else type="danger">禁用</el-tag>
|
<el-tag v-else type="danger">Disabled</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="Actions" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="resetPassword(scope.row)">重置密码</el-button>
|
<el-button size="mini" type="text" @click="resetPassword(scope.row)">Reset Password</el-button>
|
||||||
<el-button size="mini" type="text" v-if="scope.row.status === 1"
|
<el-button size="mini" type="text" v-if="scope.row.status === 1"
|
||||||
@click="handleChangeStatus(scope.row, 0)">禁用账户</el-button>
|
@click="handleChangeStatus(scope.row, 0)">Disable Account</el-button>
|
||||||
<el-button size="mini" type="text" v-if="scope.row.status === 0"
|
<el-button size="mini" type="text" v-if="scope.row.status === 0"
|
||||||
@click="handleChangeStatus(scope.row, 1)">恢复账号</el-button>
|
@click="handleChangeStatus(scope.row, 1)">Enable Account</el-button>
|
||||||
<el-button size="mini" type="text" @click="deleteUser(scope.row)">删除用户</el-button>
|
<el-button size="mini" type="text" @click="deleteUser(scope.row)">Delete User</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
@ -48,32 +48,32 @@
|
||||||
<div class="table_bottom">
|
<div class="table_bottom">
|
||||||
<div class="ctrl_btn">
|
<div class="ctrl_btn">
|
||||||
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
<el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
|
||||||
{{ isAllSelected ? '取消全选' : '全选' }}
|
{{ isAllSelected ? 'Deselect All' : 'Select All' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="success" icon="el-icon-circle-check" @click="batchEnable">启用</el-button>
|
<el-button size="mini" type="success" icon="el-icon-circle-check" @click="batchEnable">Enable</el-button>
|
||||||
<el-button size="mini" type="warning" @click="batchDisable"><i
|
<el-button size="mini" type="warning" @click="batchDisable"><i
|
||||||
class="el-icon-remove-outline rotated-icon"></i>禁用</el-button>
|
class="el-icon-remove-outline rotated-icon"></i>Disable</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">删除</el-button>
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">Delete</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="custom-pagination">
|
<div class="custom-pagination">
|
||||||
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
<el-select v-model="pageSize" @change="handlePageSizeChange" class="page-size-select">
|
||||||
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`" :value="item">
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item} items/page`" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">
|
||||||
首页
|
First
|
||||||
</button>
|
</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">
|
||||||
上一页
|
Previous
|
||||||
</button>
|
</button>
|
||||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
{{ page }}
|
{{ page }}
|
||||||
</button> <button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
</button> <button class="pagination-btn" :disabled="currentPage === pageCount" @click="goNext">
|
||||||
下一页
|
Next
|
||||||
</button>
|
</button>
|
||||||
<span class="total-text">共{{ total }}条记录</span>
|
<span class="total-text">Total {{ total }} records</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -148,7 +148,7 @@ export default {
|
||||||
mobile: this.searchPhone,
|
mobile: this.searchPhone,
|
||||||
},
|
},
|
||||||
({ data }) => {
|
({ data }) => {
|
||||||
this.loading = false; // 结束加载
|
this.loading = false; // End loading
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.userList = data.data.list.map(item => ({
|
this.userList = data.data.list.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
|
|
@ -172,19 +172,19 @@ export default {
|
||||||
batchDelete() {
|
batchDelete() {
|
||||||
const selectedUsers = this.userList.filter(user => user.selected);
|
const selectedUsers = this.userList.filter(user => user.selected);
|
||||||
if (selectedUsers.length === 0) {
|
if (selectedUsers.length === 0) {
|
||||||
this.$message.warning("请先选择需要删除的用户");
|
this.$message.warning("Please select users to delete first");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$confirm(`确定要删除选中的${selectedUsers.length}个用户吗?`, "警告", {
|
this.$confirm(`Are you sure you want to delete ${selectedUsers.length} selected users?`, "Warning", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "Confirm",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "Cancel",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: "正在删除中...",
|
text: "Deleting...",
|
||||||
spinner: "el-icon-loading",
|
spinner: "el-icon-loading",
|
||||||
background: "rgba(0, 0, 0, 0.7)",
|
background: "rgba(0, 0, 0, 0.7)",
|
||||||
});
|
});
|
||||||
|
|
@ -209,29 +209,29 @@ export default {
|
||||||
|
|
||||||
if (failCount === 0) {
|
if (failCount === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功删除${successCount}个用户`,
|
message: `Successfully deleted ${successCount} users`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
} else if (successCount === 0) {
|
} else if (successCount === 0) {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '删除失败,请重试',
|
message: 'Delete failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning(
|
this.$message.warning(
|
||||||
`成功删除${successCount}个用户,${failCount}个删除失败`
|
`Successfully deleted ${successCount} users, ${failCount} failed`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fetchUsers();
|
this.fetchUsers();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$message.error("删除过程中发生错误");
|
this.$message.error("Error occurred during deletion");
|
||||||
} finally {
|
} finally {
|
||||||
loading.close();
|
loading.close();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$message.info("已取消删除");
|
this.$message.info("Delete cancelled");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
batchEnable() {
|
batchEnable() {
|
||||||
|
|
@ -243,16 +243,16 @@ export default {
|
||||||
this.handleChangeStatus(selectedUsers, 0);
|
this.handleChangeStatus(selectedUsers, 0);
|
||||||
},
|
},
|
||||||
resetPassword(row) {
|
resetPassword(row) {
|
||||||
this.$confirm("重置后将会生成新密码,是否继续?", "提示", {
|
this.$confirm("A new password will be generated after reset, continue?", "Tip", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "Confirm",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "Cancel",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
Api.admin.resetUserPassword(row.userid, ({ data }) => {
|
Api.admin.resetUserPassword(row.userid, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.currentPassword = data.data;
|
this.currentPassword = data.data;
|
||||||
this.showViewPassword = true;
|
this.showViewPassword = true;
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "密码已重置,请通知用户使用新密码登录",
|
message: "Password has been reset, please notify the user to login with the new password",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -260,22 +260,22 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteUser(row) {
|
deleteUser(row) {
|
||||||
this.$confirm("确定要删除该用户吗?", "警告", {
|
this.$confirm("Are you sure you want to delete this user?", "Warning", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "Confirm",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "Cancel",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
Api.admin.deleteUser(row.userid, ({ data }) => {
|
Api.admin.deleteUser(row.userid, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "删除成功",
|
message: "Delete successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchUsers();
|
this.fetchUsers();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || "删除失败",
|
message: data.msg || "Delete failed",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -304,38 +304,38 @@ export default {
|
||||||
this.fetchUsers();
|
this.fetchUsers();
|
||||||
},
|
},
|
||||||
handleChangeStatus(row, status) {
|
handleChangeStatus(row, status) {
|
||||||
// 处理单个用户或用户数组
|
// Handle single user or user array
|
||||||
const users = Array.isArray(row) ? row : [row];
|
const users = Array.isArray(row) ? row : [row];
|
||||||
const confirmText = status === 0 ? '禁用' : '启用';
|
const confirmText = status === 0 ? 'disable' : 'enable';
|
||||||
const userCount = users.length;
|
const userCount = users.length;
|
||||||
|
|
||||||
this.$confirm(`确定要${confirmText}选中的${userCount}个用户吗?`, '提示', {
|
this.$confirm(`Are you sure you want to ${confirmText} ${userCount} selected users?`, 'Tip', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const userIds = users.map(user => user.userid);
|
const userIds = users.map(user => user.userid);
|
||||||
if (userIds.some(id => isNaN(id))) {
|
if (userIds.some(id => isNaN(id))) {
|
||||||
this.$message.error('存在无效的用户ID');
|
this.$message.error('Invalid user ID exists');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Api.user.changeUserStatus(status, userIds, ({ data }) => {
|
Api.user.changeUserStatus(status, userIds, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功${confirmText}${userCount}个用户`,
|
message: `Successfully ${confirmText}d ${userCount} users`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchUsers(); // 刷新用户列表
|
this.fetchUsers(); // Refresh user list
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: '操作失败,请重试',
|
message: 'Operation failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 用户取消操作
|
// User cancelled operation
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">声纹识别</h2>
|
<h2 class="page-title">Voice Recognition</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
|
|
@ -11,23 +11,23 @@
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="voice-print-card" shadow="never">
|
<el-card class="voice-print-card" shadow="never">
|
||||||
<el-table ref="paramsTable" :data="voicePrintList" class="transparent-table" v-loading="loading"
|
<el-table ref="paramsTable" :data="voicePrintList" class="transparent-table" v-loading="loading"
|
||||||
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
|
||||||
element-loading-background="rgba(255, 255, 255, 0.7)">
|
element-loading-background="rgba(255, 255, 255, 0.7)">
|
||||||
<el-table-column label="姓名" prop="sourceName" align="center"></el-table-column>
|
<el-table-column label="Name" prop="sourceName" align="center"></el-table-column>
|
||||||
<el-table-column label="描述" prop="introduce" align="center"></el-table-column>
|
<el-table-column label="Description" prop="introduce" align="center"></el-table-column>
|
||||||
<el-table-column label="创建时间" prop="createDate" align="center"></el-table-column>
|
<el-table-column label="Create Time" prop="createDate" align="center"></el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="Actions" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="editVoicePrint(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" @click="editVoicePrint(scope.row)">Edit</el-button>
|
||||||
<el-button size="mini" type="text"
|
<el-button size="mini" type="text"
|
||||||
@click="deleteVoicePrint(scope.row.id)">删除</el-button>
|
@click="deleteVoicePrint(scope.row.id)">Delete</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<div class="table_bottom">
|
<div class="table_bottom">
|
||||||
<div class="ctrl_btn">
|
<div class="ctrl_btn">
|
||||||
<el-button size="mini" type="success" @click="showAddDialog">新增</el-button>
|
<el-button size="mini" type="success" @click="showAddDialog">Add</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增/编辑参数对话框 -->
|
<!-- Add/Edit Parameter Dialog -->
|
||||||
<voice-print-dialog :title="dialogTitle" :visible.sync="dialogVisible" :agentId="agentId" :form="paramForm"
|
<voice-print-dialog :title="dialogTitle" :visible.sync="dialogVisible" :agentId="agentId" :form="paramForm"
|
||||||
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||||
<el-footer>
|
<el-footer>
|
||||||
|
|
@ -56,7 +56,7 @@ export default {
|
||||||
voicePrintList: [],
|
voicePrintList: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: "添加说话人",
|
dialogTitle: "Add Speaker",
|
||||||
isAllSelected: false,
|
isAllSelected: false,
|
||||||
paramForm: {
|
paramForm: {
|
||||||
id: null,
|
id: null,
|
||||||
|
|
@ -87,7 +87,7 @@ export default {
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '获取声纹列表失败',
|
message: data.msg || 'Failed to get voice print list',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +95,7 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
showAddDialog() {
|
showAddDialog() {
|
||||||
this.dialogTitle = "添加说话人";
|
this.dialogTitle = "Add Speaker";
|
||||||
this.paramForm = {
|
this.paramForm = {
|
||||||
id: null,
|
id: null,
|
||||||
audioId: '',
|
audioId: '',
|
||||||
|
|
@ -105,18 +105,18 @@ export default {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
editVoicePrint(row) {
|
editVoicePrint(row) {
|
||||||
this.dialogTitle = "编辑说话人";
|
this.dialogTitle = "Edit Speaker";
|
||||||
this.paramForm = { ...row };
|
this.paramForm = { ...row };
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSubmit({ form, done }) {
|
handleSubmit({ form, done }) {
|
||||||
if (form.id) {
|
if (form.id) {
|
||||||
// 编辑
|
// Edit
|
||||||
Api.agent.updateAgentVoicePrint(form, ({ data }) => {
|
Api.agent.updateAgentVoicePrint(form, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "修改成功",
|
message: "Update successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
|
@ -125,7 +125,7 @@ export default {
|
||||||
done && done();
|
done && done();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 新增
|
// Add
|
||||||
Api.agent.addAgentVoicePrint({
|
Api.agent.addAgentVoicePrint({
|
||||||
agentId: this.agentId,
|
agentId: this.agentId,
|
||||||
audioId: form.audioId,
|
audioId: form.audioId,
|
||||||
|
|
@ -134,7 +134,7 @@ export default {
|
||||||
}, ({ data }) => {
|
}, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: "新增成功",
|
message: "Add successful",
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
|
@ -144,24 +144,24 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 删除按钮
|
// Delete button
|
||||||
deleteVoicePrint(id) {
|
deleteVoicePrint(id) {
|
||||||
this.$confirm(`确定要删除选中的此声纹吗?`, '警告', {
|
this.$confirm(`Are you sure you want to delete this voice print?`, 'Warning', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
distinguishCancelAndClose: true
|
distinguishCancelAndClose: true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
Api.agent.deleteAgentVoicePrint(id, ({ data }) => {
|
Api.agent.deleteAgentVoicePrint(id, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: `成功删除此声纹`,
|
message: `Successfully deleted voice print`,
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
this.fetchVoicePrints();
|
this.fetchVoicePrints();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '删除失败,请重试',
|
message: data.msg || 'Delete failed, please try again',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -170,13 +170,13 @@ export default {
|
||||||
if (action === 'cancel') {
|
if (action === 'cancel') {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已取消删除操作',
|
message: 'Delete operation cancelled',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '操作已关闭',
|
message: 'Operation closed',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
<div class="add-device">
|
<div class="add-device">
|
||||||
<div class="add-device-bg">
|
<div class="add-device-bg">
|
||||||
<div class="hellow-text" style="margin-top: 30px;">
|
<div class="hellow-text" style="margin-top: 30px;">
|
||||||
你好,小智
|
Hello, Cheeko
|
||||||
</div>
|
</div>
|
||||||
<div class="hellow-text">
|
<div class="hellow-text">
|
||||||
让我们度过
|
Let's have a
|
||||||
<div style="display: inline-block;color: #5778FF;">
|
<div style="display: inline-block;color: #5778FF;">
|
||||||
美好的一天!
|
wonderful day!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="hi-hint">
|
<div class="hi-hint">
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="add-device-btn">
|
<div class="add-device-btn">
|
||||||
<div class="left-add" @click="showAddDialog">
|
<div class="left-add" @click="showAddDialog">
|
||||||
添加智能体
|
Add Agent
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 23px;height: 13px;background: #5778ff;margin-left: -10px;" />
|
<div style="width: 23px;height: 13px;background: #5778ff;margin-left: -10px;" />
|
||||||
<div class="right-add">
|
<div class="right-add">
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<el-container style="height: 100%;">
|
<el-container style="height: 100%;">
|
||||||
<el-header>
|
<el-header>
|
||||||
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.png" style="width: 45px;height: 45px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.svg" style="width: 45px;height: 45px;" />
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="login-box" @keyup.enter="login">
|
<div class="login-box" @keyup.enter="login">
|
||||||
<div style="display: flex;align-items: center;gap: 20px;margin-bottom: 39px;padding: 0 30px;">
|
<div style="display: flex;align-items: center;gap: 20px;margin-bottom: 39px;padding: 0 30px;">
|
||||||
<img loading="lazy" alt="" src="@/assets/login/hi.png" style="width: 34px;height: 34px;" />
|
<img loading="lazy" alt="" src="@/assets/login/hi.png" style="width: 34px;height: 34px;" />
|
||||||
<div class="login-text">登录</div>
|
<div class="login-text">Login</div>
|
||||||
<div class="login-welcome">
|
<div class="login-welcome">
|
||||||
WELCOME TO LOGIN
|
WELCOME TO LOGIN
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
<template v-if="!isMobileLogin">
|
<template v-if="!isMobileLogin">
|
||||||
<div class="input-box">
|
<div class="input-box">
|
||||||
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/username.png" />
|
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/username.png" />
|
||||||
<el-input v-model="form.username" placeholder="请输入用户名" />
|
<el-input v-model="form.username" placeholder="Enter username" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -36,48 +36,48 @@
|
||||||
<el-option v-for="item in mobileAreaList" :key="item.key" :label="`${item.name} (${item.key})`"
|
<el-option v-for="item in mobileAreaList" :key="item.key" :label="`${item.name} (${item.key})`"
|
||||||
:value="item.key" />
|
:value="item.key" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input v-model="form.mobile" placeholder="请输入手机号码" />
|
<el-input v-model="form.mobile" placeholder="Enter phone number" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="input-box">
|
<div class="input-box">
|
||||||
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/password.png" />
|
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/password.png" />
|
||||||
<el-input v-model="form.password" placeholder="请输入密码" type="password" show-password />
|
<el-input v-model="form.password" placeholder="Enter password" type="password" show-password />
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; align-items: center; margin-top: 20px; width: 100%; gap: 10px;">
|
<div style="display: flex; align-items: center; margin-top: 20px; width: 100%; gap: 10px;">
|
||||||
<div class="input-box" style="width: calc(100% - 130px); margin-top: 0;">
|
<div class="input-box" style="width: calc(100% - 130px); margin-top: 0;">
|
||||||
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/shield.png" />
|
<img loading="lazy" alt="" class="input-icon" src="@/assets/login/shield.png" />
|
||||||
<el-input v-model="form.captcha" placeholder="请输入验证码" style="flex: 1;" />
|
<el-input v-model="form.captcha" placeholder="Enter verification code" style="flex: 1;" />
|
||||||
</div>
|
</div>
|
||||||
<img loading="lazy" v-if="captchaUrl" :src="captchaUrl" alt="验证码"
|
<img loading="lazy" v-if="captchaUrl" :src="captchaUrl" alt="Verification Code"
|
||||||
style="width: 150px; height: 40px; cursor: pointer;" @click="fetchCaptcha" />
|
style="width: 150px; height: 40px; cursor: pointer;" @click="fetchCaptcha" />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style="font-weight: 400;font-size: 14px;text-align: left;color: #5778ff;display: flex;justify-content: space-between;margin-top: 20px;">
|
style="font-weight: 400;font-size: 14px;text-align: left;color: #5778ff;display: flex;justify-content: space-between;margin-top: 20px;">
|
||||||
<div v-if="allowUserRegister" style="cursor: pointer;" @click="goToRegister">新用户注册</div>
|
<div v-if="allowUserRegister" style="cursor: pointer;" @click="goToRegister">New User Registration</div>
|
||||||
<div style="cursor: pointer;" @click="goToForgetPassword" v-if="enableMobileRegister">忘记密码?</div>
|
<div style="cursor: pointer;" @click="goToForgetPassword" v-if="enableMobileRegister">Forgot Password?</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="login-btn" @click="login">登录</div>
|
<div class="login-btn" @click="login">Login</div>
|
||||||
|
|
||||||
<!-- 登录方式切换按钮 -->
|
<!-- 登录方式切换按钮 -->
|
||||||
<div class="login-type-container" v-if="enableMobileRegister">
|
<div class="login-type-container" v-if="enableMobileRegister">
|
||||||
<el-tooltip content="手机号码登录" placement="bottom">
|
<el-tooltip content="Phone Number Login" placement="bottom">
|
||||||
<el-button :type="isMobileLogin ? 'primary' : 'default'" icon="el-icon-mobile" circle
|
<el-button :type="isMobileLogin ? 'primary' : 'default'" icon="el-icon-mobile" circle
|
||||||
@click="switchLoginType('mobile')"></el-button>
|
@click="switchLoginType('mobile')"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="用户名登录" placement="bottom">
|
<el-tooltip content="Username Login" placement="bottom">
|
||||||
<el-button :type="!isMobileLogin ? 'primary' : 'default'" icon="el-icon-user" circle
|
<el-button :type="!isMobileLogin ? 'primary' : 'default'" icon="el-icon-user" circle
|
||||||
@click="switchLoginType('username')"></el-button>
|
@click="switchLoginType('username')"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="font-size: 14px;color: #979db1;">
|
<div style="font-size: 14px;color: #979db1;">
|
||||||
登录即同意
|
By logging in, you agree to
|
||||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;">《用户协议》</div>
|
<div style="display: inline-block;color: #5778FF;cursor: pointer;">User Agreement</div>
|
||||||
和
|
and
|
||||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;">《隐私政策》</div>
|
<div style="display: inline-block;color: #5778FF;cursor: pointer;">Privacy Policy</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
const blob = new Blob([res.data], { type: res.data.type });
|
const blob = new Blob([res.data], { type: res.data.type });
|
||||||
this.captchaUrl = URL.createObjectURL(blob);
|
this.captchaUrl = URL.createObjectURL(blob);
|
||||||
} else {
|
} else {
|
||||||
showDanger('验证码加载失败,点击刷新');
|
showDanger('Failed to load verification code, click to refresh');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -173,35 +173,35 @@ export default {
|
||||||
if (this.isMobileLogin) {
|
if (this.isMobileLogin) {
|
||||||
// 手机号登录验证
|
// 手机号登录验证
|
||||||
if (!validateMobile(this.form.mobile, this.form.areaCode)) {
|
if (!validateMobile(this.form.mobile, this.form.areaCode)) {
|
||||||
showDanger('请输入正确的手机号码');
|
showDanger('Please enter a valid phone number');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 拼接手机号作为用户名
|
// 拼接手机号作为用户名
|
||||||
this.form.username = this.form.areaCode + this.form.mobile;
|
this.form.username = this.form.areaCode + this.form.mobile;
|
||||||
} else {
|
} else {
|
||||||
// 用户名登录验证
|
// 用户名登录验证
|
||||||
if (!this.validateInput(this.form.username, '用户名不能为空')) {
|
if (!this.validateInput(this.form.username, 'Username cannot be empty')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证密码
|
// 验证密码
|
||||||
if (!this.validateInput(this.form.password, '密码不能为空')) {
|
if (!this.validateInput(this.form.password, 'Password cannot be empty')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 验证验证码
|
// 验证验证码
|
||||||
if (!this.validateInput(this.form.captcha, '验证码不能为空')) {
|
if (!this.validateInput(this.form.captcha, 'Verification code cannot be empty')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.form.captchaId = this.captchaUuid
|
this.form.captchaId = this.captchaUuid
|
||||||
Api.user.login(this.form, ({ data }) => {
|
Api.user.login(this.form, ({ data }) => {
|
||||||
showSuccess('登录成功!');
|
showSuccess('Login successful!');
|
||||||
this.$store.commit('setToken', JSON.stringify(data.data));
|
this.$store.commit('setToken', JSON.stringify(data.data));
|
||||||
goToPage('/home');
|
goToPage('/home');
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
showDanger(err.data.msg || '登录失败')
|
showDanger(err.data.msg || 'Login failed')
|
||||||
if (err.data != null && err.data.msg != null && err.data.msg.indexOf('图形验证码') > -1) {
|
if (err.data != null && err.data.msg != null && (err.data.msg.indexOf('verification code') > -1 || err.data.msg.indexOf('图形验证码') > -1)) {
|
||||||
this.fetchCaptcha()
|
this.fetchCaptcha()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<!-- 保持相同的头部 -->
|
<!-- 保持相同的头部 -->
|
||||||
<el-header>
|
<el-header>
|
||||||
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.png" style="width: 45px;height: 45px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.svg" style="width: 45px;height: 45px;" />
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<!-- 保持相同的头部 -->
|
<!-- 保持相同的头部 -->
|
||||||
<el-header>
|
<el-header>
|
||||||
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
<div style="display: flex;align-items: center;margin-top: 15px;margin-left: 10px;gap: 10px;">
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.png" style="width: 45px;height: 45px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-logo.svg" style="width: 45px;height: 45px;" />
|
||||||
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
<img loading="lazy" alt="" src="@/assets/xiaozhi-ai.png" style="height: 18px;" />
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<HeaderBar />
|
<HeaderBar />
|
||||||
|
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">角色配置</h2>
|
<h2 class="page-title">Role Configuration</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="main-wrapper">
|
<div class="main-wrapper">
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<div class="hint-text">
|
<div class="hint-text">
|
||||||
<img loading="lazy" src="@/assets/home/info.png" alt="">
|
<img loading="lazy" src="@/assets/home/info.png" alt="">
|
||||||
<span>保存配置后,需要重启设备,新的配置才会生效。</span>
|
<span>After saving the configuration, you need to restart the device for the new configuration to take effect.</span>
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" class="save-btn" @click="saveConfig">保存配置</el-button>
|
<el-button type="primary" class="save-btn" @click="saveConfig">Save Configuration</el-button>
|
||||||
<el-button class="reset-btn" @click="resetConfig">重置</el-button>
|
<el-button class="reset-btn" @click="resetConfig">Reset</el-button>
|
||||||
<button class="custom-close-btn" @click="goToHome">
|
<button class="custom-close-btn" @click="goToHome">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
<div class="form-content">
|
<div class="form-content">
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<div class="form-column">
|
<div class="form-column">
|
||||||
<el-form-item label="助手昵称:">
|
<el-form-item label="Assistant Name:">
|
||||||
<el-input v-model="form.agentName" class="form-input" maxlength="10" />
|
<el-input v-model="form.agentName" class="form-input" maxlength="10" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色模版:">
|
<el-form-item label="Role Template:">
|
||||||
<div class="template-container">
|
<div class="template-container">
|
||||||
<div v-for="(template, index) in templates" :key="`template-${index}`" class="template-item"
|
<div v-for="(template, index) in templates" :key="`template-${index}`" class="template-item"
|
||||||
:class="{ 'template-loading': loadingTemplate }" @click="selectTemplate(template)">
|
:class="{ 'template-loading': loadingTemplate }" @click="selectTemplate(template)">
|
||||||
|
|
@ -44,39 +44,39 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色介绍:">
|
<el-form-item label="Role Description:">
|
||||||
<el-input type="textarea" rows="9" resize="none" placeholder="请输入内容" v-model="form.systemPrompt"
|
<el-input type="textarea" rows="9" resize="none" placeholder="Enter content" v-model="form.systemPrompt"
|
||||||
maxlength="2000" show-word-limit class="form-textarea" />
|
maxlength="2000" show-word-limit class="form-textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="记忆:">
|
<el-form-item label="Memory:">
|
||||||
<el-input type="textarea" rows="6" resize="none" v-model="form.summaryMemory" maxlength="2000"
|
<el-input type="textarea" rows="6" resize="none" v-model="form.summaryMemory" maxlength="2000"
|
||||||
show-word-limit class="form-textarea"
|
show-word-limit class="form-textarea"
|
||||||
:disabled="form.model.memModelId !== 'Memory_mem_local_short'" />
|
:disabled="form.model.memModelId !== 'Memory_mem_local_short'" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="语言编码:" style="display: none;">
|
<el-form-item label="Language Code:" style="display: none;">
|
||||||
<el-input v-model="form.langCode" placeholder="请输入语言编码,如:zh_CN" maxlength="10" show-word-limit
|
<el-input v-model="form.langCode" placeholder="Enter language code, e.g. zh_CN" maxlength="10" show-word-limit
|
||||||
class="form-input" />
|
class="form-input" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="交互语种:" style="display: none;">
|
<el-form-item label="Interaction Language:" style="display: none;">
|
||||||
<el-input v-model="form.language" placeholder="请输入交互语种,如:中文" maxlength="10" show-word-limit
|
<el-input v-model="form.language" placeholder="Enter interaction language, e.g. Chinese" maxlength="10" show-word-limit
|
||||||
class="form-input" />
|
class="form-input" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-column">
|
<div class="form-column">
|
||||||
<div class="model-row">
|
<div class="model-row">
|
||||||
<el-form-item label="语音活动检测(VAD)" class="model-item">
|
<el-form-item label="Voice Activity Detection (VAD)" class="model-item">
|
||||||
<div class="model-select-wrapper">
|
<div class="model-select-wrapper">
|
||||||
<el-select v-model="form.model.vadModelId" filterable placeholder="请选择" class="form-select"
|
<el-select v-model="form.model.vadModelId" filterable placeholder="Please select" class="form-select"
|
||||||
@change="handleModelChange('VAD', $event)">
|
@change="handleModelChange('VAD', $event)">
|
||||||
<el-option v-for="(item, optionIndex) in modelOptions['VAD']"
|
<el-option v-for="(item, optionIndex) in modelOptions['VAD']"
|
||||||
:key="`option-vad-${optionIndex}`" :label="item.label" :value="item.value" />
|
:key="`option-vad-${optionIndex}`" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="语音识别(ASR)" class="model-item">
|
<el-form-item label="Speech Recognition (ASR)" class="model-item">
|
||||||
<div class="model-select-wrapper">
|
<div class="model-select-wrapper">
|
||||||
<el-select v-model="form.model.asrModelId" filterable placeholder="请选择" class="form-select"
|
<el-select v-model="form.model.asrModelId" filterable placeholder="Please select" class="form-select"
|
||||||
@change="handleModelChange('ASR', $event)">
|
@change="handleModelChange('ASR', $event)">
|
||||||
<el-option v-for="(item, optionIndex) in modelOptions['ASR']"
|
<el-option v-for="(item, optionIndex) in modelOptions['ASR']"
|
||||||
:key="`option-asr-${optionIndex}`" :label="item.label" :value="item.value" />
|
:key="`option-asr-${optionIndex}`" :label="item.label" :value="item.value" />
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
<el-form-item v-for="(model, index) in models.slice(2)" :key="`model-${index}`" :label="model.label"
|
<el-form-item v-for="(model, index) in models.slice(2)" :key="`model-${index}`" :label="model.label"
|
||||||
class="model-item">
|
class="model-item">
|
||||||
<div class="model-select-wrapper">
|
<div class="model-select-wrapper">
|
||||||
<el-select v-model="form.model[model.key]" filterable placeholder="请选择" class="form-select"
|
<el-select v-model="form.model[model.key]" filterable placeholder="Please select" class="form-select"
|
||||||
@change="handleModelChange(model.type, $event)">
|
@change="handleModelChange(model.type, $event)">
|
||||||
<el-option v-for="(item, optionIndex) in modelOptions[model.type]" v-if="!item.isHidden"
|
<el-option v-for="(item, optionIndex) in modelOptions[model.type]" v-if="!item.isHidden"
|
||||||
:key="`option-${index}-${optionIndex}`" :label="item.label" :value="item.value" />
|
:key="`option-${index}-${optionIndex}`" :label="item.label" :value="item.value" />
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
<el-tooltip v-for="func in currentFunctions" :key="func.name" effect="dark" placement="top"
|
<el-tooltip v-for="func in currentFunctions" :key="func.name" effect="dark" placement="top"
|
||||||
popper-class="custom-tooltip">
|
popper-class="custom-tooltip">
|
||||||
<div slot="content">
|
<div slot="content">
|
||||||
<div><strong>功能名称:</strong> {{ func.name }}</div>
|
<div><strong>Function Name:</strong> {{ func.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon-dot" :style="{ backgroundColor: getFunctionColor(func.name) }">
|
<div class="icon-dot" :style="{ backgroundColor: getFunctionColor(func.name) }">
|
||||||
{{ func.name.charAt(0) }}
|
{{ func.name.charAt(0) }}
|
||||||
|
|
@ -104,20 +104,20 @@
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button class="edit-function-btn" @click="openFunctionDialog"
|
<el-button class="edit-function-btn" @click="openFunctionDialog"
|
||||||
:class="{ 'active-btn': showFunctionDialog }">
|
:class="{ 'active-btn': showFunctionDialog }">
|
||||||
编辑功能
|
Edit Functions
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="model.type === 'Memory' && form.model.memModelId !== 'Memory_nomem'"
|
<div v-if="model.type === 'Memory' && form.model.memModelId !== 'Memory_nomem'"
|
||||||
class="chat-history-options">
|
class="chat-history-options">
|
||||||
<el-radio-group v-model="form.chatHistoryConf" @change="updateChatHistoryConf">
|
<el-radio-group v-model="form.chatHistoryConf" @change="updateChatHistoryConf">
|
||||||
<el-radio-button :label="1">上报文字</el-radio-button>
|
<el-radio-button :label="1">Report Text</el-radio-button>
|
||||||
<el-radio-button :label="2">上报文字+语音</el-radio-button>
|
<el-radio-button :label="2">Report Text + Audio</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色音色">
|
<el-form-item label="Voice Type:">
|
||||||
<el-select v-model="form.ttsVoiceId" placeholder="请选择" class="form-select">
|
<el-select v-model="form.ttsVoiceId" placeholder="Please select" class="form-select">
|
||||||
<el-option v-for="(item, index) in voiceOptions" :key="`voice-${index}`" :label="item.label"
|
<el-option v-for="(item, index) in voiceOptions" :key="`voice-${index}`" :label="item.label"
|
||||||
:value="item.value" />
|
:value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
@ -166,13 +166,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
models: [
|
models: [
|
||||||
{ label: '语音活动检测(VAD)', key: 'vadModelId', type: 'VAD' },
|
{ label: 'Voice Activity Detection (VAD)', key: 'vadModelId', type: 'VAD' },
|
||||||
{ label: '语音识别(ASR)', key: 'asrModelId', type: 'ASR' },
|
{ label: 'Speech Recognition (ASR)', key: 'asrModelId', type: 'ASR' },
|
||||||
{ label: '大语言模型(LLM)', key: 'llmModelId', type: 'LLM' },
|
{ label: 'Large Language Model (LLM)', key: 'llmModelId', type: 'LLM' },
|
||||||
{ label: '视觉大模型(VLLM)', key: 'vllmModelId', type: 'VLLM' },
|
{ label: 'Vision Language Model (VLLM)', key: 'vllmModelId', type: 'VLLM' },
|
||||||
{ label: '意图识别(Intent)', key: 'intentModelId', type: 'Intent' },
|
{ label: 'Intent Recognition (Intent)', key: 'intentModelId', type: 'Intent' },
|
||||||
{ label: '记忆(Memory)', key: 'memModelId', type: 'Memory' },
|
{ label: 'Memory', key: 'memModelId', type: 'Memory' },
|
||||||
{ label: '语音合成(TTS)', key: 'ttsModelId', type: 'TTS' }
|
{ label: 'Text-to-Speech (TTS)', key: 'ttsModelId', type: 'TTS' }
|
||||||
],
|
],
|
||||||
llmModeTypeMap: new Map(),
|
llmModeTypeMap: new Map(),
|
||||||
modelOptions: {},
|
modelOptions: {},
|
||||||
|
|
@ -221,21 +221,21 @@ export default {
|
||||||
Api.agent.updateAgentConfig(this.$route.query.agentId, configData, ({ data }) => {
|
Api.agent.updateAgentConfig(this.$route.query.agentId, configData, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: '配置保存成功',
|
message: 'Configuration saved successfully',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error({
|
this.$message.error({
|
||||||
message: data.msg || '配置保存失败',
|
message: data.msg || 'Failed to save configuration',
|
||||||
showClose: true
|
showClose: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetConfig() {
|
resetConfig() {
|
||||||
this.$confirm('确定要重置配置吗?', '提示', {
|
this.$confirm('Are you sure you want to reset the configuration?', 'Confirm', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.form = {
|
this.form = {
|
||||||
|
|
@ -260,7 +260,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.currentFunctions = [];
|
this.currentFunctions = [];
|
||||||
this.$message.success({
|
this.$message.success({
|
||||||
message: '配置已重置',
|
message: 'Configuration has been reset',
|
||||||
showClose: true
|
showClose: true
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
@ -271,7 +271,7 @@ export default {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
this.templates = data.data;
|
this.templates = data.data;
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '获取模板列表失败');
|
this.$message.error(data.msg || 'Failed to get template list');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -361,7 +361,7 @@ export default {
|
||||||
this.updateIntentOptionsVisibility();
|
this.updateIntentOptionsVisibility();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '获取配置失败');
|
this.$message.error(data.msg || 'Failed to get configuration');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -381,7 +381,7 @@ export default {
|
||||||
this.updateIntentOptionsVisibility();
|
this.updateIntentOptionsVisibility();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '获取模型列表失败');
|
this.$message.error(data.msg || 'Failed to get model list');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -398,7 +398,7 @@ export default {
|
||||||
})
|
})
|
||||||
this.$set(this.modelOptions, model.type, LLMdata);
|
this.$set(this.modelOptions, model.type, LLMdata);
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '获取LLM模型列表失败');
|
this.$message.error(data.msg || 'Failed to get LLM model list');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -457,7 +457,7 @@ export default {
|
||||||
});
|
});
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg || '获取插件列表失败');
|
this.$message.error(data.msg || 'Failed to get plugin list');
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
167
main/xiaozhi-server/check_edge_voices.py
Normal file
167
main/xiaozhi-server/check_edge_voices.py
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
# Check EdgeTTS voices
|
||||||
|
print("=" * 60)
|
||||||
|
print("Current EdgeTTS Voices in Database:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# First, find the EdgeTTS model ID
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE model_name LIKE '%Edge%' AND model_type = 'tts'
|
||||||
|
""")
|
||||||
|
edge_model = cursor.fetchone()
|
||||||
|
|
||||||
|
if edge_model:
|
||||||
|
print(f"EdgeTTS Model: {edge_model[1]} (ID: {edge_model[0]})")
|
||||||
|
|
||||||
|
# Now get all voices for EdgeTTS
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, name, tts_voice, languages, remark
|
||||||
|
FROM ai_tts_voice
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
ORDER BY name
|
||||||
|
""", (edge_model[0],))
|
||||||
|
|
||||||
|
voices = cursor.fetchall()
|
||||||
|
|
||||||
|
print(f"\nFound {len(voices)} EdgeTTS voices:")
|
||||||
|
print("-" * 60)
|
||||||
|
|
||||||
|
for voice in voices:
|
||||||
|
print(f"ID: {voice[0]}")
|
||||||
|
print(f" Name: {voice[1]}")
|
||||||
|
print(f" TTS Voice: {voice[2]}")
|
||||||
|
print(f" Languages: {voice[3]}")
|
||||||
|
if voice[4]:
|
||||||
|
print(f" Remark: {voice[4]}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Translate Chinese voice names to English
|
||||||
|
print("=" * 60)
|
||||||
|
print("Translating Chinese voice names to English...")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Common EdgeTTS voice translations (preserving the actual voice IDs)
|
||||||
|
voice_translations = [
|
||||||
|
# Female voices
|
||||||
|
("EdgeTTS女声-晓晓", "EdgeTTS Female - Xiaoxiao"),
|
||||||
|
("EdgeTTS女声-晓伊", "EdgeTTS Female - Xiaoyi"),
|
||||||
|
("EdgeTTS女声-晓双", "EdgeTTS Female - Xiaoshuang"),
|
||||||
|
("EdgeTTS女声-晓萱", "EdgeTTS Female - Xiaoxuan"),
|
||||||
|
("EdgeTTS女声-晓颜", "EdgeTTS Female - Xiaoyan"),
|
||||||
|
("EdgeTTS女声-晓悠", "EdgeTTS Female - Xiaoyou"),
|
||||||
|
("EdgeTTS女声-云夏", "EdgeTTS Female - Yunxia"),
|
||||||
|
("EdgeTTS女声-云燕", "EdgeTTS Female - Yunyan"),
|
||||||
|
|
||||||
|
# Male voices
|
||||||
|
("EdgeTTS男声-云健", "EdgeTTS Male - Yunjian"),
|
||||||
|
("EdgeTTS男声-云泽", "EdgeTTS Male - Yunze"),
|
||||||
|
("EdgeTTS男声-云希", "EdgeTTS Male - Yunxi"),
|
||||||
|
("EdgeTTS男声-云扬", "EdgeTTS Male - Yunyang"),
|
||||||
|
("EdgeTTS男声-晓辰", "EdgeTTS Male - Xiaochen"),
|
||||||
|
|
||||||
|
# English voices (if any have Chinese labels)
|
||||||
|
("EdgeTTS女声-Jenny", "EdgeTTS Female - Jenny"),
|
||||||
|
("EdgeTTS女声-Aria", "EdgeTTS Female - Aria"),
|
||||||
|
("EdgeTTS男声-Guy", "EdgeTTS Male - Guy"),
|
||||||
|
("EdgeTTS男声-Davis", "EdgeTTS Male - Davis"),
|
||||||
|
|
||||||
|
# Generic translations
|
||||||
|
("女声", "Female"),
|
||||||
|
("男声", "Male"),
|
||||||
|
("儿童声", "Child"),
|
||||||
|
("中文", "Chinese"),
|
||||||
|
("英文", "English"),
|
||||||
|
]
|
||||||
|
|
||||||
|
updated_count = 0
|
||||||
|
for old_name, new_name in voice_translations:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_tts_voice
|
||||||
|
SET name = %s
|
||||||
|
WHERE name = %s AND tts_model_id = %s
|
||||||
|
""", (new_name, old_name, edge_model[0]))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: '{old_name}' → '{new_name}'")
|
||||||
|
updated_count += cursor.rowcount
|
||||||
|
|
||||||
|
# Also update any remaining Chinese characters in voice names
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, name
|
||||||
|
FROM ai_tts_voice
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
AND (name LIKE '%女%' OR name LIKE '%男%' OR name LIKE '%声%' OR name LIKE '%中文%' OR name LIKE '%英文%')
|
||||||
|
""", (edge_model[0],))
|
||||||
|
|
||||||
|
remaining_chinese = cursor.fetchall()
|
||||||
|
if remaining_chinese:
|
||||||
|
print("\nUpdating remaining Chinese characters in voice names:")
|
||||||
|
for voice_id, voice_name in remaining_chinese:
|
||||||
|
new_name = voice_name
|
||||||
|
new_name = new_name.replace("女声", "Female")
|
||||||
|
new_name = new_name.replace("男声", "Male")
|
||||||
|
new_name = new_name.replace("儿童声", "Child")
|
||||||
|
new_name = new_name.replace("中文", "Chinese")
|
||||||
|
new_name = new_name.replace("英文", "English")
|
||||||
|
new_name = new_name.replace("语音", "Voice")
|
||||||
|
|
||||||
|
if new_name != voice_name:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_tts_voice
|
||||||
|
SET name = %s
|
||||||
|
WHERE id = %s
|
||||||
|
""", (new_name, voice_id))
|
||||||
|
print(f"✓ Updated: '{voice_name}' → '{new_name}'")
|
||||||
|
updated_count += 1
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
if updated_count > 0:
|
||||||
|
print(f"\n✅ Successfully updated {updated_count} voice names!")
|
||||||
|
else:
|
||||||
|
print("\n⚠️ No voice names needed updating.")
|
||||||
|
|
||||||
|
# Show final results
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updated EdgeTTS Voices:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, name, tts_voice, languages
|
||||||
|
FROM ai_tts_voice
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
ORDER BY name
|
||||||
|
""", (edge_model[0],))
|
||||||
|
|
||||||
|
for voice in cursor.fetchall():
|
||||||
|
print(f"Name: {voice[1]} | Voice ID: {voice[2]} | Lang: {voice[3]}")
|
||||||
|
else:
|
||||||
|
print("EdgeTTS model not found in database!")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
41
main/xiaozhi-server/check_tables.py
Normal file
41
main/xiaozhi-server/check_tables.py
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
import pymysql
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
# Show all tables
|
||||||
|
cursor.execute("SHOW TABLES")
|
||||||
|
tables = cursor.fetchall()
|
||||||
|
|
||||||
|
print("=" * 60)
|
||||||
|
print("Tables in Railway database:")
|
||||||
|
print("=" * 60)
|
||||||
|
for table in tables:
|
||||||
|
print(f"- {table[0]}")
|
||||||
|
|
||||||
|
# Check for model-related tables
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Checking model/config related tables:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
for table in tables:
|
||||||
|
table_name = table[0]
|
||||||
|
if 'model' in table_name.lower() or 'config' in table_name.lower() or 'tts' in table_name.lower():
|
||||||
|
cursor.execute(f"DESCRIBE {table_name}")
|
||||||
|
columns = cursor.fetchall()
|
||||||
|
print(f"\nTable: {table_name}")
|
||||||
|
print("Columns:")
|
||||||
|
for col in columns:
|
||||||
|
print(f" - {col[0]} ({col[1]})")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
76
main/xiaozhi-server/check_tts_models.py
Normal file
76
main/xiaozhi-server/check_tts_models.py
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
import pymysql
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
# Check TTS models
|
||||||
|
print("=" * 60)
|
||||||
|
print("TTS Models in Database:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
sql = """
|
||||||
|
SELECT id, model_name, model_type, config_json
|
||||||
|
FROM model_config
|
||||||
|
WHERE model_type = 'tts' OR model_name LIKE '%Edge%' OR model_name LIKE '%语音%'
|
||||||
|
ORDER BY model_name
|
||||||
|
"""
|
||||||
|
cursor.execute(sql)
|
||||||
|
results = cursor.fetchall()
|
||||||
|
|
||||||
|
for row in results:
|
||||||
|
print(f"\nID: {row[0]}")
|
||||||
|
print(f"Model Name: {row[1]}")
|
||||||
|
print(f"Model Type: {row[2]}")
|
||||||
|
if row[3]:
|
||||||
|
config = json.loads(row[3])
|
||||||
|
print(f"Config Type: {config.get('type', 'N/A')}")
|
||||||
|
|
||||||
|
# Update the Chinese text to English
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updating Chinese model names to English...")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
updates = [
|
||||||
|
("Edge语音合成", "Edge TTS"),
|
||||||
|
("百度语音合成", "Baidu TTS"),
|
||||||
|
("阿里语音合成", "Ali TTS"),
|
||||||
|
("腾讯语音合成", "Tencent TTS"),
|
||||||
|
("科大讯飞语音合成", "iFlytek TTS")
|
||||||
|
]
|
||||||
|
|
||||||
|
for old_name, new_name in updates:
|
||||||
|
sql = "UPDATE model_config SET model_name = %s WHERE model_name = %s"
|
||||||
|
cursor.execute(sql, (new_name, old_name))
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: '{old_name}' → '{new_name}'")
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
print("\n✅ All TTS model names have been updated to English!")
|
||||||
|
|
||||||
|
# Verify the changes
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updated TTS Models:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name
|
||||||
|
FROM model_config
|
||||||
|
WHERE model_type = 'tts'
|
||||||
|
ORDER BY model_name
|
||||||
|
""")
|
||||||
|
|
||||||
|
for row in cursor.fetchall():
|
||||||
|
print(f"ID: {row[0]}, Name: {row[1]}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
|
|
@ -19,9 +19,9 @@ import opuslib
|
||||||
|
|
||||||
# --- Configuration ---
|
# --- Configuration ---
|
||||||
|
|
||||||
SERVER_IP = "192.168.1.4" # !!! UPDATE with your server's local IP address !!!
|
SERVER_IP = "192.168.1.105" # !!! UPDATE with your server's local IP address !!!
|
||||||
OTA_PORT = 8003
|
OTA_PORT = 8002
|
||||||
MQTT_BROKER_HOST = "192.168.1.4" # MQTT gateway IP
|
MQTT_BROKER_HOST = "192.168.1.105" # MQTT gateway IP
|
||||||
|
|
||||||
|
|
||||||
MQTT_BROKER_PORT = 1883
|
MQTT_BROKER_PORT = 1883
|
||||||
|
|
|
||||||
101
main/xiaozhi-server/complete_params_translation.py
Normal file
101
main/xiaozhi-server/complete_params_translation.py
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Complete Parameter Remark Translation:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Direct mapping for each parameter's remark
|
||||||
|
remark_translations = {
|
||||||
|
"aliyun.sms.access_key_id": "Aliyun platform access key",
|
||||||
|
"aliyun.sms.access_key_secret": "Aliyun platform access key secret",
|
||||||
|
"aliyun.sms.sign_name": "Aliyun SMS signature",
|
||||||
|
"aliyun.sms.sms_code_template_code": "Aliyun SMS template code",
|
||||||
|
"close_connection_no_voice_time": "Disconnect time without voice input (seconds)",
|
||||||
|
"delete_audio": "Delete audio files after use",
|
||||||
|
"device_max_output_size": "Maximum output characters per device per day, 0 means unlimited",
|
||||||
|
"enable_greeting": "Enable greeting reply",
|
||||||
|
"enable_stop_tts_notify": "Enable end notification sound",
|
||||||
|
"enable_wakeup_words_response_cache": "Enable wake word acceleration cache",
|
||||||
|
"end_prompt.enable": "Enable ending prompt",
|
||||||
|
"end_prompt.prompt": "Ending prompt text",
|
||||||
|
"exit_commands": "Exit command list",
|
||||||
|
"log.data_dir": "Data directory",
|
||||||
|
"log.log_dir": "Log directory",
|
||||||
|
"log.log_file": "Log file name",
|
||||||
|
"log.log_format": "Console log format",
|
||||||
|
"log.log_format_file": "File log format",
|
||||||
|
"log.log_level": "Log level",
|
||||||
|
"server.allow_user_register": "Allow non-admin user registration",
|
||||||
|
"server.beian_ga_num": "Public security registration number, set null to disable",
|
||||||
|
"server.beian_icp_num": "ICP registration number, set null to disable",
|
||||||
|
"server.enable_mobile_register": "Enable mobile phone registration",
|
||||||
|
"server.fronted_url": "Dashboard URL displayed when sending 6-digit verification code",
|
||||||
|
"server.mcp_endpoint": "MCP endpoint address",
|
||||||
|
"server.name": "System name",
|
||||||
|
"server.ota": "OTA address",
|
||||||
|
"server.secret": "Server secret key",
|
||||||
|
"server.sms_max_send_count": "Maximum SMS sends per phone number per day",
|
||||||
|
"server.voice_print": "Voice print interface address",
|
||||||
|
"server.websocket": "WebSocket address, separate multiple with semicolon",
|
||||||
|
"stop_tts_notify_voice": "End notification sound file path",
|
||||||
|
"tts_timeout": "TTS request timeout (seconds)",
|
||||||
|
"wakeup_words": "Wake word list for recognition",
|
||||||
|
"xiaozhi": "Xiaozhi type configuration"
|
||||||
|
}
|
||||||
|
|
||||||
|
total_updated = 0
|
||||||
|
|
||||||
|
# Update each parameter's remark
|
||||||
|
for param_code, english_remark in remark_translations.items():
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE sys_params
|
||||||
|
SET remark = %s
|
||||||
|
WHERE param_code = %s
|
||||||
|
""", (english_remark, param_code))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: {param_code}")
|
||||||
|
print(f" New remark: {english_remark}")
|
||||||
|
total_updated += 1
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
print(f"\n✅ Successfully updated {total_updated} parameter remarks!")
|
||||||
|
|
||||||
|
# Show final results
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("All Parameter Remarks (Final):")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT param_code, remark
|
||||||
|
FROM sys_params
|
||||||
|
ORDER BY param_code
|
||||||
|
""")
|
||||||
|
|
||||||
|
for param_code, remark in cursor.fetchall():
|
||||||
|
print(f"{param_code:<40} : {remark or 'No remark'}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
|
|
@ -66,15 +66,31 @@ def get_config_from_api(config):
|
||||||
"secret": config["manager-api"].get("secret", ""),
|
"secret": config["manager-api"].get("secret", ""),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use local server configuration as priority
|
# Merge local server configuration with API configuration
|
||||||
|
# Local config takes priority for network settings, but preserve API settings for other fields
|
||||||
if config.get("server"):
|
if config.get("server"):
|
||||||
config_data["server"] = {
|
# Start with API server config if it exists
|
||||||
"ip": config["server"].get("ip", ""),
|
server_config = config_data.get("server", {})
|
||||||
"port": config["server"].get("port", ""),
|
|
||||||
"http_port": config["server"].get("http_port", ""),
|
# Override only specific local settings
|
||||||
|
server_config.update({
|
||||||
|
"ip": config["server"].get("ip", "0.0.0.0"),
|
||||||
|
"port": config["server"].get("port", 8000),
|
||||||
|
"http_port": config["server"].get("http_port", 8003),
|
||||||
"vision_explain": config["server"].get("vision_explain", ""),
|
"vision_explain": config["server"].get("vision_explain", ""),
|
||||||
"auth_key": config["server"].get("auth_key", ""),
|
})
|
||||||
}
|
|
||||||
|
# Preserve auth_key from API if not in local config
|
||||||
|
if config["server"].get("auth_key"):
|
||||||
|
server_config["auth_key"] = config["server"]["auth_key"]
|
||||||
|
elif "auth_key" not in server_config:
|
||||||
|
server_config["auth_key"] = ""
|
||||||
|
|
||||||
|
# Add mqtt_gateway if present in local config
|
||||||
|
if "mqtt_gateway" in config["server"]:
|
||||||
|
server_config["mqtt_gateway"] = config["server"]["mqtt_gateway"]
|
||||||
|
|
||||||
|
config_data["server"] = server_config
|
||||||
|
|
||||||
print("FINAL MERGED CONFIGURATION:")
|
print("FINAL MERGED CONFIGURATION:")
|
||||||
print("=" * 80)
|
print("=" * 80)
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,17 @@ class OTAHandler(BaseHandler):
|
||||||
"""
|
"""
|
||||||
server_config = self.config["server"]
|
server_config = self.config["server"]
|
||||||
websocket_config = server_config.get("websocket", "")
|
websocket_config = server_config.get("websocket", "")
|
||||||
|
|
||||||
|
# Debug logging
|
||||||
|
print(f"[OTA DEBUG] server_config websocket value: {websocket_config}")
|
||||||
|
print(f"[OTA DEBUG] Full server config: {server_config}")
|
||||||
|
|
||||||
if "你的" not in websocket_config:
|
if not websocket_config or "你的" in websocket_config:
|
||||||
return websocket_config
|
print(f"[OTA DEBUG] Using default websocket URL")
|
||||||
else:
|
|
||||||
return f"ws://{local_ip}:{port}/xiaozhi/v1/"
|
return f"ws://{local_ip}:{port}/xiaozhi/v1/"
|
||||||
|
else:
|
||||||
|
print(f"[OTA DEBUG] Using configured websocket URL: {websocket_config}")
|
||||||
|
return websocket_config
|
||||||
|
|
||||||
def _generate_mqtt_credentials(self, device_id: str, client_ip: str) -> dict:
|
def _generate_mqtt_credentials(self, device_id: str, client_ip: str) -> dict:
|
||||||
"""Generate MQTT credentials
|
"""Generate MQTT credentials
|
||||||
|
|
|
||||||
89
main/xiaozhi-server/final_language_update.py
Normal file
89
main/xiaozhi-server/final_language_update.py
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Final Language Updates:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# More comprehensive language updates
|
||||||
|
language_updates = [
|
||||||
|
("美式英语", "US English"),
|
||||||
|
("英式英语", "UK English"),
|
||||||
|
("澳洲英语", "AU English"),
|
||||||
|
("中文", "Chinese"),
|
||||||
|
("中文-北京口音", "Chinese-Beijing"),
|
||||||
|
("中文-四川口音", "Chinese-Sichuan"),
|
||||||
|
("中文-长沙口音", "Chinese-Changsha"),
|
||||||
|
("中文-广东口音", "Chinese-Guangdong"),
|
||||||
|
("中文-广西口音", "Chinese-Guangxi"),
|
||||||
|
("中文-青岛口音", "Chinese-Qingdao"),
|
||||||
|
("中文-台湾口音", "Chinese-Taiwan"),
|
||||||
|
("中文-河南口音", "Chinese-Henan"),
|
||||||
|
("中文、美式英语", "Chinese, US English"),
|
||||||
|
("中文-北京口音、英文", "Chinese-Beijing, EN"),
|
||||||
|
("日语、西语", "Japanese, Spanish"),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_updated = 0
|
||||||
|
for old_lang, new_lang in language_updates:
|
||||||
|
# Check column length limit (50 chars for languages column)
|
||||||
|
if len(new_lang) <= 50:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_tts_voice
|
||||||
|
SET languages = %s
|
||||||
|
WHERE languages = %s
|
||||||
|
""", (new_lang, old_lang))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated {cursor.rowcount} voices: '{old_lang}' → '{new_lang}'")
|
||||||
|
total_updated += cursor.rowcount
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
print(f"\n✅ Total updates: {total_updated} language entries!")
|
||||||
|
|
||||||
|
# Show EdgeTTS voices specifically
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("EdgeTTS Voices (Final):")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT v.name, v.tts_voice, v.languages
|
||||||
|
FROM ai_tts_voice v
|
||||||
|
JOIN ai_model_config m ON v.tts_model_id = m.id
|
||||||
|
WHERE m.model_name = 'EdgeTTS'
|
||||||
|
ORDER BY v.name
|
||||||
|
""")
|
||||||
|
|
||||||
|
voices = cursor.fetchall()
|
||||||
|
|
||||||
|
print(f"{'Name':<20} {'Voice ID':<35} {'Language':<20}")
|
||||||
|
print("-" * 75)
|
||||||
|
for voice in voices:
|
||||||
|
print(f"{voice[0]:<20} {voice[1]:<35} {voice[2] or 'N/A':<20}")
|
||||||
|
|
||||||
|
print(f"\n✅ EdgeTTS voices are ready! The voice IDs (like zh-CN-XiaoxiaoNeural) remain unchanged.")
|
||||||
|
print("✅ EdgeTTS will continue to work properly with these English display names.")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
97
main/xiaozhi-server/fix_groq_model_id.py
Normal file
97
main/xiaozhi-server/fix_groq_model_id.py
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Fixing Groq Model ID:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# First check current status
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name, model_type
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE id = 'GroqLLM' OR id = 'Groq LLM' OR model_name LIKE '%Groq%'
|
||||||
|
""")
|
||||||
|
|
||||||
|
current_model = cursor.fetchall()
|
||||||
|
print("Current Groq Model:")
|
||||||
|
for model in current_model:
|
||||||
|
print(f" ID: {model[0]}, Name: {model[1]}, Type: {model[2]}")
|
||||||
|
|
||||||
|
# Update the model ID from GroqLLM to Groq LLM
|
||||||
|
print("\nUpdating model ID from 'GroqLLM' to 'Groq LLM'...")
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_model_config
|
||||||
|
SET id = 'Groq LLM'
|
||||||
|
WHERE id = 'GroqLLM'
|
||||||
|
""")
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated model ID: 'GroqLLM' → 'Groq LLM'")
|
||||||
|
|
||||||
|
# Also update any agent references
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_agent
|
||||||
|
SET llm_model_id = 'Groq LLM'
|
||||||
|
WHERE llm_model_id = 'GroqLLM'
|
||||||
|
""")
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated {cursor.rowcount} agent references: 'GroqLLM' → 'Groq LLM'")
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
# Verify the changes
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Verification:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name, model_type
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE id = 'Groq LLM' OR model_name LIKE '%Groq%'
|
||||||
|
""")
|
||||||
|
|
||||||
|
updated_model = cursor.fetchall()
|
||||||
|
print("Updated Groq Model:")
|
||||||
|
for model in updated_model:
|
||||||
|
print(f" ID: {model[0]}, Name: {model[1]}, Type: {model[2]}")
|
||||||
|
|
||||||
|
# Check agents using this model
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT agent_name, llm_model_id
|
||||||
|
FROM ai_agent
|
||||||
|
WHERE llm_model_id = 'Groq LLM'
|
||||||
|
""")
|
||||||
|
|
||||||
|
agents = cursor.fetchall()
|
||||||
|
if agents:
|
||||||
|
print(f"\nAgents using Groq LLM ({len(agents)} total):")
|
||||||
|
for agent in agents:
|
||||||
|
print(f" - {agent[0]}: {agent[1]}")
|
||||||
|
|
||||||
|
print("\n✅ Model ID successfully changed to 'Groq LLM'")
|
||||||
|
print("✅ The Manager API should now work without errors")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
156
main/xiaozhi-server/fix_model_ids.py
Normal file
156
main/xiaozhi-server/fix_model_ids.py
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Checking Model ID Issues:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# First, check the GroqLLM model
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name, model_type
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE id = 'GroqLLM' OR model_name = 'Groq LLM' OR model_name = 'GroqLLM'
|
||||||
|
""")
|
||||||
|
|
||||||
|
groq_model = cursor.fetchall()
|
||||||
|
print("Groq Model Status:")
|
||||||
|
for model in groq_model:
|
||||||
|
print(f" ID: {model[0]}, Name: {model[1]}, Type: {model[2]}")
|
||||||
|
|
||||||
|
# Check agents that might be using wrong model IDs
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Checking Agent Configurations:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, agent_name, llm_model_id, tts_model_id, asr_model_id
|
||||||
|
FROM ai_agent
|
||||||
|
WHERE llm_model_id = 'Groq LLM'
|
||||||
|
OR llm_model_id = 'GroqLLM'
|
||||||
|
OR llm_model_id LIKE '%Groq%'
|
||||||
|
""")
|
||||||
|
|
||||||
|
agents = cursor.fetchall()
|
||||||
|
if agents:
|
||||||
|
print(f"Found {len(agents)} agents with Groq LLM:")
|
||||||
|
for agent in agents:
|
||||||
|
print(f" Agent: {agent[1]} (ID: {agent[0]})")
|
||||||
|
print(f" LLM Model ID: {agent[2]}")
|
||||||
|
|
||||||
|
# Fix the issue - update agents with wrong model IDs
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Fixing Model ID References:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Update agents that have "Groq LLM" as model ID to use "GroqLLM"
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_agent
|
||||||
|
SET llm_model_id = 'GroqLLM'
|
||||||
|
WHERE llm_model_id = 'Groq LLM'
|
||||||
|
""")
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Fixed {cursor.rowcount} agents with incorrect LLM model ID")
|
||||||
|
|
||||||
|
# Also check and fix any other model ID mismatches
|
||||||
|
model_id_fixes = [
|
||||||
|
('Groq LLM', 'GroqLLM'),
|
||||||
|
('EdgeTTS', 'TTS_EdgeTTS'),
|
||||||
|
('Deepgram Speech Recognition', 'Deepgram'),
|
||||||
|
# Add more mappings if needed
|
||||||
|
]
|
||||||
|
|
||||||
|
for old_id, new_id in model_id_fixes:
|
||||||
|
# Fix LLM model IDs
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_agent
|
||||||
|
SET llm_model_id = %s
|
||||||
|
WHERE llm_model_id = %s
|
||||||
|
""", (new_id, old_id))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Fixed {cursor.rowcount} agents: LLM '{old_id}' → '{new_id}'")
|
||||||
|
|
||||||
|
# Fix TTS model IDs
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_agent
|
||||||
|
SET tts_model_id = %s
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
""", (new_id, old_id))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Fixed {cursor.rowcount} agents: TTS '{old_id}' → '{new_id}'")
|
||||||
|
|
||||||
|
# Fix ASR model IDs
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_agent
|
||||||
|
SET asr_model_id = %s
|
||||||
|
WHERE asr_model_id = %s
|
||||||
|
""", (new_id, old_id))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Fixed {cursor.rowcount} agents: ASR '{old_id}' → '{new_id}'")
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
# Verify the fix
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Verification - Agents using Groq:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT a.agent_name, a.llm_model_id, m.model_name
|
||||||
|
FROM ai_agent a
|
||||||
|
LEFT JOIN ai_model_config m ON a.llm_model_id = m.id
|
||||||
|
WHERE a.llm_model_id LIKE '%Groq%' OR m.model_name LIKE '%Groq%'
|
||||||
|
""")
|
||||||
|
|
||||||
|
results = cursor.fetchall()
|
||||||
|
if results:
|
||||||
|
for result in results:
|
||||||
|
print(f"Agent: {result[0]}")
|
||||||
|
print(f" LLM Model ID: {result[1]}")
|
||||||
|
print(f" Model Name: {result[2] or 'NOT FOUND'}")
|
||||||
|
else:
|
||||||
|
print("No agents using Groq models found.")
|
||||||
|
|
||||||
|
# Check all model configs to ensure IDs match
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("All Model Configurations:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name, model_type
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE model_type = 'LLM'
|
||||||
|
ORDER BY model_name
|
||||||
|
""")
|
||||||
|
|
||||||
|
print(f"{'ID':<30} {'Name':<30} {'Type':<10}")
|
||||||
|
print("-" * 70)
|
||||||
|
for model in cursor.fetchall():
|
||||||
|
print(f"{model[0]:<30} {model[1]:<30} {model[2]:<10}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
213
main/xiaozhi-server/translate_params_remarks.py
Normal file
213
main/xiaozhi-server/translate_params_remarks.py
Normal file
|
|
@ -0,0 +1,213 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Current Parameter Remarks in Database:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Get all parameters with their remarks
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, param_code, param_value, remark
|
||||||
|
FROM sys_params
|
||||||
|
ORDER BY param_code
|
||||||
|
""")
|
||||||
|
|
||||||
|
params = cursor.fetchall()
|
||||||
|
|
||||||
|
print(f"Found {len(params)} parameters:")
|
||||||
|
print("-" * 60)
|
||||||
|
|
||||||
|
for param in params:
|
||||||
|
if param[3]: # If remark exists
|
||||||
|
print(f"Code: {param[1]}")
|
||||||
|
print(f" Remark: {param[3]}")
|
||||||
|
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Translating Chinese Remarks to English:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Translation mappings for common parameter remarks
|
||||||
|
translations = [
|
||||||
|
# System parameters
|
||||||
|
("是否允许用户注册", "Allow user registration"),
|
||||||
|
("允许用户注册", "Allow user registration"),
|
||||||
|
("是否启用手机号注册", "Enable mobile phone registration"),
|
||||||
|
("启用手机号注册", "Enable mobile phone registration"),
|
||||||
|
("系统公告", "System announcement"),
|
||||||
|
("系统版本", "System version"),
|
||||||
|
("系统名称", "System name"),
|
||||||
|
("系统描述", "System description"),
|
||||||
|
("系统邮箱", "System email"),
|
||||||
|
("系统电话", "System phone"),
|
||||||
|
("系统地址", "System address"),
|
||||||
|
("系统备案号", "System ICP number"),
|
||||||
|
("版权信息", "Copyright information"),
|
||||||
|
|
||||||
|
# Security parameters
|
||||||
|
("密码最小长度", "Minimum password length"),
|
||||||
|
("密码最大长度", "Maximum password length"),
|
||||||
|
("密码复杂度要求", "Password complexity requirements"),
|
||||||
|
("登录失败次数限制", "Login failure limit"),
|
||||||
|
("账户锁定时长", "Account lock duration"),
|
||||||
|
("会话超时时间", "Session timeout period"),
|
||||||
|
("验证码有效期", "Verification code validity period"),
|
||||||
|
("刷新令牌有效期", "Refresh token validity period"),
|
||||||
|
("访问令牌有效期", "Access token validity period"),
|
||||||
|
|
||||||
|
# Email/SMS configuration
|
||||||
|
("邮件服务器地址", "Email server address"),
|
||||||
|
("邮件服务器端口", "Email server port"),
|
||||||
|
("邮件发送者", "Email sender"),
|
||||||
|
("邮件密码", "Email password"),
|
||||||
|
("短信服务商", "SMS service provider"),
|
||||||
|
("短信API密钥", "SMS API key"),
|
||||||
|
("短信签名", "SMS signature"),
|
||||||
|
("短信模板", "SMS template"),
|
||||||
|
|
||||||
|
# File upload
|
||||||
|
("文件上传大小限制", "File upload size limit"),
|
||||||
|
("允许上传的文件类型", "Allowed file types for upload"),
|
||||||
|
("文件存储路径", "File storage path"),
|
||||||
|
("图片压缩质量", "Image compression quality"),
|
||||||
|
|
||||||
|
# API configuration
|
||||||
|
("API请求限制", "API request limit"),
|
||||||
|
("API密钥", "API key"),
|
||||||
|
("API密钥有效期", "API key validity period"),
|
||||||
|
("接口调用频率限制", "API call frequency limit"),
|
||||||
|
("接口超时时间", "API timeout period"),
|
||||||
|
|
||||||
|
# Database configuration
|
||||||
|
("数据库备份路径", "Database backup path"),
|
||||||
|
("数据库备份周期", "Database backup cycle"),
|
||||||
|
("数据保留天数", "Data retention days"),
|
||||||
|
|
||||||
|
# Common terms
|
||||||
|
("启用", "Enable"),
|
||||||
|
("禁用", "Disable"),
|
||||||
|
("开启", "Turn on"),
|
||||||
|
("关闭", "Turn off"),
|
||||||
|
("默认值", "Default value"),
|
||||||
|
("配置项", "Configuration item"),
|
||||||
|
("参数设置", "Parameter setting"),
|
||||||
|
("系统配置", "System configuration"),
|
||||||
|
("基础设置", "Basic settings"),
|
||||||
|
("高级设置", "Advanced settings"),
|
||||||
|
|
||||||
|
# Feature flags
|
||||||
|
("功能开关", "Feature toggle"),
|
||||||
|
("实验性功能", "Experimental feature"),
|
||||||
|
("调试模式", "Debug mode"),
|
||||||
|
("开发模式", "Development mode"),
|
||||||
|
("生产模式", "Production mode"),
|
||||||
|
|
||||||
|
# Limits and thresholds
|
||||||
|
("最大连接数", "Maximum connections"),
|
||||||
|
("最小连接数", "Minimum connections"),
|
||||||
|
("连接超时", "Connection timeout"),
|
||||||
|
("请求超时", "Request timeout"),
|
||||||
|
("重试次数", "Retry count"),
|
||||||
|
("重试间隔", "Retry interval"),
|
||||||
|
|
||||||
|
# Other common terms
|
||||||
|
("备注", "Remark"),
|
||||||
|
("说明", "Description"),
|
||||||
|
("注意事项", "Notes"),
|
||||||
|
("提示", "Hint"),
|
||||||
|
("警告", "Warning"),
|
||||||
|
("错误", "Error"),
|
||||||
|
("成功", "Success"),
|
||||||
|
("失败", "Failure"),
|
||||||
|
("状态", "Status"),
|
||||||
|
("类型", "Type"),
|
||||||
|
("分类", "Category"),
|
||||||
|
("标签", "Tag"),
|
||||||
|
("优先级", "Priority"),
|
||||||
|
("排序", "Sort order"),
|
||||||
|
("序号", "Serial number"),
|
||||||
|
("编号", "Number"),
|
||||||
|
("代码", "Code"),
|
||||||
|
("名称", "Name"),
|
||||||
|
("标题", "Title"),
|
||||||
|
("内容", "Content"),
|
||||||
|
("详情", "Details"),
|
||||||
|
("摘要", "Summary"),
|
||||||
|
("创建时间", "Create time"),
|
||||||
|
("更新时间", "Update time"),
|
||||||
|
("创建人", "Creator"),
|
||||||
|
("更新人", "Updater"),
|
||||||
|
("操作人", "Operator"),
|
||||||
|
("负责人", "Person in charge"),
|
||||||
|
("联系人", "Contact person"),
|
||||||
|
("联系方式", "Contact information"),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_updated = 0
|
||||||
|
|
||||||
|
# Update each parameter's remark
|
||||||
|
for param_id, param_code, param_value, remark in params:
|
||||||
|
if remark:
|
||||||
|
new_remark = remark
|
||||||
|
# Apply translations
|
||||||
|
for chinese, english in translations:
|
||||||
|
if chinese in new_remark:
|
||||||
|
new_remark = new_remark.replace(chinese, english)
|
||||||
|
|
||||||
|
# If remark was changed, update it
|
||||||
|
if new_remark != remark:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE sys_params
|
||||||
|
SET remark = %s
|
||||||
|
WHERE id = %s
|
||||||
|
""", (new_remark, param_id))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: {param_code}")
|
||||||
|
print(f" Old: {remark}")
|
||||||
|
print(f" New: {new_remark}")
|
||||||
|
total_updated += 1
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
if total_updated > 0:
|
||||||
|
print(f"\n✅ Successfully updated {total_updated} parameter remarks!")
|
||||||
|
else:
|
||||||
|
print("\n⚠️ No parameter remarks needed updating.")
|
||||||
|
|
||||||
|
# Show final results
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Final Parameter Remarks:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT param_code, remark
|
||||||
|
FROM sys_params
|
||||||
|
WHERE remark IS NOT NULL AND remark != ''
|
||||||
|
ORDER BY param_code
|
||||||
|
""")
|
||||||
|
|
||||||
|
for param_code, remark in cursor.fetchall():
|
||||||
|
print(f"{param_code}: {remark}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
120
main/xiaozhi-server/update_all_chinese.py
Normal file
120
main/xiaozhi-server/update_all_chinese.py
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Updating all Chinese model names to English...")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Comprehensive list of updates
|
||||||
|
updates = [
|
||||||
|
# TTS Models
|
||||||
|
("302AI语音合成", "302AI TTS"),
|
||||||
|
("ACGN语音合成", "ACGN TTS"),
|
||||||
|
("Coze中文语音合成", "Coze Chinese TTS"),
|
||||||
|
("FishSpeech语音合成", "FishSpeech TTS"),
|
||||||
|
("机智云语音合成", "Gizwits TTS"),
|
||||||
|
("火山双流式语音合成", "Volcano Dual-Stream TTS"),
|
||||||
|
("火山引擎边缘大模型网关", "Volcano Edge Gateway"),
|
||||||
|
("硅基流动语音合成", "SiliconFlow TTS"),
|
||||||
|
("自定义语音合成", "Custom TTS"),
|
||||||
|
("豆包语音合成", "Doubao TTS"),
|
||||||
|
("阿里云语音合成", "Aliyun TTS"),
|
||||||
|
("阿里云语音合成(流式)", "Aliyun TTS (Streaming)"),
|
||||||
|
("Linkerai语音合成", "Linkerai TTS"),
|
||||||
|
("MiniMax语音合成", "MiniMax TTS"),
|
||||||
|
("OpenAI语音合成", "OpenAI TTS"),
|
||||||
|
("Index-TTS-vLLM流式语音合成", "Index-TTS-vLLM Streaming"),
|
||||||
|
|
||||||
|
# ASR Models
|
||||||
|
("FunASR服务语音识别", "FunASR Server Recognition"),
|
||||||
|
("FunASR语音识别", "FunASR Recognition"),
|
||||||
|
("Groq语音识别", "Groq Speech Recognition"),
|
||||||
|
("OpenAI语音识别", "OpenAI Speech Recognition"),
|
||||||
|
("Sherpa语音识别", "Sherpa Speech Recognition"),
|
||||||
|
("百度语音识别", "Baidu Speech Recognition"),
|
||||||
|
("腾讯语音识别", "Tencent Speech Recognition"),
|
||||||
|
("豆包语音识别", "Doubao Speech Recognition"),
|
||||||
|
("豆包语音识别(流式)", "Doubao Speech Recognition (Streaming)"),
|
||||||
|
("阿里云语音识别", "Aliyun Speech Recognition"),
|
||||||
|
("阿里云语音识别(流式)", "Aliyun Speech Recognition (Streaming)"),
|
||||||
|
|
||||||
|
# LLM Models
|
||||||
|
("豆包大模型", "Doubao LLM"),
|
||||||
|
("Ollama本地模型", "Ollama Local Model"),
|
||||||
|
("Xinference大模型", "Xinference LLM"),
|
||||||
|
("Xinference小模型", "Xinference Small Model"),
|
||||||
|
("智谱AI", "Zhipu AI"),
|
||||||
|
("谷歌Gemini", "Google Gemini"),
|
||||||
|
("通义千问", "Tongyi Qianwen"),
|
||||||
|
("通义百炼", "Tongyi Bailian"),
|
||||||
|
|
||||||
|
# Intent Models
|
||||||
|
("LLM意图识别", "LLM Intent Recognition"),
|
||||||
|
("函数调用意图识别", "Function Call Intent"),
|
||||||
|
("无意图识别", "No Intent Recognition"),
|
||||||
|
|
||||||
|
# Memory Models
|
||||||
|
("Mem0AI记忆", "Mem0AI Memory"),
|
||||||
|
("无记忆", "No Memory"),
|
||||||
|
("本地短期记忆", "Local Short-term Memory"),
|
||||||
|
|
||||||
|
# Vision Models
|
||||||
|
("千问视觉模型", "Qianwen Vision Model"),
|
||||||
|
("智谱视觉AI", "Zhipu Vision AI"),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_updated = 0
|
||||||
|
for old_name, new_name in updates:
|
||||||
|
sql = "UPDATE ai_model_config SET model_name = %s WHERE model_name = %s"
|
||||||
|
cursor.execute(sql, (new_name, old_name))
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: '{old_name}' → '{new_name}'")
|
||||||
|
total_updated += 1
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
if total_updated > 0:
|
||||||
|
print(f"\n✅ Successfully updated {total_updated} model names!")
|
||||||
|
else:
|
||||||
|
print("\n⚠️ No models needed updating.")
|
||||||
|
|
||||||
|
# Show final results
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Final Model Names:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT model_type, model_name, id
|
||||||
|
FROM ai_model_config
|
||||||
|
ORDER BY model_type, model_name
|
||||||
|
""")
|
||||||
|
|
||||||
|
current_type = None
|
||||||
|
for row in cursor.fetchall():
|
||||||
|
if row[0] != current_type:
|
||||||
|
current_type = row[0]
|
||||||
|
print(f"\n{current_type.upper()} Models:")
|
||||||
|
print(f" - {row[1]} (ID: {row[2]})")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
137
main/xiaozhi-server/update_edge_voices.py
Normal file
137
main/xiaozhi-server/update_edge_voices.py
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
# First check the column size
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = 'railway'
|
||||||
|
AND TABLE_NAME = 'ai_tts_voice'
|
||||||
|
AND COLUMN_NAME = 'name'
|
||||||
|
""")
|
||||||
|
|
||||||
|
col_info = cursor.fetchone()
|
||||||
|
if col_info:
|
||||||
|
print(f"Column 'name' max length: {col_info[1]} characters")
|
||||||
|
|
||||||
|
# Find EdgeTTS model
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, model_name
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE model_name LIKE '%Edge%' AND model_type = 'tts'
|
||||||
|
""")
|
||||||
|
edge_model = cursor.fetchone()
|
||||||
|
|
||||||
|
if edge_model:
|
||||||
|
print(f"\nEdgeTTS Model: {edge_model[1]} (ID: {edge_model[0]})")
|
||||||
|
|
||||||
|
# Get all EdgeTTS voices
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT id, name, tts_voice
|
||||||
|
FROM ai_tts_voice
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
ORDER BY name
|
||||||
|
""", (edge_model[0],))
|
||||||
|
|
||||||
|
voices = cursor.fetchall()
|
||||||
|
|
||||||
|
print(f"\n" + "=" * 60)
|
||||||
|
print("Updating EdgeTTS Voice Names (keeping them short):")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Shorter translations to fit within 20 characters
|
||||||
|
voice_translations = [
|
||||||
|
# Female voices - keep under 20 chars
|
||||||
|
("EdgeTTS女声-晓晓", "Xiaoxiao"),
|
||||||
|
("EdgeTTS女声-晓伊", "Xiaoyi"),
|
||||||
|
("EdgeTTS女声-晓双", "Xiaoshuang"),
|
||||||
|
("EdgeTTS女声-晓萱", "Xiaoxuan"),
|
||||||
|
("EdgeTTS女声-晓颜", "Xiaoyan"),
|
||||||
|
("EdgeTTS女声-晓悠", "Xiaoyou"),
|
||||||
|
("EdgeTTS女声-云夏", "Yunxia"),
|
||||||
|
("EdgeTTS女声-云燕", "Yunyan"),
|
||||||
|
("EdgeTTS女声-辽宁小贝", "Liaoning Xiaobei"),
|
||||||
|
("EdgeTTS女声-陕西小妮", "Shaanxi Xiaoni"),
|
||||||
|
("EdgeTTS女声-香港海佳", "HK HiuGaai"),
|
||||||
|
("EdgeTTS女声-香港海曼", "HK HiuMaan"),
|
||||||
|
|
||||||
|
# Male voices - keep under 20 chars
|
||||||
|
("EdgeTTS男声-云健", "Yunjian"),
|
||||||
|
("EdgeTTS男声-云泽", "Yunze"),
|
||||||
|
("EdgeTTS男声-云希", "Yunxi"),
|
||||||
|
("EdgeTTS男声-云扬", "Yunyang"),
|
||||||
|
("EdgeTTS男声-云夏", "Yunxia"),
|
||||||
|
("EdgeTTS男声-晓辰", "Xiaochen"),
|
||||||
|
("EdgeTTS男声-香港万龙", "HK WanLung"),
|
||||||
|
|
||||||
|
# English voices
|
||||||
|
("EdgeTTS女声-Jenny", "Jenny"),
|
||||||
|
("EdgeTTS女声-Aria", "Aria"),
|
||||||
|
("EdgeTTS男声-Guy", "Guy"),
|
||||||
|
("EdgeTTS男声-Davis", "Davis"),
|
||||||
|
]
|
||||||
|
|
||||||
|
updated_count = 0
|
||||||
|
for old_name, new_name in voice_translations:
|
||||||
|
# Make sure new name is not too long
|
||||||
|
if len(new_name) <= 20:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_tts_voice
|
||||||
|
SET name = %s
|
||||||
|
WHERE name = %s AND tts_model_id = %s
|
||||||
|
""", (new_name, old_name, edge_model[0]))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: '{old_name}' → '{new_name}'")
|
||||||
|
updated_count += cursor.rowcount
|
||||||
|
else:
|
||||||
|
print(f"⚠️ Skipped (too long): '{new_name}' ({len(new_name)} chars)")
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
if updated_count > 0:
|
||||||
|
print(f"\n✅ Successfully updated {updated_count} voice names!")
|
||||||
|
else:
|
||||||
|
print("\n⚠️ No voice names needed updating.")
|
||||||
|
|
||||||
|
# Show final results
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updated EdgeTTS Voices:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT name, tts_voice, languages
|
||||||
|
FROM ai_tts_voice
|
||||||
|
WHERE tts_model_id = %s
|
||||||
|
ORDER BY name
|
||||||
|
""", (edge_model[0],))
|
||||||
|
|
||||||
|
print(f"{'Name':<20} {'Voice ID':<30} {'Languages':<20}")
|
||||||
|
print("-" * 70)
|
||||||
|
for voice in cursor.fetchall():
|
||||||
|
print(f"{voice[0]:<20} {voice[1]:<30} {voice[2] or 'N/A':<20}")
|
||||||
|
else:
|
||||||
|
print("EdgeTTS model not found in database!")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
87
main/xiaozhi-server/update_languages.py
Normal file
87
main/xiaozhi-server/update_languages.py
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
print("=" * 60)
|
||||||
|
print("Updating Language Names in TTS Voices:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Update language names
|
||||||
|
language_updates = [
|
||||||
|
("普通话", "Mandarin"),
|
||||||
|
("粤语", "Cantonese"),
|
||||||
|
("辽宁", "Liaoning"),
|
||||||
|
("陕西", "Shaanxi"),
|
||||||
|
("四川", "Sichuan"),
|
||||||
|
("台湾", "Taiwan"),
|
||||||
|
("香港", "Hong Kong"),
|
||||||
|
("英语", "English"),
|
||||||
|
("日语", "Japanese"),
|
||||||
|
("韩语", "Korean"),
|
||||||
|
("法语", "French"),
|
||||||
|
("德语", "German"),
|
||||||
|
("西班牙语", "Spanish"),
|
||||||
|
("意大利语", "Italian"),
|
||||||
|
("俄语", "Russian"),
|
||||||
|
("阿拉伯语", "Arabic"),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_updated = 0
|
||||||
|
for old_lang, new_lang in language_updates:
|
||||||
|
cursor.execute("""
|
||||||
|
UPDATE ai_tts_voice
|
||||||
|
SET languages = %s
|
||||||
|
WHERE languages = %s
|
||||||
|
""", (new_lang, old_lang))
|
||||||
|
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated {cursor.rowcount} voices: '{old_lang}' → '{new_lang}'")
|
||||||
|
total_updated += cursor.rowcount
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
|
||||||
|
if total_updated > 0:
|
||||||
|
print(f"\n✅ Successfully updated {total_updated} language entries!")
|
||||||
|
|
||||||
|
# Show final results for EdgeTTS
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Final EdgeTTS Voice Configuration:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT v.name, v.tts_voice, v.languages, v.remark
|
||||||
|
FROM ai_tts_voice v
|
||||||
|
JOIN ai_model_config m ON v.tts_model_id = m.id
|
||||||
|
WHERE m.model_name LIKE '%Edge%'
|
||||||
|
ORDER BY v.name
|
||||||
|
""")
|
||||||
|
|
||||||
|
voices = cursor.fetchall()
|
||||||
|
|
||||||
|
print(f"{'Name':<20} {'Voice ID':<30} {'Language':<15} {'Remark':<20}")
|
||||||
|
print("-" * 85)
|
||||||
|
for voice in voices:
|
||||||
|
remark = (voice[3][:17] + '...') if voice[3] and len(voice[3]) > 20 else (voice[3] or '')
|
||||||
|
print(f"{voice[0]:<20} {voice[1]:<30} {voice[2] or 'N/A':<15} {remark:<20}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
116
main/xiaozhi-server/update_tts_models.py
Normal file
116
main/xiaozhi-server/update_tts_models.py
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pymysql
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Set UTF-8 encoding for output
|
||||||
|
if sys.platform == "win32":
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# Database connection
|
||||||
|
connection = pymysql.connect(
|
||||||
|
host='nozomi.proxy.rlwy.net',
|
||||||
|
port=25037,
|
||||||
|
user='root',
|
||||||
|
password='OcaVNLKcwNdyElfaeUPqvvfYZiiEHgdm',
|
||||||
|
database='railway',
|
||||||
|
charset='utf8mb4'
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
# Check TTS models
|
||||||
|
print("=" * 60)
|
||||||
|
print("Current TTS Models in Database:")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
sql = """
|
||||||
|
SELECT id, model_name, model_type, config_json
|
||||||
|
FROM ai_model_config
|
||||||
|
WHERE model_type = 'tts' OR model_name LIKE '%Edge%' OR model_name LIKE '%语音%' OR model_name LIKE '%TTS%'
|
||||||
|
ORDER BY model_name
|
||||||
|
"""
|
||||||
|
cursor.execute(sql)
|
||||||
|
results = cursor.fetchall()
|
||||||
|
|
||||||
|
if not results:
|
||||||
|
print("No TTS models found. Checking all models...")
|
||||||
|
cursor.execute("SELECT id, model_name, model_type FROM ai_model_config")
|
||||||
|
results = cursor.fetchall()
|
||||||
|
|
||||||
|
for row in results:
|
||||||
|
print(f"\nID: {row[0]}")
|
||||||
|
print(f"Model Name: {row[1]}")
|
||||||
|
print(f"Model Type: {row[2]}")
|
||||||
|
if len(row) > 3 and row[3]:
|
||||||
|
try:
|
||||||
|
config = json.loads(row[3])
|
||||||
|
print(f"Config Type: {config.get('type', 'N/A')}")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Update the Chinese text to English
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updating Chinese model names to English...")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
updates = [
|
||||||
|
("Edge语音合成", "Edge TTS"),
|
||||||
|
("Edge TTS语音合成", "Edge TTS"),
|
||||||
|
("百度语音合成", "Baidu TTS"),
|
||||||
|
("阿里语音合成", "Ali TTS"),
|
||||||
|
("腾讯语音合成", "Tencent TTS"),
|
||||||
|
("科大讯飞语音合成", "iFlytek TTS"),
|
||||||
|
("讯飞语音合成", "iFlytek TTS"),
|
||||||
|
("微软语音合成", "Microsoft TTS"),
|
||||||
|
("谷歌语音合成", "Google TTS"),
|
||||||
|
# Also update other model types if needed
|
||||||
|
("语音识别", "Speech Recognition"),
|
||||||
|
("语音活动检测", "Voice Activity Detection"),
|
||||||
|
("大语言模型", "Large Language Model"),
|
||||||
|
("视觉大模型", "Vision Language Model"),
|
||||||
|
("意图识别", "Intent Recognition"),
|
||||||
|
("记忆模型", "Memory Model")
|
||||||
|
]
|
||||||
|
|
||||||
|
for old_name, new_name in updates:
|
||||||
|
sql = "UPDATE ai_model_config SET model_name = %s WHERE model_name = %s"
|
||||||
|
cursor.execute(sql, (new_name, old_name))
|
||||||
|
if cursor.rowcount > 0:
|
||||||
|
print(f"✓ Updated: '{old_name}' → '{new_name}'")
|
||||||
|
|
||||||
|
# Also check for partial matches and update them
|
||||||
|
cursor.execute("SELECT id, model_name FROM ai_model_config WHERE model_name LIKE '%语音%' OR model_name LIKE '%模型%'")
|
||||||
|
chinese_models = cursor.fetchall()
|
||||||
|
|
||||||
|
if chinese_models:
|
||||||
|
print("\nFound models with Chinese characters:")
|
||||||
|
for model_id, model_name in chinese_models:
|
||||||
|
print(f" - {model_name} (ID: {model_id})")
|
||||||
|
|
||||||
|
connection.commit()
|
||||||
|
print("\n✅ All model names have been updated to English!")
|
||||||
|
|
||||||
|
# Verify the changes
|
||||||
|
print("\n" + "=" * 60)
|
||||||
|
print("Updated Models (showing all):")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
cursor.execute("""
|
||||||
|
SELECT model_type, model_name, id
|
||||||
|
FROM ai_model_config
|
||||||
|
ORDER BY model_type, model_name
|
||||||
|
""")
|
||||||
|
|
||||||
|
current_type = None
|
||||||
|
for row in cursor.fetchall():
|
||||||
|
if row[0] != current_type:
|
||||||
|
current_type = row[0]
|
||||||
|
print(f"\n{current_type.upper()} Models:")
|
||||||
|
print(f" - {row[1]} (ID: {row[2]})")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
connection.close()
|
||||||
Loading…
Reference in a new issue