mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
update:优化OTA增删改查
This commit is contained in:
parent
0193d1ad64
commit
5789d69da4
33 changed files with 582 additions and 816 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -164,3 +164,4 @@ main/manager-api/.vscode
|
||||||
# Ignore webpack cache directory
|
# Ignore webpack cache directory
|
||||||
main/manager-web/.webpack_cache/
|
main/manager-web/.webpack_cache/
|
||||||
main/xiaozhi-server/mysql
|
main/xiaozhi-server/mysql
|
||||||
|
uploadfile
|
||||||
|
|
|
||||||
|
|
@ -167,5 +167,5 @@ public interface Constant {
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
*/
|
*/
|
||||||
public static final String VERSION = "0.3.9";
|
public static final String VERSION = "0.3.10";
|
||||||
}
|
}
|
||||||
|
|
@ -80,6 +80,13 @@ public class RedisKeys {
|
||||||
* 获取版本号Key
|
* 获取版本号Key
|
||||||
*/
|
*/
|
||||||
public static String getVersionKey() {
|
public static String getVersionKey() {
|
||||||
return "system:version";
|
return "sys:version";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OTA固件ID的Key
|
||||||
|
*/
|
||||||
|
public static String getOtaIdKey(String uuid) {
|
||||||
|
return "ota:id:" + uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
package xiaozhi.common.utils;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询参数
|
|
||||||
*/
|
|
||||||
public class Query<T> {
|
|
||||||
|
|
||||||
public IPage<T> getPage(Map<String, Object> params) {
|
|
||||||
return getPage(params, null, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPage<T> getPage(Map<String, Object> params, String defaultOrderField, boolean isAsc) {
|
|
||||||
// 分页参数
|
|
||||||
long curPage = 1;
|
|
||||||
long limit = 10;
|
|
||||||
|
|
||||||
if (params.get("page") != null) {
|
|
||||||
curPage = Long.parseLong((String) params.get("page"));
|
|
||||||
}
|
|
||||||
if (params.get("limit") != null) {
|
|
||||||
limit = Long.parseLong((String) params.get("limit"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分页对象
|
|
||||||
Page<T> page = new Page<>(curPage, limit);
|
|
||||||
|
|
||||||
// 排序字段
|
|
||||||
String orderField = (String) params.get("orderField");
|
|
||||||
String order = (String) params.get("order");
|
|
||||||
|
|
||||||
// 前端字段排序
|
|
||||||
if (StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)) {
|
|
||||||
if ("asc".equalsIgnoreCase(order)) {
|
|
||||||
return page.addOrder(OrderItem.asc(orderField));
|
|
||||||
} else {
|
|
||||||
return page.addOrder(OrderItem.desc(orderField));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 默认排序
|
|
||||||
if (isAsc) {
|
|
||||||
page.addOrder(OrderItem.asc(defaultOrderField));
|
|
||||||
} else {
|
|
||||||
page.addOrder(OrderItem.desc(defaultOrderField));
|
|
||||||
}
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,259 @@
|
||||||
|
package xiaozhi.modules.device.controller;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import xiaozhi.common.constant.Constant;
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.redis.RedisUtils;
|
||||||
|
import xiaozhi.common.utils.Result;
|
||||||
|
import xiaozhi.common.validator.ValidatorUtils;
|
||||||
|
import xiaozhi.modules.device.entity.OtaEntity;
|
||||||
|
import xiaozhi.modules.device.service.OtaService;
|
||||||
|
|
||||||
|
@Tag(name = "设备管理", description = "OTA 相关接口")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/otaMag")
|
||||||
|
public class OTAMagController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OTAController.class);
|
||||||
|
private final OtaService otaService;
|
||||||
|
private final RedisUtils redisUtils;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "分页查询 OTA 固件信息")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true),
|
||||||
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true)
|
||||||
|
})
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<PageData<OtaEntity>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||||
|
ValidatorUtils.validateEntity(params);
|
||||||
|
PageData<OtaEntity> page = otaService.page(params);
|
||||||
|
return new Result<PageData<OtaEntity>>().ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@Operation(summary = "信息 OTA 固件信息")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<OtaEntity> get(@PathVariable("id") String id) {
|
||||||
|
OtaEntity data = otaService.selectById(id);
|
||||||
|
return new Result<OtaEntity>().ok(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "保存 OTA 固件信息")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<Void> save(@RequestBody OtaEntity entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return new Result<Void>().error("固件信息不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(entity.getFirmwareName())) {
|
||||||
|
return new Result<Void>().error("固件名称不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(entity.getType())) {
|
||||||
|
return new Result<Void>().error("固件类型不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(entity.getVersion())) {
|
||||||
|
return new Result<Void>().error("版本号不能为空");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
otaService.save(entity);
|
||||||
|
return new Result<Void>();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return new Result<Void>().error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@Operation(summary = "修改 OTA 固件信息")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<?> update(@PathVariable("id") String id, @RequestBody OtaEntity entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return new Result<>().error("固件信息不能为空");
|
||||||
|
}
|
||||||
|
entity.setId(id);
|
||||||
|
try {
|
||||||
|
otaService.update(entity);
|
||||||
|
return new Result<>();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
return new Result<>().error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@Operation(summary = "OTA 删除")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<Void> delete(@PathVariable("id") String[] ids) {
|
||||||
|
if (ids == null || ids.length == 0) {
|
||||||
|
return new Result<Void>().error("删除的固件ID不能为空");
|
||||||
|
}
|
||||||
|
otaService.delete(ids);
|
||||||
|
return new Result<Void>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/download/{id}")
|
||||||
|
@Operation(summary = "下载固件文件")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public ResponseEntity<byte[]> downloadFirmware(@PathVariable("id") String id) {
|
||||||
|
try {
|
||||||
|
// 获取固件信息
|
||||||
|
OtaEntity otaEntity = otaService.selectById(id);
|
||||||
|
if (otaEntity == null || StringUtils.isBlank(otaEntity.getFirmwarePath())) {
|
||||||
|
logger.warn("Firmware not found or path is empty for ID: {}", id);
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件路径 - 确保路径是绝对路径或正确的相对路径
|
||||||
|
String firmwarePath = otaEntity.getFirmwarePath();
|
||||||
|
Path path;
|
||||||
|
|
||||||
|
// 检查是否是绝对路径
|
||||||
|
if (Paths.get(firmwarePath).isAbsolute()) {
|
||||||
|
path = Paths.get(firmwarePath);
|
||||||
|
} else {
|
||||||
|
// 如果是相对路径,则从当前工作目录解析
|
||||||
|
path = Paths.get(System.getProperty("user.dir"), firmwarePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Attempting to download firmware for ID: {}, DB path: {}, resolved path: {}",
|
||||||
|
id, firmwarePath, path.toAbsolutePath());
|
||||||
|
|
||||||
|
if (!Files.exists(path) || !Files.isRegularFile(path)) {
|
||||||
|
// 尝试直接从firmware目录下查找文件名
|
||||||
|
String fileName = new File(firmwarePath).getName();
|
||||||
|
Path altPath = Paths.get(System.getProperty("user.dir"), "firmware", fileName);
|
||||||
|
|
||||||
|
logger.info("File not found at primary path, trying alternative path: {}", altPath.toAbsolutePath());
|
||||||
|
|
||||||
|
if (Files.exists(altPath) && Files.isRegularFile(altPath)) {
|
||||||
|
path = altPath;
|
||||||
|
} else {
|
||||||
|
logger.error("Firmware file not found at either path: {} or {}",
|
||||||
|
path.toAbsolutePath(), altPath.toAbsolutePath());
|
||||||
|
return ResponseEntity.notFound().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取文件内容
|
||||||
|
byte[] fileContent = Files.readAllBytes(path);
|
||||||
|
|
||||||
|
// 设置响应头
|
||||||
|
String originalFilename = otaEntity.getFirmwareName() + "_" + otaEntity.getVersion();
|
||||||
|
if (firmwarePath.contains(".")) {
|
||||||
|
String extension = firmwarePath.substring(firmwarePath.lastIndexOf("."));
|
||||||
|
originalFilename += extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理文件名,移除不安全字符
|
||||||
|
String safeFilename = originalFilename.replaceAll("[^a-zA-Z0-9._-]", "_");
|
||||||
|
|
||||||
|
logger.info("Providing download for firmware ID: {}, filename: {}, size: {} bytes",
|
||||||
|
id, safeFilename, fileContent.length);
|
||||||
|
|
||||||
|
return ResponseEntity.ok()
|
||||||
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + safeFilename + "\"")
|
||||||
|
.body(fileContent);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Error reading firmware file for ID: {}", id, e);
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Unexpected error during firmware download for ID: {}", id, e);
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@Operation(summary = "上传固件文件")
|
||||||
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
public Result<String> uploadFirmware(@RequestParam("file") MultipartFile file) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
return new Result<String>().error("上传文件不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查文件扩展名
|
||||||
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
if (originalFilename == null) {
|
||||||
|
return new Result<String>().error("文件名不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
String extension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
|
||||||
|
if (!extension.equals(".bin") && !extension.equals(".apk")) {
|
||||||
|
return new Result<String>().error("只允许上传.bin和.apk格式的文件");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 计算文件的MD5值
|
||||||
|
String md5 = calculateMD5(file);
|
||||||
|
|
||||||
|
// 设置存储路径
|
||||||
|
String uploadDir = "uploadfile";
|
||||||
|
Path uploadPath = Paths.get(uploadDir);
|
||||||
|
|
||||||
|
// 如果目录不存在,创建目录
|
||||||
|
if (!Files.exists(uploadPath)) {
|
||||||
|
Files.createDirectories(uploadPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用MD5作为文件名,固定使用.bin扩展名
|
||||||
|
String uniqueFileName = md5 + extension;
|
||||||
|
Path filePath = uploadPath.resolve(uniqueFileName);
|
||||||
|
|
||||||
|
// 检查文件是否已存在
|
||||||
|
if (Files.exists(filePath)) {
|
||||||
|
return new Result<String>().ok(filePath.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存文件
|
||||||
|
Files.copy(file.getInputStream(), filePath);
|
||||||
|
|
||||||
|
// 返回文件路径
|
||||||
|
return new Result<String>().ok(filePath.toString());
|
||||||
|
} catch (IOException | NoSuchAlgorithmException e) {
|
||||||
|
return new Result<String>().error("文件上传失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String calculateMD5(MultipartFile file) throws IOException, NoSuchAlgorithmException {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] digest = md.digest(file.getBytes());
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte b : digest) {
|
||||||
|
sb.append(String.format("%02x", b));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package xiaozhi.modules.device.service;
|
package xiaozhi.modules.device.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import xiaozhi.common.page.PageData;
|
|
||||||
import xiaozhi.modules.device.entity.OtaEntity;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.service.BaseService;
|
||||||
|
import xiaozhi.modules.device.entity.OtaEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OTA固件管理
|
* OTA固件管理
|
||||||
*/
|
*/
|
||||||
public interface OtaService extends IService<OtaEntity> {
|
public interface OtaService extends BaseService<OtaEntity> {
|
||||||
PageData<OtaEntity> page(Map<String, Object> params);
|
PageData<OtaEntity> page(Map<String, Object> params);
|
||||||
|
|
||||||
boolean save(OtaEntity entity);
|
boolean save(OtaEntity entity);
|
||||||
|
|
|
||||||
|
|
@ -1,65 +1,74 @@
|
||||||
package xiaozhi.modules.device.service.impl;
|
package xiaozhi.modules.device.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import xiaozhi.common.page.PageData;
|
|
||||||
import xiaozhi.common.utils.Query;
|
|
||||||
import xiaozhi.modules.device.dao.OtaDao;
|
|
||||||
import xiaozhi.modules.device.entity.OtaEntity;
|
|
||||||
import xiaozhi.modules.device.service.OtaService;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
||||||
|
import io.micrometer.common.util.StringUtils;
|
||||||
|
import xiaozhi.common.page.PageData;
|
||||||
|
import xiaozhi.common.service.impl.BaseServiceImpl;
|
||||||
|
import xiaozhi.modules.device.dao.OtaDao;
|
||||||
|
import xiaozhi.modules.device.entity.OtaEntity;
|
||||||
|
import xiaozhi.modules.device.service.OtaService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OtaServiceImpl extends ServiceImpl<OtaDao, OtaEntity> implements OtaService {
|
public class OtaServiceImpl extends BaseServiceImpl<OtaDao, OtaEntity> implements OtaService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<OtaEntity> page(Map<String, Object> params) {
|
public PageData<OtaEntity> page(Map<String, Object> params) {
|
||||||
IPage<OtaEntity> page = baseMapper.selectPage(
|
IPage<OtaEntity> page = baseDao.selectPage(
|
||||||
new Query<OtaEntity>().getPage(params),
|
getPage(params, "update_date", true),
|
||||||
new QueryWrapper<OtaEntity>()
|
getWrapper(params));
|
||||||
.orderByDesc("create_date")
|
|
||||||
);
|
|
||||||
|
|
||||||
return new PageData<>(page.getRecords(), page.getTotal());
|
return new PageData<>(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private QueryWrapper<OtaEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
String firmwareName = (String) params.get("firmwareName");
|
||||||
|
|
||||||
|
QueryWrapper<OtaEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.like(StringUtils.isNotBlank(firmwareName), "firmware_name", firmwareName);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(OtaEntity entity) {
|
public void update(OtaEntity entity) {
|
||||||
// 检查是否存在相同名称、类型和版本的固件(排除当前记录)
|
// 检查是否存在相同名称、类型和版本的固件(排除当前记录)
|
||||||
QueryWrapper<OtaEntity> queryWrapper = new QueryWrapper<OtaEntity>()
|
QueryWrapper<OtaEntity> queryWrapper = new QueryWrapper<OtaEntity>()
|
||||||
.eq("firmware_name", entity.getFirmwareName())
|
.eq("firmware_name", entity.getFirmwareName())
|
||||||
.eq("type", entity.getType())
|
.eq("type", entity.getType())
|
||||||
.eq("version", entity.getVersion())
|
.eq("version", entity.getVersion())
|
||||||
.ne("id", entity.getId()); // 排除当前记录
|
.ne("id", entity.getId()); // 排除当前记录
|
||||||
|
|
||||||
if (baseMapper.selectCount(queryWrapper) > 0) {
|
if (baseDao.selectCount(queryWrapper) > 0) {
|
||||||
throw new RuntimeException("已存在相同名称、类型和版本的固件,请修改后重试");
|
throw new RuntimeException("已存在相同名称、类型和版本的固件,请修改后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
baseMapper.updateById(entity);
|
baseDao.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String[] ids) {
|
public void delete(String[] ids) {
|
||||||
baseMapper.deleteBatchIds(Arrays.asList(ids));
|
baseDao.deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean save(OtaEntity entity) {
|
public boolean save(OtaEntity entity) {
|
||||||
// 检查是否存在相同名称、类型和版本的固件
|
// 检查是否存在相同名称、类型和版本的固件
|
||||||
QueryWrapper<OtaEntity> queryWrapper = new QueryWrapper<OtaEntity>()
|
QueryWrapper<OtaEntity> queryWrapper = new QueryWrapper<OtaEntity>()
|
||||||
.eq("firmware_name", entity.getFirmwareName())
|
.eq("firmware_name", entity.getFirmwareName())
|
||||||
.eq("type", entity.getType())
|
.eq("type", entity.getType())
|
||||||
.eq("version", entity.getVersion());
|
.eq("version", entity.getVersion());
|
||||||
|
|
||||||
if (baseMapper.selectCount(queryWrapper) > 0) {
|
if (baseDao.selectCount(queryWrapper) > 0) {
|
||||||
throw new RuntimeException("已存在相同名称、类型和版本的固件,请勿重复添加");
|
throw new RuntimeException("已存在相同名称、类型和版本的固件,请勿重复添加");
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseMapper.insert(entity) > 0;
|
return baseDao.insert(entity) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package xiaozhi.modules.sys.config;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import xiaozhi.modules.sys.service.SysParamsService;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@DependsOn("liquibase")
|
|
||||||
public class SystemInitConfig {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysParamsService sysParamsService;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
sysParamsService.initServerSecret();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -24,7 +24,6 @@ public class TimbreDataDTO {
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
@NotBlank(message = "{timbre.remark.require}")
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
|
|
@ -40,6 +39,5 @@ public class TimbreDataDTO {
|
||||||
private String ttsVoice;
|
private String ttsVoice;
|
||||||
|
|
||||||
@Schema(description = "音频播放地址")
|
@Schema(description = "音频播放地址")
|
||||||
@NotBlank(message = "{timbre.voiceDemo.require}")
|
|
||||||
private String voiceDemo;
|
private String voiceDemo;
|
||||||
}
|
}
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
-- 本文件用于初始化模型配置数据,无需手动执行,在项目启动时会自动执行
|
|
||||||
-- -------------------------------------------------------
|
|
||||||
-- 初始化模型配置数据
|
|
||||||
DELETE FROM `ai_model_config`;
|
|
||||||
|
|
||||||
-- VAD模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('VAD_SileroVAD', 'VAD', 'SileroVAD', '语音活动检测', 1, 1, '{\"type\": \"silero\", \"model_dir\": \"models/snakers4_silero-vad\", \"threshold\": 0.5, \"min_silence_duration_ms\": 700}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- ASR模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('ASR_FunASR', 'ASR', 'FunASR', 'FunASR语音识别', 1, 1, '{\"type\": \"fun_local\", \"model_dir\": \"models/SenseVoiceSmall\", \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('ASR_SherpaASR', 'ASR', 'SherpaASR', 'Sherpa语音识别', 1, 0, '{\"type\": \"sherpa_onnx_local\", \"model_dir\": \"models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17\", \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('ASR_DoubaoASR', 'ASR', 'DoubaoASR', '豆包语音识别', 1, 0, '{\"type\": \"doubao\", \"appid\": \"\", \"access_token\": \"\", \"cluster\": \"volcengine_input_common\", \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- LLM模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_AliLLM', 'LLM', 'AliLLM', '通义千问', 1, 0, '{\"type\": \"openai\", \"base_url\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\", \"model_name\": \"qwen-turbo\", \"api_key\": \"\", \"temperature\": 0.7, \"max_tokens\": 500, \"top_p\": 1, \"top_k\": 50, \"frequency_penalty\": 0}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_AliAppLLM', 'LLM', 'AliAppLLM', '通义百炼', 1, 0, '{\"type\": \"AliBL\", \"base_url\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\", \"app_id\": \"\", \"api_key\": \"\", \"is_no_prompt\": true, \"ali_memory_id\": false}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_DoubaoLLM', 'LLM', 'DoubaoLLM', '豆包大模型', 1, 0, '{\"type\": \"openai\", \"base_url\": \"https://ark.cn-beijing.volces.com/api/v3\", \"model_name\": \"doubao-pro-32k-functioncall-241028\", \"api_key\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_DeepSeekLLM', 'LLM', 'DeepSeekLLM', 'DeepSeek', 1, 0, '{\"type\": \"openai\", \"model_name\": \"deepseek-chat\", \"url\": \"https://api.deepseek.com\", \"api_key\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_ChatGLMLLM', 'LLM', 'ChatGLMLLM', '智谱AI', 1, 1, '{\"type\": \"openai\", \"model_name\": \"glm-4-flash\", \"url\": \"https://open.bigmodel.cn/api/paas/v4/\", \"api_key\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_OllamaLLM', 'LLM', 'OllamaLLM', 'Ollama本地模型', 1, 0, '{\"type\": \"ollama\", \"model_name\": \"qwen2.5\", \"base_url\": \"http://localhost:11434\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_DifyLLM', 'LLM', 'DifyLLM', 'Dify', 1, 0, '{\"type\": \"dify\", \"base_url\": \"https://api.dify.ai/v1\", \"api_key\": \"\", \"mode\": \"chat-messages\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_GeminiLLM', 'LLM', 'GeminiLLM', '谷歌Gemini', 1, 0, '{\"type\": \"gemini\", \"api_key\": \"\", \"model_name\": \"gemini-2.0-flash\", \"http_proxy\": \"\", \"https_proxy\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_CozeLLM', 'LLM', 'CozeLLM', 'Coze', 1, 0, '{\"type\": \"coze\", \"bot_id\": \"\", \"user_id\": \"\", \"personal_access_token\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_LMStudioLLM', 'LLM', 'LMStudioLLM', 'LM Studio', 1, 0, '{\"type\": \"openai\", \"model_name\": \"deepseek-r1-distill-llama-8b@q4_k_m\", \"url\": \"http://localhost:1234/v1\", \"api_key\": \"lm-studio\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_FastgptLLM', 'LLM', 'FastgptLLM', 'FastGPT', 1, 0, '{\"type\": \"fastgpt\", \"base_url\": \"https://host/api/v1\", \"api_key\": \"fastgpt-xxx\", \"variables\": {\"k\": \"v\", \"k2\": \"v2\"}}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_XinferenceLLM', 'LLM', 'XinferenceLLM', 'Xinference大模型', 1, 0, '{\"type\": \"xinference\", \"model_name\": \"qwen2.5:72b-AWQ\", \"base_url\": \"http://localhost:9997\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('LLM_XinferenceSmallLLM', 'LLM', 'XinferenceSmallLLM', 'Xinference小模型', 1, 0, '{\"type\": \"xinference\", \"model_name\": \"qwen2.5:3b-AWQ\", \"base_url\": \"http://localhost:9997\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- TTS模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_EdgeTTS', 'TTS', 'EdgeTTS', 'Edge语音合成', 1, 1, '{\"type\": \"edge\", \"voice\": \"zh-CN-XiaoxiaoNeural\", \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_DoubaoTTS', 'TTS', 'DoubaoTTS', '豆包语音合成', 1, 0, '{\"type\": \"doubao\", \"api_url\": \"https://openspeech.bytedance.com/api/v1/tts\", \"voice\": \"BV001_streaming\", \"output_dir\": \"tmp/\", \"authorization\": \"Bearer;\", \"appid\": \"\", \"access_token\": \"\", \"cluster\": \"volcano_tts\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_CosyVoiceSiliconflow', 'TTS', 'CosyVoiceSiliconflow', '硅基流动语音合成', 1, 0, '{\"type\": \"siliconflow\", \"model\": \"FunAudioLLM/CosyVoice2-0.5B\", \"voice\": \"FunAudioLLM/CosyVoice2-0.5B:alex\", \"output_dir\": \"tmp/\", \"access_token\": \"\", \"response_format\": \"wav\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_CozeCnTTS', 'TTS', 'CozeCnTTS', 'Coze中文语音合成', 1, 0, '{\"type\": \"cozecn\", \"voice\": \"7426720361733046281\", \"output_dir\": \"tmp/\", \"access_token\": \"\", \"response_format\": \"wav\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_FishSpeech', 'TTS', 'FishSpeech', 'FishSpeech语音合成', 1, 0, '{\"type\": \"fishspeech\", \"output_dir\": \"tmp/\", \"response_format\": \"wav\", \"reference_id\": null, \"reference_audio\": [\"/tmp/test.wav\"], \"reference_text\": [\"你弄来这些吟词宴曲来看,还是这些混话来欺负我。\"], \"normalize\": true, \"max_new_tokens\": 1024, \"chunk_length\": 200, \"top_p\": 0.7, \"repetition_penalty\": 1.2, \"temperature\": 0.7, \"streaming\": false, \"use_memory_cache\": \"on\", \"seed\": null, \"channels\": 1, \"rate\": 44100, \"api_key\": \"\", \"api_url\": \"http://127.0.0.1:8080/v1/tts\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_GPT_SOVITS_V2', 'TTS', 'GPT_SOVITS_V2', 'GPT-SoVITS V2', 1, 0, '{\"type\": \"gpt_sovits_v2\", \"url\": \"http://127.0.0.1:9880/tts\", \"output_dir\": \"tmp/\", \"text_lang\": \"auto\", \"ref_audio_path\": \"caixukun.wav\", \"prompt_text\": \"\", \"prompt_lang\": \"zh\", \"top_k\": 5, \"top_p\": 1, \"temperature\": 1, \"text_split_method\": \"cut0\", \"batch_size\": 1, \"batch_threshold\": 0.75, \"split_bucket\": true, \"return_fragment\": false, \"speed_factor\": 1.0, \"streaming_mode\": false, \"seed\": -1, \"parallel_infer\": true, \"repetition_penalty\": 1.35, \"aux_ref_audio_paths\": []}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_GPT_SOVITS_V3', 'TTS', 'GPT_SOVITS_V3', 'GPT-SoVITS V3', 1, 0, '{\"type\": \"gpt_sovits_v3\", \"url\": \"http://127.0.0.1:9880\", \"output_dir\": \"tmp/\", \"text_language\": \"auto\", \"refer_wav_path\": \"caixukun.wav\", \"prompt_language\": \"zh\", \"prompt_text\": \"\", \"top_k\": 15, \"top_p\": 1.0, \"temperature\": 1.0, \"cut_punc\": \"\", \"speed\": 1.0, \"inp_refs\": [], \"sample_steps\": 32, \"if_sr\": false}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_MinimaxTTS', 'TTS', 'MinimaxTTS', 'MiniMax语音合成', 1, 0, '{\"type\": \"minimax\", \"output_dir\": \"tmp/\", \"group_id\": \"\", \"api_key\": \"\", \"model\": \"speech-01-turbo\", \"voice_id\": \"female-shaonv\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_AliyunTTS', 'TTS', 'AliyunTTS', '阿里云语音合成', 1, 0, '{\"type\": \"aliyun\", \"output_dir\": \"tmp/\", \"appkey\": \"\", \"token\": \"\", \"voice\": \"xiaoyun\", \"access_key_id\": \"\", \"access_key_secret\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_TTS302AI', 'TTS', 'TTS302AI', '302AI语音合成', 1, 0, '{\"type\": \"doubao\", \"api_url\": \"https://api.302ai.cn/doubao/tts_hd\", \"authorization\": \"Bearer \", \"voice\": \"zh_female_wanwanxiaohe_moon_bigtts\", \"output_dir\": \"tmp/\", \"access_token\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_GizwitsTTS', 'TTS', 'GizwitsTTS', '机智云语音合成', 1, 0, '{\"type\": \"doubao\", \"api_url\": \"https://bytedance.gizwitsapi.com/api/v1/tts\", \"authorization\": \"Bearer \", \"voice\": \"zh_female_wanwanxiaohe_moon_bigtts\", \"output_dir\": \"tmp/\", \"access_token\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_ACGNTTS', 'TTS', 'ACGNTTS', 'ACGN语音合成', 1, 0, '{\"type\": \"ttson\", \"token\": \"\", \"voice_id\": 1695, \"speed_factor\": 1, \"pitch_factor\": 0, \"volume_change_dB\": 0, \"to_lang\": \"ZH\", \"url\": \"https://u95167-bd74-2aef8085.westx.seetacloud.com:8443/flashsummary/tts?token=\", \"format\": \"mp3\", \"output_dir\": \"tmp/\", \"emotion\": 1}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_OpenAITTS', 'TTS', 'OpenAITTS', 'OpenAI语音合成', 1, 0, '{\"type\": \"openai\", \"api_key\": \"\", \"api_url\": \"https://api.openai.com/v1/audio/speech\", \"model\": \"tts-1\", \"voice\": \"onyx\", \"speed\": 1, \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('TTS_CustomTTS', 'TTS', 'CustomTTS', '自定义语音合成', 1, 0, '{\"type\": \"custom\", \"url\": \"http://127.0.0.1:9880/tts\", \"params\": {}, \"headers\": {}, \"format\": \"wav\", \"output_dir\": \"tmp/\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- Memory模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Memory_mem0ai', 'Memory', 'mem0ai', 'Mem0AI记忆', 1, 0, '{\"type\": \"mem0ai\", \"api_key\": \"\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Memory_nomem', 'Memory', 'nomem', '无记忆', 1, 1, '{\"type\": \"nomem\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Memory_mem_local_short', 'Memory', 'mem_local_short', '本地短期记忆', 1, 0, '{\"type\": \"mem_local_short\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- Intent模型配置
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Intent_nointent', 'Intent', 'nointent', '无意图识别', 1, 0, '{\"type\": \"nointent\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Intent_intent_llm', 'Intent', 'intent_llm', 'LLM意图识别', 1, 0, '{\"type\": \"intent_llm\", \"llm\": \"ChatGLMLLM\"}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Intent_function_call', 'Intent', 'function_call', '函数调用意图识别', 1, 1, '{\"type\": \"function_call\", \"functions\": [\"change_role\", \"get_weather\", \"get_news\", \"play_music\"]}', NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
-- 本文件用于初始化系统参数数据,无需手动执行,在项目启动时会自动执行
|
|
||||||
-- --------------------------------------------------------
|
|
||||||
-- 初始化参数管理配置
|
|
||||||
DROP TABLE IF EXISTS sys_params;
|
|
||||||
-- 参数管理
|
|
||||||
create table sys_params
|
|
||||||
(
|
|
||||||
id bigint NOT NULL COMMENT 'id',
|
|
||||||
param_code varchar(100) COMMENT '参数编码',
|
|
||||||
param_value varchar(2000) COMMENT '参数值',
|
|
||||||
value_type varchar(20) default 'string' COMMENT '值类型:string-字符串,number-数字,boolean-布尔,array-数组',
|
|
||||||
param_type tinyint unsigned default 1 COMMENT '类型 0:系统参数 1:非系统参数',
|
|
||||||
remark varchar(200) COMMENT '备注',
|
|
||||||
creator bigint COMMENT '创建者',
|
|
||||||
create_date datetime COMMENT '创建时间',
|
|
||||||
updater bigint COMMENT '更新者',
|
|
||||||
update_date datetime COMMENT '更新时间',
|
|
||||||
primary key (id),
|
|
||||||
unique key uk_param_code (param_code)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='参数管理';
|
|
||||||
|
|
||||||
-- 服务器配置
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (100, 'server.ip', '0.0.0.0', 'string', 1, '服务器监听IP地址');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (101, 'server.port', '8000', 'number', 1, '服务器监听端口');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (102, 'server.secret', 'null', 'string', 1, '服务器密钥');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (201, 'log.log_format', '<green>{time:YYMMDD HH:mm:ss}</green>[{version}_{selected_module}][<light-blue>{extra[tag]}</light-blue>]-<level>{level}</level>-<light-green>{message}</light-green>', 'string', 1, '控制台日志格式');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (202, 'log.log_format_file', '{time:YYYY-MM-DD HH:mm:ss} - {version}_{selected_module} - {name} - {level} - {extra[tag]} - {message}', 'string', 1, '文件日志格式');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (203, 'log.log_level', 'INFO', 'string', 1, '日志级别');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (204, 'log.log_dir', 'tmp', 'string', 1, '日志目录');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (205, 'log.log_file', 'server.log', 'string', 1, '日志文件名');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (206, 'log.data_dir', 'data', 'string', 1, '数据目录');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (301, 'delete_audio', 'true', 'boolean', 1, '是否删除使用后的音频文件');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (302, 'close_connection_no_voice_time', '120', 'number', 1, '无语音输入断开连接时间(秒)');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (303, 'tts_timeout', '10', 'number', 1, 'TTS请求超时时间(秒)');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (304, 'enable_wakeup_words_response_cache', 'true', 'boolean', 1, '是否开启唤醒词加速');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (305, 'enable_greeting', 'true', 'boolean', 1, '是否开启开场回复');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (306, 'enable_stop_tts_notify', 'false', 'boolean', 1, '是否开启结束提示音');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (307, 'stop_tts_notify_voice', 'config/assets/tts_notify.mp3', 'string', 1, '结束提示音文件路径');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (308, 'exit_commands', '退出;关闭', 'array', 1, '退出命令列表');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (309, 'xiaozhi', '{
|
|
||||||
"type": "hello",
|
|
||||||
"version": 1,
|
|
||||||
"transport": "websocket",
|
|
||||||
"audio_params": {
|
|
||||||
"format": "opus",
|
|
||||||
"sample_rate": 16000,
|
|
||||||
"channels": 1,
|
|
||||||
"frame_duration": 60
|
|
||||||
}
|
|
||||||
}', 'string', 1, '小智类型');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (310, 'wakeup_words', '你好小智;你好小志;小爱同学;你好小鑫;你好小新;小美同学;小龙小龙;喵喵同学;小滨小滨;小冰小冰', 'array', 1, '唤醒词列表,用于识别唤醒词');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (400, 'plugin.weather.api_key', 'a861d0d5e7bf4ee1a83d9a9e4f96d4da', 'string', 1, '天气插件API密钥');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (401, 'plugin.weather.default_location', '广州', 'string', 1, '天气插件默认城市');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (410, 'plugin.news.default_rss_url', 'https://www.chinanews.com.cn/rss/society.xml', 'string', 1, '新闻插件默认RSS地址');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (411, 'plugin.news.category_urls', '{"society":"https://www.chinanews.com.cn/rss/society.xml","world":"https://www.chinanews.com.cn/rss/world.xml","finance":"https://www.chinanews.com.cn/rss/finance.xml"}', 'string', 1, '新闻插件分类RSS地址');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (421, 'plugin.home_assistant.devices', '客厅,玩具灯,switch.cuco_cn_460494544_cp1_on_p_2_1;卧室,台灯,switch.iot_cn_831898993_socn1_on_p_2_1', 'array', 1, 'Home Assistant设备列表');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (422, 'plugin.home_assistant.base_url', 'http://homeassistant.local:8123', 'string', 1, 'Home Assistant服务器地址');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (423, 'plugin.home_assistant.api_key', '你的home assistant api访问令牌', 'string', 1, 'Home Assistant API密钥');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (430, 'plugin.music.music_dir', './music', 'string', 1, '音乐文件存放路径');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (431, 'plugin.music.music_ext', 'mp3;wav;p3', 'array', 1, '音乐文件类型');
|
|
||||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark) VALUES (432, 'plugin.music.refresh_time', '300', 'number', 1, '音乐列表刷新间隔(秒)');
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
-- 对0.3.0版本之前的参数进行修改
|
|
||||||
update `sys_params` set param_value = '.mp3;.wav;.p3' where param_code = 'plugins.play_music.music_ext';
|
|
||||||
update `ai_model_config` set config_json = '{\"type\": \"intent_llm\", \"llm\": \"LLM_ChatGLMLLM\"}' where id = 'Intent_intent_llm';
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
-- 本文件用于初始化模型模版数据,无需手动执行,在项目启动时会自动执行
|
-- 本文件用于初始化固件信息表,无需手动执行,在项目启动时会自动执行
|
||||||
-- -------------------------------------------------------
|
-- -------------------------------------------------------
|
||||||
-- 初始化智能体模板数据
|
-- 初始化固件信息表
|
||||||
|
drop table if exists `ai_ota`;
|
||||||
CREATE TABLE `ai_ota` (
|
CREATE TABLE `ai_ota` (
|
||||||
`id` varchar(32) NOT NULL COMMENT 'ID',
|
`id` varchar(32) NOT NULL COMMENT 'ID',
|
||||||
`firmware_name` varchar(100) DEFAULT NULL COMMENT '固件名称',
|
`firmware_name` varchar(100) DEFAULT NULL COMMENT '固件名称',
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
delete from `ai_model_config` where id = 'Intent_function_call';
|
|
||||||
INSERT INTO `ai_model_config` VALUES ('Intent_function_call', 'Intent', 'function_call', '函数调用意图识别', 0, 1, '{\"type\": \"function_call\", \"functions\": \"change_role;get_weather;get_news;play_music\"}', NULL, NULL, 3, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
-- 删除无用模型供应器
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_LLM_doubao';
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_LLM_chatglm';
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_TTS_302ai';
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_TTS_gizwits';
|
|
||||||
|
|
||||||
-- 添加模型供应器
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_ASR_TencentASR';
|
|
||||||
INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES
|
|
||||||
('SYSTEM_ASR_TencentASR', 'ASR', 'tencent', '腾讯语音识别', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 4, 1, NOW(), 1, NOW());
|
|
||||||
|
|
||||||
-- 添加腾讯语音合成模型供应器
|
|
||||||
delete from `ai_model_provider` where id = 'SYSTEM_TTS_TencentTTS';
|
|
||||||
INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES
|
|
||||||
('SYSTEM_TTS_TencentTTS', 'TTS', 'tencent', '腾讯语音合成', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"region","label":"区域","type":"string"},{"key":"voice","label":"音色ID","type":"string"}]', 5, 1, NOW(), 1, NOW());
|
|
||||||
|
|
||||||
-- 添加腾讯语音合成音色
|
|
||||||
delete from `ai_tts_voice` where id = 'TTS_TencentTTS0001';
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_TencentTTS0001', 'TTS_TencentTTS', '智瑜', '101001', '中文', NULL, NULL, 1, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
-- 删除无用模型供应器
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_LLM_doubao';
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_LLM_chatglm';
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_TTS_302ai';
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_TTS_gizwits';
|
||||||
|
|
||||||
|
-- 添加模型供应器
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_ASR_TencentASR';
|
||||||
|
INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES
|
||||||
|
('SYSTEM_ASR_TencentASR', 'ASR', 'tencent', '腾讯语音识别', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"}]', 4, 1, NOW(), 1, NOW());
|
||||||
|
|
||||||
|
-- 添加腾讯语音合成模型供应器
|
||||||
|
delete from `ai_model_provider` where id = 'SYSTEM_TTS_TencentTTS';
|
||||||
|
INSERT INTO `ai_model_provider` (`id`, `model_type`, `provider_code`, `name`, `fields`, `sort`, `creator`, `create_date`, `updater`, `update_date`) VALUES
|
||||||
|
('SYSTEM_TTS_TencentTTS', 'TTS', 'tencent', '腾讯语音合成', '[{"key":"appid","label":"应用ID","type":"string"},{"key":"secret_id","label":"Secret ID","type":"string"},{"key":"secret_key","label":"Secret Key","type":"string"},{"key":"output_dir","label":"输出目录","type":"string"},{"key":"region","label":"区域","type":"string"},{"key":"voice","label":"音色ID","type":"string"}]', 5, 1, NOW(), 1, NOW());
|
||||||
|
|
||||||
|
|
||||||
|
-- 添加edge音色
|
||||||
|
delete from `ai_tts_voice` where id in ('TTS_EdgeTTS0001', 'TTS_EdgeTTS0002', 'TTS_EdgeTTS0003', 'TTS_EdgeTTS0004', 'TTS_EdgeTTS0005', 'TTS_EdgeTTS0006', 'TTS_EdgeTTS0007', 'TTS_EdgeTTS0008', 'TTS_EdgeTTS0009', 'TTS_EdgeTTS0010', 'TTS_EdgeTTS0011');
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES
|
||||||
|
('TTS_EdgeTTS0001', 'TTS_EdgeTTS', 'EdgeTTS女声-晓晓', 'zh-CN-XiaoxiaoNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0002', 'TTS_EdgeTTS', 'EdgeTTS男声-云扬', 'zh-CN-YunyangNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0003', 'TTS_EdgeTTS', 'EdgeTTS女声-晓伊', 'zh-CN-XiaoyiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0004', 'TTS_EdgeTTS', 'EdgeTTS男声-云健', 'zh-CN-YunjianNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0005', 'TTS_EdgeTTS', 'EdgeTTS男声-云希', 'zh-CN-YunxiNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0006', 'TTS_EdgeTTS', 'EdgeTTS男声-云夏', 'zh-CN-YunxiaNeural', '普通话', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0007', 'TTS_EdgeTTS', 'EdgeTTS女声-辽宁小贝', 'zh-CN-liaoning-XiaobeiNeural', '辽宁', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0008', 'TTS_EdgeTTS', 'EdgeTTS女声-陕西小妮', 'zh-CN-shaanxi-XiaoniNeural', '陕西', NULL, NULL, 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0009', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海佳', 'zh-HK-HiuGaaiNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0010', 'TTS_EdgeTTS', 'EdgeTTS女声-香港海曼', 'zh-HK-HiuMaanNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL),
|
||||||
|
('TTS_EdgeTTS0011', 'TTS_EdgeTTS', 'EdgeTTS男声-香港万龙', 'zh-HK-WanLungNeural', '粤语', 'General', 'Friendly, Positive', 1, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- DoubaoTTS音色
|
||||||
|
delete from `ai_tts_voice` where id in ('TTS_DoubaoTTS0001', 'TTS_DoubaoTTS0002', 'TTS_DoubaoTTS0003', 'TTS_DoubaoTTS0004', 'TTS_DoubaoTTS0005');
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0001', 'TTS_DoubaoTTS', '通用女声', 'BV001_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV001.mp3', NULL, 3, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0002', 'TTS_DoubaoTTS', '通用男声', 'BV002_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV002.mp3', NULL, 2, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0003', 'TTS_DoubaoTTS', '阳光男生', 'BV056_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV056.mp3', NULL, 4, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0004', 'TTS_DoubaoTTS', '奶气萌娃', 'BV051_streaming', '普通话', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV051.mp3', NULL, 5, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0005', 'TTS_DoubaoTTS', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '普通话', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 6, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- 修正CosyVoiceSiliconflow音色
|
||||||
|
delete from `ai_tts_voice` where id in ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow0002');
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow', 'CosyVoice男声', 'FunAudioLLM/CosyVoice2-0.5B:alex', '中文', NULL, NULL, 6, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0002', 'TTS_CosyVoiceSiliconflow', 'CosyVoice女声', 'FunAudioLLM/CosyVoice2-0.5B:bella', '中文', NULL, NULL, 6, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- CozeCnTTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_CozeCnTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_CozeCnTTS0001', 'TTS_CozeCnTTS', 'CozeCn音色', '7426720361733046281', '中文', NULL, NULL, 7, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- MinimaxTTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_MinimaxTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_MinimaxTTS0001', 'TTS_MinimaxTTS', 'Minimax少女音', 'female-shaonv', '中文', NULL, NULL, 8, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- AliyunTTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_AliyunTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_AliyunTTS0001', 'TTS_AliyunTTS', '阿里云小云', 'xiaoyun', '中文', NULL, NULL, 9, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- TTS302AI音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_TTS302AI0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_TTS302AI0001', 'TTS_TTS302AI', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 10, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- GizwitsTTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_GizwitsTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_GizwitsTTS0001', 'TTS_GizwitsTTS', '机智云湾湾', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/%E6%B9%BE%E6%B9%BE%E5%B0%8F%E4%BD%95.mp3', NULL, 11, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- ACGNTTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_ACGNTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_ACGNTTS0001', 'TTS_ACGNTTS', 'ACG音色', '1695', '中文', NULL, NULL, 12, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- OpenAITTS音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_OpenAITTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_OpenAITTS0001', 'TTS_OpenAITTS', 'OpenAI男声', 'onyx', '中文', NULL, NULL, 13, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- 添加腾讯语音合成音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_TencentTTS0001';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_TencentTTS0001', 'TTS_TencentTTS', '智瑜', '101001', '中文', NULL, NULL, 1, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
-- 其他音色
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_FishSpeech0000';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_FishSpeech0000', 'TTS_FishSpeech', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
delete from `ai_tts_voice` where id = 'TTS_GPT_SOVITS_V20000';
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V20000', 'TTS_GPT_SOVITS_V2', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
delete from `ai_tts_voice` where id in ('TTS_GPT_SOVITS_V30000', 'TTS_CustomTTS0000');
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V30000', 'TTS_GPT_SOVITS_V3', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
||||||
|
INSERT INTO `ai_tts_voice` VALUES ('TTS_CustomTTS0000', 'TTS_CustomTTS', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
-- 本文件用于初始化音色数据,无需手动执行,在项目启动时会自动执行
|
|
||||||
-- ----------------------------------------------------
|
|
||||||
|
|
||||||
-- 初始化音色数据
|
|
||||||
DELETE FROM `ai_tts_voice`;
|
|
||||||
|
|
||||||
-- EdgeTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_EdgeTTS0001', 'TTS_EdgeTTS', 'EdgeTTS女声', 'zh-CN-XiaoxiaoNeural', '中文', 'https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_hz_ihsph/ljhwZthlaukjlkulzlp/portal/bigtts/EdgeTTS.mp3', NULL, 1, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- DoubaoTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0001', 'TTS_DoubaoTTS', '通用女声', 'BV001_streaming', '中文', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV001.mp3', NULL, 3, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0002', 'TTS_DoubaoTTS', '通用男声', 'BV002_streaming', '中文', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV002.mp3', NULL, 2, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0003', 'TTS_DoubaoTTS', '阳光男生', 'BV056_streaming', '中文', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV056.mp3', NULL, 4, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_DoubaoTTS0004', 'TTS_DoubaoTTS', '奶气萌娃', 'BV051_streaming', '中文', 'https://lf3-speech.bytetos.com/obj/speech-tts-external/portal/Portal_Demo_BV051.mp3', NULL, 5, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- CosyVoiceSiliconflow音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_CosyVoiceSiliconflow0001', 'TTS_CosyVoiceSiliconflow', 'CosyVoice男声', 'alex', '中文', 'https://example.com/cosyvoice/alex.mp3', NULL, 6, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- CozeCnTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_CozeCnTTS0001', 'TTS_CozeCnTTS', 'CozeCn音色', '7426720361733046281', '中文', 'https://example.com/cozecn/voice.mp3', NULL, 7, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- MinimaxTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_MinimaxTTS0001', 'TTS_MinimaxTTS', 'Minimax少女音', 'female-shaonv', '中文', 'https://example.com/minimax/female-shaonv.mp3', NULL, 8, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- AliyunTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_AliyunTTS0001', 'TTS_AliyunTTS', '阿里云小云', 'xiaoyun', '中文', 'https://example.com/aliyun/xiaoyun.mp3', NULL, 9, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- TTS302AI音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_TTS302AI0001', 'TTS_TTS302AI', '湾湾小何', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://example.com/302ai/wanwanxiaohe.mp3', NULL, 10, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- GizwitsTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_GizwitsTTS0001', 'TTS_GizwitsTTS', '机智云湾湾', 'zh_female_wanwanxiaohe_moon_bigtts', '中文', 'https://example.com/gizwits/wanwanxiaohe.mp3', NULL, 11, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- ACGNTTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_ACGNTTS0001', 'TTS_ACGNTTS', 'ACG音色', '1695', '中文', 'https://example.com/acgn/voice.mp3', NULL, 12, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- OpenAITTS音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_OpenAITTS0001', 'TTS_OpenAITTS', 'OpenAI男声', 'onyx', '中文', 'https://example.com/openai/onyx.mp3', NULL, 13, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
-- 其他音色
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_FishSpeech0000', 'TTS_FishSpeech', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V20000', 'TTS_GPT_SOVITS_V2', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_GPT_SOVITS_V30000', 'TTS_GPT_SOVITS_V3', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
|
||||||
INSERT INTO `ai_tts_voice` VALUES ('TTS_CustomTTS0000', 'TTS_CustomTTS', '', '', '中文', '', NULL, 8, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
@ -16,13 +16,6 @@ databaseChangeLog:
|
||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202503141346.sql
|
path: classpath:db/changelog/202503141346.sql
|
||||||
- changeSet:
|
|
||||||
id: 2025_tts_voive
|
|
||||||
author: John
|
|
||||||
changes:
|
|
||||||
- sqlFile:
|
|
||||||
encoding: utf8
|
|
||||||
path: classpath:db/changelog/2025_tts_voive.sql
|
|
||||||
- changeSet:
|
- changeSet:
|
||||||
id: 202504082211
|
id: 202504082211
|
||||||
author: John
|
author: John
|
||||||
|
|
@ -66,9 +59,16 @@ databaseChangeLog:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202504181536.sql
|
path: classpath:db/changelog/202504181536.sql
|
||||||
- changeSet:
|
- changeSet:
|
||||||
id: 202504211118
|
id: 202504180758
|
||||||
|
author: jiangkunyin
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202504180758.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202504221135
|
||||||
author: John
|
author: John
|
||||||
changes:
|
changes:
|
||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202504211118.sql
|
path: classpath:db/changelog/202504221135.sql
|
||||||
|
|
@ -28,10 +28,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
|
||||||
timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.remark.require=\u97F3\u8272\u7684\u5907\u6CE8\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
|
||||||
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653EDemo\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
|
||||||
|
|
||||||
ota.device.not.found=\u8BBE\u5907\u672A\u627E\u5230
|
ota.device.not.found=\u8BBE\u5907\u672A\u627E\u5230
|
||||||
ota.device.need.bind={0}
|
ota.device.need.bind={0}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,8 @@ sysuser.uuid.require=The unique identifier cannot be empty
|
||||||
|
|
||||||
timbre.languages.require=The language of the timbre cannot be empty
|
timbre.languages.require=The language of the timbre cannot be empty
|
||||||
timbre.name.require=The name of the timbre cannot be empty
|
timbre.name.require=The name of the timbre cannot be empty
|
||||||
timbre.remark.require=The remark of the timbre cannot be empty
|
|
||||||
timbre.ttsModelId.require=The TTS model ID of the timbre cannot be empty
|
timbre.ttsModelId.require=The TTS model ID of the timbre cannot be empty
|
||||||
timbre.ttsVoice.require=The TTS voice of the timbre cannot be empty
|
timbre.ttsVoice.require=The TTS voice of the timbre cannot be empty
|
||||||
timbre.voiceDemo.require=The voice demo of the timbre cannot be empty
|
|
||||||
|
|
||||||
ota.device.not.found=Device not found
|
ota.device.not.found=Device not found
|
||||||
ota.device.need.bind={0}
|
ota.device.need.bind={0}
|
||||||
|
|
@ -27,10 +27,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
|
||||||
timbre.languages.require=\u97F3\u8272\u7684\u8A9E\u8A00\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
timbre.languages.require=\u97F3\u8272\u7684\u8A9E\u8A00\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
||||||
timbre.name.require=\u97F3\u8272\u7684\u540D\u7A31\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
timbre.name.require=\u97F3\u8272\u7684\u540D\u7A31\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
||||||
timbre.remark.require=\u97F3\u8272\u7684\u5099\u6CE8\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
|
||||||
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u9375\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u9375\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
||||||
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7DE8\u78BC\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7DE8\u78BC\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
||||||
timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653E\u5730\u5740\u4E0D\u53EF\u4EE5\u70BA\u7A7A
|
|
||||||
|
|
||||||
ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230
|
ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230
|
||||||
ota.device.need.bind={0}
|
ota.device.need.bind={0}
|
||||||
|
|
@ -27,10 +27,8 @@ sysuser.uuid.require=\u552F\u4E00\u6807\u8BC6\u4E0D\u80FD\u4E3A\u7A7A
|
||||||
|
|
||||||
timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.languages.require=\u97F3\u8272\u7684\u8BED\u8A00\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.name.require=\u97F3\u8272\u7684\u540D\u79F0\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.remark.require=\u97F3\u8272\u7684\u5907\u6CE8\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
|
||||||
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.ttsModelId.require=\u97F3\u8272\u7684tts\u4E3B\u952E\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
timbre.ttsVoice.require=\u97F3\u8272\u7684\u7F16\u7801\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
||||||
timbre.voiceDemo.require=\u97F3\u8272\u7684\u64AD\u653EDemo\u4E0D\u53EF\u4EE5\u4E3A\u7A7A
|
|
||||||
|
|
||||||
ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230
|
ota.device.not.found=\u8A2D\u5099\u672A\u627E\u5230
|
||||||
ota.device.need.bind={0}
|
ota.device.need.bind={0}
|
||||||
1
main/manager-web/public/encoderWorker.min.js
vendored
1
main/manager-web/public/encoderWorker.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,7 @@ export default {
|
||||||
// 分页查询OTA固件信息
|
// 分页查询OTA固件信息
|
||||||
getOtaList(params, callback) {
|
getOtaList(params, callback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota/otas`)
|
.url(`${getServiceUrl()}/otaMag`)
|
||||||
.method('GET')
|
.method('GET')
|
||||||
.data(params)
|
.data(params)
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
|
|
@ -22,7 +22,7 @@ export default {
|
||||||
// 获取单个OTA固件信息
|
// 获取单个OTA固件信息
|
||||||
getOtaInfo(id, callback) {
|
getOtaInfo(id, callback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota/${id}`)
|
.url(`${getServiceUrl()}/otaMag/${id}`)
|
||||||
.method('GET')
|
.method('GET')
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
RequestService.clearRequestTime();
|
RequestService.clearRequestTime();
|
||||||
|
|
@ -38,7 +38,7 @@ export default {
|
||||||
// 保存OTA固件信息
|
// 保存OTA固件信息
|
||||||
saveOta(entity, callback) {
|
saveOta(entity, callback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota`)
|
.url(`${getServiceUrl()}/otaMag`)
|
||||||
.method('POST')
|
.method('POST')
|
||||||
.data(entity)
|
.data(entity)
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
|
|
@ -55,7 +55,7 @@ export default {
|
||||||
// 更新OTA固件信息
|
// 更新OTA固件信息
|
||||||
updateOta(id, entity, callback) {
|
updateOta(id, entity, callback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota/${id}`)
|
.url(`${getServiceUrl()}/otaMag/${id}`)
|
||||||
.method('PUT')
|
.method('PUT')
|
||||||
.data(entity)
|
.data(entity)
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
|
|
@ -72,7 +72,7 @@ export default {
|
||||||
// 删除OTA固件
|
// 删除OTA固件
|
||||||
deleteOta(id, callback) {
|
deleteOta(id, callback) {
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota/${id}`)
|
.url(`${getServiceUrl()}/otaMag/${id}`)
|
||||||
.method('DELETE')
|
.method('DELETE')
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
RequestService.clearRequestTime();
|
RequestService.clearRequestTime();
|
||||||
|
|
@ -90,7 +90,7 @@ export default {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
RequestService.sendRequest()
|
RequestService.sendRequest()
|
||||||
.url(`${getServiceUrl()}/ota/upload`)
|
.url(`${getServiceUrl()}/otaMag/upload`)
|
||||||
.method('POST')
|
.method('POST')
|
||||||
.data(formData)
|
.data(formData)
|
||||||
.success((res) => {
|
.success((res) => {
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,21 @@
|
||||||
<el-dialog :title="title" :visible.sync="visible" width="500px" @close="handleClose">
|
<el-dialog :title="title" :visible.sync="visible" width="500px" @close="handleClose">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-form-item label="固件名称" prop="firmwareName">
|
<el-form-item label="固件名称" prop="firmwareName">
|
||||||
<el-input v-model="form.firmwareName" placeholder="请输入固件名称"></el-input>
|
<el-input v-model="form.firmwareName" placeholder="请输入固件名称(板子+版本号)"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="固件类型" prop="type">
|
<el-form-item label="固件类型" prop="type">
|
||||||
<el-input v-model="form.type" placeholder="请输入固件类型"></el-input>
|
<el-select v-model="form.type" placeholder="请选择固件类型" style="width: 100%;" filterable>
|
||||||
|
<el-option v-for="item in firmwareTypes" :key="item.key" :label="item.name" :value="item.key"></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="版本号" prop="version">
|
<el-form-item label="版本号" prop="version">
|
||||||
<el-input v-model="form.version" placeholder="请输入版本号"></el-input>
|
<el-input v-model="form.version" placeholder="请输入版本号(x.x.x格式)"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="固件文件" prop="firmwarePath">
|
<el-form-item label="固件文件" prop="firmwarePath">
|
||||||
<el-upload
|
<el-upload class="upload-demo" action="#" :http-request="handleUpload" :before-upload="beforeUpload"
|
||||||
class="upload-demo"
|
:accept="'.bin,.apk'" :limit="1" :multiple="false" :auto-upload="true">
|
||||||
action="#"
|
|
||||||
:http-request="handleUpload"
|
|
||||||
:before-upload="beforeUpload"
|
|
||||||
:accept="'.bin,.hex,.elf'"
|
|
||||||
:limit="1"
|
|
||||||
:multiple="false"
|
|
||||||
:auto-upload="true">
|
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
<div slot="tip" class="el-upload__tip">只能上传固件文件(.bin/.hex/.elf),且不超过100MB</div>
|
<div slot="tip" class="el-upload__tip">只能上传固件文件(.bin/.apk),且不超过100MB</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
|
|
@ -36,7 +31,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Api from '@/apis/api'
|
import Api from '@/apis/api';
|
||||||
|
import { FIRMWARE_TYPES } from '@/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FirmwareDialog',
|
name: 'FirmwareDialog',
|
||||||
|
|
@ -56,15 +52,17 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
firmwareTypes: FIRMWARE_TYPES,
|
||||||
rules: {
|
rules: {
|
||||||
firmwareName: [
|
firmwareName: [
|
||||||
{ required: true, message: '请输入固件名称', trigger: 'blur' }
|
{ required: true, message: '请输入固件名称(板子+版本号)', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
type: [
|
type: [
|
||||||
{ required: true, message: '请输入固件类型', trigger: 'blur' }
|
{ required: true, message: '请选择固件类型', trigger: 'change' }
|
||||||
],
|
],
|
||||||
version: [
|
version: [
|
||||||
{ required: true, message: '请输入版本号', trigger: 'blur' }
|
{ required: true, message: '请输入版本号', trigger: 'blur' },
|
||||||
|
{ pattern: /^\d+\.\d+\.\d+$/, message: '版本号格式不正确,请输入x.x.x格式', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
firmwarePath: [
|
firmwarePath: [
|
||||||
{ required: false, message: '请上传固件文件', trigger: 'change' }
|
{ required: false, message: '请上传固件文件', trigger: 'change' }
|
||||||
|
|
@ -96,10 +94,10 @@ export default {
|
||||||
},
|
},
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
const isValidSize = file.size / 1024 / 1024 < 100
|
const isValidSize = file.size / 1024 / 1024 < 100
|
||||||
const isValidType = ['.bin', '.hex', '.elf'].some(ext => file.name.toLowerCase().endsWith(ext))
|
const isValidType = ['.bin', '.apk'].some(ext => file.name.toLowerCase().endsWith(ext))
|
||||||
|
|
||||||
if (!isValidType) {
|
if (!isValidType) {
|
||||||
this.$message.error('只能上传.bin/.hex/.elf格式的固件文件!')
|
this.$message.error('只能上传.bin/.apk格式的固件文件!')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (!isValidSize) {
|
if (!isValidSize) {
|
||||||
|
|
@ -129,6 +127,7 @@ export default {
|
||||||
.upload-demo {
|
.upload-demo {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-upload__tip {
|
.el-upload__tip {
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,12 @@
|
||||||
:style="{ filter: $route.path === '/params-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
:style="{ filter: $route.path === '/params-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||||
参数管理
|
参数管理
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="isSuperAdmin" class="equipment-management"
|
||||||
|
:class="{ 'active-tab': $route.path === '/ota-management' }" @click="goOtaManagement">
|
||||||
|
<img loading="lazy" alt="" src="@/assets/header/firmware_update.png"
|
||||||
|
:style="{ filter: $route.path === '/ota-management' ? 'brightness(0) invert(1)' : 'None' }" />
|
||||||
|
OTA管理
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 右侧元素 -->
|
<!-- 右侧元素 -->
|
||||||
|
|
@ -105,6 +111,9 @@ export default {
|
||||||
goParamManagement() {
|
goParamManagement() {
|
||||||
this.$router.push('/params-management')
|
this.$router.push('/params-management')
|
||||||
},
|
},
|
||||||
|
goOtaManagement() {
|
||||||
|
this.$router.push('/ota-management')
|
||||||
|
},
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
fetchUserInfo() {
|
fetchUserInfo() {
|
||||||
userApi.getUserInfo(({ data }) => {
|
userApi.getUserInfo(({ data }) => {
|
||||||
|
|
|
||||||
|
|
@ -62,13 +62,6 @@ const routes = [
|
||||||
return import('../views/ModelConfig.vue')
|
return import('../views/ModelConfig.vue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/test',
|
|
||||||
name: 'TestServer',
|
|
||||||
component: function () {
|
|
||||||
return import('../views/test.vue')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/params-management',
|
path: '/params-management',
|
||||||
name: 'ParamsManagement',
|
name: 'ParamsManagement',
|
||||||
|
|
|
||||||
|
|
@ -136,3 +136,63 @@ export function getUUID() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 固件类型选项
|
||||||
|
*/
|
||||||
|
export const FIRMWARE_TYPES = [
|
||||||
|
{ "key": "bread-compact-wifi", "name": "面包板新版接线(WiFi)" },
|
||||||
|
{ "key": "bread-compact-wifi-lcd", "name": "面包板新版接线(WiFi)+ LCD" },
|
||||||
|
{ "key": "bread-compact-ml307", "name": "面包板新版接线(ML307 AT)" },
|
||||||
|
{ "key": "bread-compact-esp32", "name": "面包板(WiFi) ESP32 DevKit" },
|
||||||
|
{ "key": "bread-compact-esp32-lcd", "name": "面包板(WiFi+ LCD) ESP32 DevKit" },
|
||||||
|
{ "key": "df-k10", "name": "DFRobot 行空板 k10" },
|
||||||
|
{ "key": "esp32-cgc", "name": "ESP32 CGC" },
|
||||||
|
{ "key": "esp-box-3", "name": "ESP BOX 3" },
|
||||||
|
{ "key": "esp-box", "name": "ESP BOX" },
|
||||||
|
{ "key": "esp-box-lite", "name": "ESP BOX Lite" },
|
||||||
|
{ "key": "kevin-box-1", "name": "Kevin Box 1" },
|
||||||
|
{ "key": "kevin-box-2", "name": "Kevin Box 2" },
|
||||||
|
{ "key": "kevin-c3", "name": "Kevin C3" },
|
||||||
|
{ "key": "kevin-sp-v3-dev", "name": "Kevin SP V3开发板" },
|
||||||
|
{ "key": "kevin-sp-v4-dev", "name": "Kevin SP V4开发板" },
|
||||||
|
{ "key": "kevin-yuying-313lcd", "name": "鱼鹰科技3.13LCD开发板" },
|
||||||
|
{ "key": "lichuang-dev", "name": "立创·实战派ESP32-S3开发板" },
|
||||||
|
{ "key": "lichuang-c3-dev", "name": "立创·实战派ESP32-C3开发板" },
|
||||||
|
{ "key": "magiclick-2p4", "name": "神奇按钮 Magiclick_2.4" },
|
||||||
|
{ "key": "magiclick-2p5", "name": "神奇按钮 Magiclick_2.5" },
|
||||||
|
{ "key": "magiclick-c3", "name": "神奇按钮 Magiclick_C3" },
|
||||||
|
{ "key": "magiclick-c3-v2", "name": "神奇按钮 Magiclick_C3_v2" },
|
||||||
|
{ "key": "m5stack-core-s3", "name": "M5Stack CoreS3" },
|
||||||
|
{ "key": "atoms3-echo-base", "name": "AtomS3 + Echo Base" },
|
||||||
|
{ "key": "atoms3r-echo-base", "name": "AtomS3R + Echo Base" },
|
||||||
|
{ "key": "atoms3r-cam-m12-echo-base", "name": "AtomS3R CAM/M12 + Echo Base" },
|
||||||
|
{ "key": "atommatrix-echo-base", "name": "AtomMatrix + Echo Base" },
|
||||||
|
{ "key": "xmini-c3", "name": "虾哥 Mini C3" },
|
||||||
|
{ "key": "esp32s3-korvo2-v3", "name": "ESP32S3_KORVO2_V3开发板" },
|
||||||
|
{ "key": "esp-sparkbot", "name": "ESP-SparkBot开发板" },
|
||||||
|
{ "key": "esp-spot-s3", "name": "ESP-Spot-S3" },
|
||||||
|
{ "key": "esp32-s3-touch-amoled-1.8", "name": "Waveshare ESP32-S3-Touch-AMOLED-1.8" },
|
||||||
|
{ "key": "esp32-s3-touch-lcd-1.85c", "name": "Waveshare ESP32-S3-Touch-LCD-1.85C" },
|
||||||
|
{ "key": "esp32-s3-touch-lcd-1.85", "name": "Waveshare ESP32-S3-Touch-LCD-1.85" },
|
||||||
|
{ "key": "esp32-s3-touch-lcd-1.46", "name": "Waveshare ESP32-S3-Touch-LCD-1.46" },
|
||||||
|
{ "key": "esp32-s3-touch-lcd-3.5", "name": "Waveshare ESP32-S3-Touch-LCD-3.5" },
|
||||||
|
{ "key": "tudouzi", "name": "土豆子" },
|
||||||
|
{ "key": "lilygo-t-circle-s3", "name": "LILYGO T-Circle-S3" },
|
||||||
|
{ "key": "lilygo-t-cameraplus-s3", "name": "LILYGO T-CameraPlus-S3" },
|
||||||
|
{ "key": "movecall-moji-esp32s3", "name": "Movecall Moji 小智AI衍生版" },
|
||||||
|
{ "key": "movecall-cuican-esp32s3", "name": "Movecall CuiCan 璀璨·AI吊坠" },
|
||||||
|
{ "key": "atk-dnesp32s3", "name": "正点原子DNESP32S3开发板" },
|
||||||
|
{ "key": "atk-dnesp32s3-box", "name": "正点原子DNESP32S3-BOX" },
|
||||||
|
{ "key": "du-chatx", "name": "嘟嘟开发板CHATX(wifi)" },
|
||||||
|
{ "key": "taiji-pi-s3", "name": "太极小派esp32s3" },
|
||||||
|
{ "key": "xingzhi-cube-0.85tft-wifi", "name": "无名科技星智0.85(WIFI)" },
|
||||||
|
{ "key": "xingzhi-cube-0.85tft-ml307", "name": "无名科技星智0.85(ML307)" },
|
||||||
|
{ "key": "xingzhi-cube-0.96oled-wifi", "name": "无名科技星智0.96(WIFI)" },
|
||||||
|
{ "key": "xingzhi-cube-0.96oled-ml307", "name": "无名科技星智0.96(ML307)" },
|
||||||
|
{ "key": "xingzhi-cube-1.54tft-wifi", "name": "无名科技星智1.54(WIFI)" },
|
||||||
|
{ "key": "xingzhi-cube-1.54tft-ml307", "name": "无名科技星智1.54(ML307)" },
|
||||||
|
{ "key": "sensecap-watcher", "name": "SenseCAP Watcher" },
|
||||||
|
{ "key": "doit-s3-aibox", "name": "四博智联AI陪伴盒子" },
|
||||||
|
{ "key": "mixgo-nova", "name": "元控·青春" }
|
||||||
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
<div class="operation-bar">
|
<div class="operation-bar">
|
||||||
<h2 class="page-title">设备管理</h2>
|
<h2 class="page-title">设备管理</h2>
|
||||||
<div class="right-operations">
|
<div class="right-operations">
|
||||||
<el-input placeholder="请输入设备型号或Mac地址查询" v-model="searchKeyword"
|
<el-input placeholder="请输入设备型号或Mac地址查询" v-model="searchKeyword" class="search-input"
|
||||||
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">搜索</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -15,19 +15,17 @@
|
||||||
<div class="content-panel">
|
<div class="content-panel">
|
||||||
<div class="content-area">
|
<div class="content-area">
|
||||||
<el-card class="device-card" shadow="never">
|
<el-card class="device-card" shadow="never">
|
||||||
<el-table
|
<el-table ref="deviceTable" :data="paginatedDeviceList" @selection-change="handleSelectionChange"
|
||||||
ref="deviceTable"
|
class="transparent-table" :header-cell-class-name="headerCellClassName" v-loading="loading"
|
||||||
:data="paginatedDeviceList"
|
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading"
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
class="transparent-table"
|
|
||||||
:header-cell-class-name="headerCellClassName"
|
|
||||||
v-loading="loading"
|
|
||||||
element-loading-text="拼命加载中"
|
|
||||||
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 type="selection" align="center" width="120"></el-table-column>
|
<el-table-column type="selection" align="center" width="120"></el-table-column>
|
||||||
<el-table-column label="设备型号" prop="model" align="center"></el-table-column>
|
<el-table-column label="设备型号" prop="model" align="center">
|
||||||
<el-table-column label="固件版本" prop="firmwareVersion" align="center" ></el-table-column>
|
<template slot-scope="scope">
|
||||||
|
{{ getFirmwareTypeName(scope.row.model) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="固件版本" prop="firmwareVersion" align="center"></el-table-column>
|
||||||
<el-table-column label="Mac地址" prop="macAddress" align="center"></el-table-column>
|
<el-table-column label="Mac地址" prop="macAddress" align="center"></el-table-column>
|
||||||
<el-table-column label="绑定时间" prop="bindTime" align="center"></el-table-column>
|
<el-table-column label="绑定时间" prop="bindTime" align="center"></el-table-column>
|
||||||
<el-table-column label="最近对话" prop="lastConversation" align="center"></el-table-column>
|
<el-table-column label="最近对话" prop="lastConversation" align="center"></el-table-column>
|
||||||
|
|
@ -36,7 +34,8 @@
|
||||||
<el-input v-if="scope.row.isEdit" v-model="scope.row.remark" size="mini"
|
<el-input v-if="scope.row.isEdit" v-model="scope.row.remark" size="mini"
|
||||||
@blur="stopEditRemark(scope.$index)"></el-input>
|
@blur="stopEditRemark(scope.$index)"></el-input>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<i v-if="!scope.row.remark" class="el-icon-edit" @click="startEditRemark(scope.$index, scope.row)"></i>
|
<i v-if="!scope.row.remark" class="el-icon-edit"
|
||||||
|
@click="startEditRemark(scope.$index, scope.row)"></i>
|
||||||
<span v-else @click="startEditRemark(scope.$index, scope.row)">
|
<span v-else @click="startEditRemark(scope.$index, scope.row)">
|
||||||
{{ scope.row.remark }}
|
{{ scope.row.remark }}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -66,26 +65,17 @@
|
||||||
<el-button type="success" size="mini" class="add-device-btn" @click="handleAddDevice">
|
<el-button type="success" size="mini" class="add-device-btn" @click="handleAddDevice">
|
||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete"
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteSelected">解绑</el-button>
|
||||||
@click="deleteSelected">解绑</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
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`" :value="item">
|
||||||
v-for="item in pageSizeOptions"
|
</el-option>
|
||||||
:key="item"
|
|
||||||
:label="`${item}条/页`"
|
|
||||||
:value="item">
|
|
||||||
</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">首页</button>
|
||||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">上一页</button>
|
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">上一页</button>
|
||||||
<button
|
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||||
v-for="page in visiblePages"
|
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||||
:key="page"
|
|
||||||
class="pagination-btn"
|
|
||||||
: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">下一页</button>
|
||||||
|
|
@ -107,6 +97,7 @@
|
||||||
import Api from '@/apis/api';
|
import Api from '@/apis/api';
|
||||||
import AddDeviceDialog from "@/components/AddDeviceDialog.vue";
|
import AddDeviceDialog from "@/components/AddDeviceDialog.vue";
|
||||||
import HeaderBar from "@/components/HeaderBar.vue";
|
import HeaderBar from "@/components/HeaderBar.vue";
|
||||||
|
import { FIRMWARE_TYPES } from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HeaderBar, AddDeviceDialog },
|
components: { HeaderBar, AddDeviceDialog },
|
||||||
|
|
@ -305,7 +296,7 @@ export default {
|
||||||
rawBindTime: new Date(device.createDate).getTime()
|
rawBindTime: new Date(device.createDate).getTime()
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.sort((a, b) => a.rawBindTime - b.rawBindTime);
|
.sort((a, b) => a.rawBindTime - b.rawBindTime);
|
||||||
this.activeSearchKeyword = "";
|
this.activeSearchKeyword = "";
|
||||||
this.searchKeyword = "";
|
this.searchKeyword = "";
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -313,12 +304,16 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
headerCellClassName({columnIndex}) {
|
headerCellClassName({ columnIndex }) {
|
||||||
if (columnIndex === 0) {
|
if (columnIndex === 0) {
|
||||||
return "custom-selection-header";
|
return "custom-selection-header";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
},
|
||||||
|
getFirmwareTypeName(type) {
|
||||||
|
const firmwareType = FIRMWARE_TYPES.find(item => item.key === type);
|
||||||
|
return firmwareType ? firmwareType.name : type;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -387,12 +382,12 @@ export default {
|
||||||
transition: border-color 0.2s;
|
transition: border-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .page-size-select{
|
::v-deep .page-size-select {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .page-size-select .el-input__inner{
|
::v-deep .page-size-select .el-input__inner {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
@ -401,7 +396,8 @@ export default {
|
||||||
color: #606266;
|
color: #606266;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
::v-deep .page-size-select .el-input__suffix{
|
|
||||||
|
::v-deep .page-size-select .el-input__suffix {
|
||||||
right: 6px;
|
right: 6px;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
@ -412,13 +408,14 @@ export default {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .page-size-select .el-input__suffix-inner{
|
::v-deep .page-size-select .el-input__suffix-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
::v-deep .page-size-select .el-icon-arrow-up:before{
|
|
||||||
|
::v-deep .page-size-select .el-icon-arrow-up:before {
|
||||||
content: "";
|
content: "";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border-left: 6px solid transparent;
|
border-left: 6px solid transparent;
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,19 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="固件名称" prop="firmwareName" align="center"></el-table-column>
|
<el-table-column label="固件名称" prop="firmwareName" align="center"></el-table-column>
|
||||||
<el-table-column label="固件类型" prop="type" align="center"></el-table-column>
|
<el-table-column label="固件类型" prop="type" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getFirmwareTypeName(scope.row.type) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="版本号" prop="version" align="center"></el-table-column>
|
<el-table-column label="版本号" prop="version" align="center"></el-table-column>
|
||||||
<el-table-column label="文件大小" prop="size" align="center">
|
<el-table-column label="文件大小" 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" show-overflow-tooltip></el-table-column>
|
<el-table-column label="备注" prop="remark" align="center"
|
||||||
|
show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column label="创建时间" prop="createDate" align="center">
|
<el-table-column label="创建时间" prop="createDate" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ formatDate(scope.row.createDate) }}
|
{{ formatDate(scope.row.createDate) }}
|
||||||
|
|
@ -38,7 +43,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" @click="downloadFirmware(scope.row)">下载</el-button>
|
<el-button size="mini" type="text"
|
||||||
|
@click="downloadFirmware(scope.row)">下载</el-button>
|
||||||
<el-button size="mini" type="text" @click="editParam(scope.row)">编辑</el-button>
|
<el-button size="mini" type="text" @click="editParam(scope.row)">编辑</el-button>
|
||||||
<el-button size="mini" type="text" @click="deleteParam(scope.row)">删除</el-button>
|
<el-button size="mini" type="text" @click="deleteParam(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -50,16 +56,14 @@
|
||||||
<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 ? '取消全选' : '全选' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="mini" type="success" @click="showAddDialog">新增</el-button>
|
<el-button size="mini" type="success" @click="showAddDialog"
|
||||||
|
style="background: #5bc98c;border: None;">新增</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">删除</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
|
<el-option v-for="item in pageSizeOptions" :key="item" :label="`${item}条/页`"
|
||||||
v-for="item in pageSizeOptions"
|
|
||||||
:key="item"
|
|
||||||
:label="`${item}条/页`"
|
|
||||||
:value="item">
|
:value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
@ -93,8 +97,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Api from "@/apis/api";
|
import Api from "@/apis/api";
|
||||||
import HeaderBar from "@/components/HeaderBar.vue";
|
|
||||||
import FirmwareDialog from "@/components/FirmwareDialog.vue";
|
import FirmwareDialog from "@/components/FirmwareDialog.vue";
|
||||||
|
import HeaderBar from "@/components/HeaderBar.vue";
|
||||||
|
import { FIRMWARE_TYPES } from "@/utils";
|
||||||
import { formatDate, formatFileSize } from "@/utils/format";
|
import { formatDate, formatFileSize } from "@/utils/format";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -156,7 +161,7 @@ export default {
|
||||||
const params = {
|
const params = {
|
||||||
pageNum: this.currentPage,
|
pageNum: this.currentPage,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
firmwareName: this.searchName || undefined,
|
firmwareName: this.searchName || "",
|
||||||
orderField: "create_date",
|
orderField: "create_date",
|
||||||
order: "desc"
|
order: "desc"
|
||||||
};
|
};
|
||||||
|
|
@ -371,7 +376,11 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
formatDate,
|
formatDate,
|
||||||
formatFileSize
|
formatFileSize,
|
||||||
|
getFirmwareTypeName(type) {
|
||||||
|
const firmwareType = FIRMWARE_TYPES.find(item => item.key === type);
|
||||||
|
return firmwareType ? firmwareType.name : type;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -392,16 +401,16 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
.main-wrapper {
|
||||||
margin: 5px 22px;
|
margin: 5px 22px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
min-height: calc(100vh - 24vh);
|
min-height: calc(100vh - 24vh);
|
||||||
height: auto;
|
height: auto;
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||||
position: relative;
|
position: relative;
|
||||||
background: rgba(237, 242, 255, 0.5);
|
background: rgba(237, 242, 255, 0.5);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.operation-bar {
|
.operation-bar {
|
||||||
|
|
@ -510,7 +519,7 @@ export default {
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|
||||||
.el-select {
|
.el-select {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-btn:first-child,
|
.pagination-btn:first-child,
|
||||||
|
|
@ -586,7 +595,7 @@ export default {
|
||||||
.el-table__header-wrapper {
|
.el-table__header-wrapper {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table__header th {
|
.el-table__header th {
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
color: black;
|
color: black;
|
||||||
|
|
@ -608,7 +617,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-table__row:hover > td {
|
.el-table__row:hover>td {
|
||||||
background-color: #f5f7fa !important;
|
background-color: #f5f7fa !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,400 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="container">
|
|
||||||
<h1 class="title">XiaoZhi ESP32 Server 测试助手</h1>
|
|
||||||
<div class="chat-container" ref="chatContainer">
|
|
||||||
<div v-for="(message, index) in messages" :key="index"
|
|
||||||
:class="['message', message.role === 'user' ? 'user' : 'assistant']">
|
|
||||||
<span>{{ message.content }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="controls">
|
|
||||||
<button @click="toggleRecording" :disabled="wsStatus !== 'connected'" :class="{ recording: isRecording }">
|
|
||||||
{{ isRecording ? '停止录音' : '开始录音' }}
|
|
||||||
</button>
|
|
||||||
<p>WebSocket: {{ wsStatus }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { OpusDecoder } from 'opus-decoder';
|
|
||||||
import Recorder from 'opus-recorder';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'TestPage',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
messages: [],
|
|
||||||
wsStatus: 'disconnected',
|
|
||||||
isRecording: false,
|
|
||||||
ws: null,
|
|
||||||
recorder: null,
|
|
||||||
stream: null,
|
|
||||||
audioContext: null,
|
|
||||||
sourceNode: null,
|
|
||||||
audioDecoder: null,
|
|
||||||
audioBufferQueue: [], // 当前句子的音频缓冲区
|
|
||||||
playbackQueue: [], // 播放队列,存储待播放的句子
|
|
||||||
isPlaying: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
connectWebSocket() {
|
|
||||||
this.ws = new WebSocket('ws://192.168.3.97:8000');//修改服务端地址
|
|
||||||
this.ws.binaryType = 'arraybuffer';
|
|
||||||
this.ws.onopen = () => {
|
|
||||||
this.wsStatus = 'connected';
|
|
||||||
console.log('WebSocket 连接成功');
|
|
||||||
this.ws.send(JSON.stringify({ type: 'auth', 'device-id': 'test-device' }));
|
|
||||||
this.audioDecoder = new OpusDecoder({ sampleRate: 16000, channels: 1 });
|
|
||||||
};
|
|
||||||
this.ws.onmessage = async (event) => {
|
|
||||||
if (typeof event.data === 'string') {
|
|
||||||
const msg = JSON.parse(event.data);
|
|
||||||
console.log('收到文本消息:', msg);
|
|
||||||
|
|
||||||
if (msg.type === 'stt') {
|
|
||||||
this.messages.push({ role: 'user', content: msg.text });
|
|
||||||
this.scrollToBottom();
|
|
||||||
} else if (msg.type === 'llm') {
|
|
||||||
this.messages.push({ role: 'assistant', content: msg.text });
|
|
||||||
this.scrollToBottom();
|
|
||||||
} else if (msg.type === 'tts') {
|
|
||||||
if (msg.state === 'sentence_start') {
|
|
||||||
this.audioBufferQueue = [];
|
|
||||||
const lastMessage = this.messages[this.messages.length - 1];
|
|
||||||
if (!lastMessage || lastMessage.content !== msg.text) {
|
|
||||||
this.messages.push({ role: 'assistant', content: msg.text });
|
|
||||||
this.scrollToBottom();
|
|
||||||
}
|
|
||||||
} else if (msg.state === 'sentence_end') {
|
|
||||||
if (this.audioBufferQueue.length > 0) {
|
|
||||||
this.playbackQueue.push([...this.audioBufferQueue]);
|
|
||||||
this.audioBufferQueue = [];
|
|
||||||
this.playNextInQueue();
|
|
||||||
}
|
|
||||||
} else if (msg.state === 'stop') {
|
|
||||||
console.log('TTS 任务结束');
|
|
||||||
if (this.audioBufferQueue.length > 0) {
|
|
||||||
this.playbackQueue.push([...this.audioBufferQueue]);
|
|
||||||
this.audioBufferQueue = [];
|
|
||||||
this.playNextInQueue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (msg.type === 'hello') {
|
|
||||||
console.log('收到服务器初始化消息:', msg);
|
|
||||||
}
|
|
||||||
} else if (event.data instanceof ArrayBuffer) {
|
|
||||||
console.log('收到音频帧,大小:', event.data.byteLength, '字节');
|
|
||||||
const opusFrame = new Uint8Array(event.data);
|
|
||||||
const frameHead = Array.from(opusFrame.slice(0, 8))
|
|
||||||
.map(b => b.toString(16).padStart(2, '0'))
|
|
||||||
.join(' ');
|
|
||||||
console.log('音频帧前8字节:', frameHead);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const decoded = this.audioDecoder.decodeFrame(opusFrame);
|
|
||||||
console.log('解码结果:', decoded);
|
|
||||||
if (decoded && decoded.channelData && decoded.channelData[0]) {
|
|
||||||
const pcmData = decoded.channelData[0];
|
|
||||||
if (pcmData.length > 0) {
|
|
||||||
this.audioBufferQueue.push(pcmData);
|
|
||||||
console.log('解码音频帧,PCM 数据长度:', pcmData.length);
|
|
||||||
if (this.audioBufferQueue.length >= 5 && this.playbackQueue.length === 0 && !this.isPlaying) {
|
|
||||||
this.playbackQueue.push([...this.audioBufferQueue]);
|
|
||||||
this.audioBufferQueue = [];
|
|
||||||
this.playNextInQueue();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.warn('解码成功,但 PCM 数据长度为 0');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.warn('解码结果无效:', decoded);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Opus 解码错误:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.ws.onerror = (error) => {
|
|
||||||
console.error('WebSocket 错误:', error);
|
|
||||||
this.wsStatus = 'error';
|
|
||||||
};
|
|
||||||
this.ws.onclose = () => {
|
|
||||||
this.wsStatus = 'disconnected';
|
|
||||||
console.log('WebSocket 断开');
|
|
||||||
setTimeout(this.connectWebSocket, 1000);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
scrollToBottom() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
if (this.$refs.chatContainer) {
|
|
||||||
this.$refs.chatContainer.scrollTop = this.$refs.chatContainer.scrollHeight;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async playNextInQueue() {
|
|
||||||
if (this.isPlaying || this.playbackQueue.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.isPlaying = true;
|
|
||||||
|
|
||||||
if (!this.audioContext || this.audioContext.state === 'closed') {
|
|
||||||
this.audioContext = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 16000 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const pcmBuffers = this.playbackQueue.shift();
|
|
||||||
const totalLength = pcmBuffers.reduce((sum, pcm) => sum + pcm.length, 0);
|
|
||||||
if (totalLength === 0) {
|
|
||||||
console.error('音频缓冲区总长度为 0,无法播放');
|
|
||||||
this.isPlaying = false;
|
|
||||||
this.playNextInQueue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const mergedPcm = new Float32Array(totalLength);
|
|
||||||
let offset = 0;
|
|
||||||
for (const pcm of pcmBuffers) {
|
|
||||||
mergedPcm.set(pcm, offset);
|
|
||||||
offset += pcm.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
const audioBuffer = this.audioContext.createBuffer(1, totalLength, 16000);
|
|
||||||
audioBuffer.getChannelData(0).set(mergedPcm);
|
|
||||||
|
|
||||||
const source = this.audioContext.createBufferSource();
|
|
||||||
source.buffer = audioBuffer;
|
|
||||||
source.connect(this.audioContext.destination);
|
|
||||||
source.onended = () => {
|
|
||||||
this.isPlaying = false;
|
|
||||||
console.log('音频播放结束');
|
|
||||||
this.playNextInQueue();
|
|
||||||
};
|
|
||||||
source.start();
|
|
||||||
console.log('开始播放音频,总长度:', totalLength);
|
|
||||||
},
|
|
||||||
stripOggContainer(data) {
|
|
||||||
let arrayBuffer;
|
|
||||||
if (data instanceof ArrayBuffer) {
|
|
||||||
arrayBuffer = data;
|
|
||||||
} else if (data.buffer instanceof ArrayBuffer) {
|
|
||||||
arrayBuffer = data.buffer;
|
|
||||||
} else {
|
|
||||||
console.error('输入数据类型不支持:', data);
|
|
||||||
return [data];
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataView = new DataView(arrayBuffer);
|
|
||||||
const frames = [];
|
|
||||||
let offset = 0;
|
|
||||||
|
|
||||||
while (offset < arrayBuffer.byteLength) {
|
|
||||||
if (dataView.getUint32(offset) === 0x4F676753) { // 'OggS'
|
|
||||||
const segmentTableLength = dataView.getUint8(offset + 26);
|
|
||||||
const segmentTableOffset = offset + 27;
|
|
||||||
let segmentOffset = segmentTableOffset + segmentTableLength;
|
|
||||||
|
|
||||||
for (let i = 0; i < segmentTableLength; i++) {
|
|
||||||
const segmentLength = dataView.getUint8(segmentTableOffset + i);
|
|
||||||
const segmentData = arrayBuffer.slice(segmentOffset, segmentOffset + segmentLength);
|
|
||||||
segmentOffset += segmentLength;
|
|
||||||
|
|
||||||
const header = new TextDecoder().decode(segmentData.slice(0, 8));
|
|
||||||
if (header === 'OpusHead' || header === 'OpusTags') {
|
|
||||||
console.log(`跳过 ${header},大小: ${segmentLength} 字节`);
|
|
||||||
} else if (segmentLength >= 50 && segmentLength <= 300) {
|
|
||||||
frames.push(segmentData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
offset = segmentOffset;
|
|
||||||
} else {
|
|
||||||
const remainingLength = arrayBuffer.byteLength - offset;
|
|
||||||
if (remainingLength >= 50 && remainingLength <= 300) {
|
|
||||||
frames.push(arrayBuffer.slice(offset));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frames.length === 0) {
|
|
||||||
console.warn('未找到有效裸 Opus 帧,返回原始数据');
|
|
||||||
return [arrayBuffer];
|
|
||||||
}
|
|
||||||
console.log('剥离后找到', frames.length, '个裸 Opus 帧');
|
|
||||||
return frames;
|
|
||||||
},
|
|
||||||
async initRecorder() {
|
|
||||||
console.log('开始初始化录音');
|
|
||||||
try {
|
|
||||||
if (this.stream) {
|
|
||||||
this.stream.getTracks().forEach(track => track.stop());
|
|
||||||
}
|
|
||||||
this.stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
||||||
console.log('获取麦克风权限成功,stream:', this.stream);
|
|
||||||
|
|
||||||
if (!this.audioContext || this.audioContext.state === 'closed') {
|
|
||||||
this.audioContext = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 16000 });
|
|
||||||
}
|
|
||||||
this.sourceNode = this.audioContext.createMediaStreamSource(this.stream);
|
|
||||||
|
|
||||||
this.recorder = new Recorder({
|
|
||||||
encoderPath: '/encoderWorker.min.js',
|
|
||||||
sampleRate: 16000,
|
|
||||||
numberOfChannels: 1,
|
|
||||||
frameSize: 960,
|
|
||||||
encoderApplication: 2048,
|
|
||||||
encoderFrameSize: 60,
|
|
||||||
encoderBitRate: 24000,
|
|
||||||
monitorGain: 0,
|
|
||||||
sourceNode: this.sourceNode,
|
|
||||||
ogg: false,
|
|
||||||
streamPages: false,
|
|
||||||
maxFramesPerPage: 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.recorder.ondataavailable = (data) => {
|
|
||||||
console.log('录音数据可用:', data.byteLength, '类型:', data.constructor.name);
|
|
||||||
const frames = this.stripOggContainer(data);
|
|
||||||
frames.forEach((frame, index) => {
|
|
||||||
const frameHead = Array.from(new Uint8Array(frame.slice(0, 8)))
|
|
||||||
.map(b => b.toString(16).padStart(2, '0'))
|
|
||||||
.join(' ');
|
|
||||||
console.log(`帧 ${index} 大小: ${frame.byteLength} 字节,前8字节: ${frameHead}`);
|
|
||||||
|
|
||||||
if (frame.byteLength < 50 || frame.byteLength > 300) {
|
|
||||||
console.warn(`帧 ${index} 大小异常: ${frame.byteLength} 字节,预期 50-300 字节`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
||||||
this.ws.send(frame);
|
|
||||||
console.log('发送裸 Opus 帧:', frame.byteLength);
|
|
||||||
} else {
|
|
||||||
console.warn('WebSocket 未连接,跳过发送');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
this.recorder.onstart = () => {
|
|
||||||
console.log('录音已启动');
|
|
||||||
};
|
|
||||||
|
|
||||||
this.recorder.onstop = () => {
|
|
||||||
console.log('录音停止');
|
|
||||||
this.stream.getTracks().forEach(track => track.stop());
|
|
||||||
this.stream = null;
|
|
||||||
this.sourceNode = null;
|
|
||||||
this.scrollToBottom();
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('Recorder 初始化成功');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('初始化录音失败:', err);
|
|
||||||
alert('无法访问麦克风或录音初始化失败,请检查权限');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async toggleRecording() {
|
|
||||||
console.log('点击 toggleRecording,当前状态:', this.isRecording, 'WebSocket 状态:', this.wsStatus);
|
|
||||||
if (!this.recorder) {
|
|
||||||
await this.initRecorder();
|
|
||||||
if (!this.recorder) {
|
|
||||||
console.error('recorder 初始化失败');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.isRecording) {
|
|
||||||
console.log('停止录音');
|
|
||||||
this.recorder.stop();
|
|
||||||
this.isRecording = false;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
console.log('开始录音');
|
|
||||||
await this.initRecorder();
|
|
||||||
await this.recorder.start();
|
|
||||||
console.log('录音开始后,状态:', this.recorder.state);
|
|
||||||
this.isRecording = true;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('录音启动失败:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
console.log('组件挂载,初始化 WebSocket');
|
|
||||||
this.connectWebSocket();
|
|
||||||
},
|
|
||||||
destroyed() {
|
|
||||||
if (this.ws) this.ws.close();
|
|
||||||
if (this.stream) this.stream.getTracks().forEach(track => track.stop());
|
|
||||||
if (this.recorder) this.recorder.stop();
|
|
||||||
if (this.audioContext) this.audioContext.close();
|
|
||||||
if (this.audioDecoder) this.audioDecoder.destroy();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.container {
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 20px;
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 24px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-container {
|
|
||||||
height: 60vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 10px;
|
|
||||||
background: #f9f9f9;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
margin: 10px 0;
|
|
||||||
padding: 8px 12px;
|
|
||||||
border-radius: 5px;
|
|
||||||
max-width: 70%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user {
|
|
||||||
background: #007bff;
|
|
||||||
color: white;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.assistant {
|
|
||||||
background: #e9ecef;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
background: #007bff;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:disabled {
|
|
||||||
background: #ccc;
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.recording {
|
|
||||||
background: #dc3545;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -3,7 +3,7 @@ import sys
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from config.config_loader import load_config
|
from config.config_loader import load_config
|
||||||
|
|
||||||
SERVER_VERSION = "0.3.9"
|
SERVER_VERSION = "0.3.10"
|
||||||
|
|
||||||
|
|
||||||
def get_module_abbreviation(module_name, module_dict):
|
def get_module_abbreviation(module_name, module_dict):
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ services:
|
||||||
- SPRING_DATASOURCE_DRUID_PASSWORD=123456
|
- SPRING_DATASOURCE_DRUID_PASSWORD=123456
|
||||||
- SPRING_DATA_REDIS_HOST=xiaozhi-esp32-server-redis
|
- SPRING_DATA_REDIS_HOST=xiaozhi-esp32-server-redis
|
||||||
- SPRING_DATA_REDIS_PORT=6379
|
- SPRING_DATA_REDIS_PORT=6379
|
||||||
|
# volumes:
|
||||||
|
# # 配置文件目录
|
||||||
|
# - ./uploadfile:/app/uploadfile
|
||||||
|
|
||||||
xiaozhi-esp32-server-db:
|
xiaozhi-esp32-server-db:
|
||||||
image: mysql:latest
|
image: mysql:latest
|
||||||
container_name: xiaozhi-esp32-server-db
|
container_name: xiaozhi-esp32-server-db
|
||||||
|
|
@ -59,7 +63,7 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
expose:
|
expose:
|
||||||
- "3306"
|
- 3306
|
||||||
volumes:
|
volumes:
|
||||||
- ./mysql/data:/var/lib/mysql
|
- ./mysql/data:/var/lib/mysql
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue