fix: 克隆音色未显示

This commit is contained in:
Sakura-RanChen
2026-03-11 10:30:29 +08:00
parent 5b986bf57f
commit 60498b24ae
17 changed files with 60 additions and 5 deletions
@@ -17,4 +17,7 @@ public class VoiceCloneDTO {
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "语言")
private String languages;
}
@@ -28,6 +28,9 @@ public class VoiceCloneResponseDTO {
@Schema(description = "声音id")
private String voiceId;
@Schema(description = "语言")
private String languages;
@Schema(description = "用户ID(关联用户表)")
private Long userId;
@@ -31,6 +31,9 @@ public class VoiceCloneEntity {
@Schema(description = "声音id")
private String voiceId;
@Schema(description = "语言")
private String languages;
@Schema(description = "用户 ID(关联用户表)")
private Long userId;
@@ -116,6 +116,7 @@ public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceC
entity.setVoiceId(voiceId);
entity.setName(namePrefix + "_" + index);
entity.setUserId(dto.getUserId());
entity.setLanguages(dto.getLanguages());
entity.setTrainStatus(0); // 默认训练中
batchInsertList.add(entity);
}
@@ -0,0 +1,4 @@
-- 给声音克隆表添加语言字段
SET @col_exists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'ai_voice_clone' AND COLUMN_NAME = 'languages');
SET @sql = IF(@col_exists = 0, 'ALTER TABLE `ai_voice_clone` ADD COLUMN `languages` VARCHAR(50) DEFAULT NULL COMMENT ''语言'' AFTER `voice_id`', 'SELECT ''Column languages already exists'' AS msg');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
@@ -557,4 +557,10 @@ databaseChangeLog:
- sqlFile:
encoding: utf8
path: classpath:db/changelog/202603091051.sql
- changeSet:
id: 202603101723
author: RanChen
changes:
- sqlFile:
encoding: utf8
path: classpath:db/changelog/202603101723.sql
@@ -3,7 +3,7 @@
<mapper namespace="xiaozhi.modules.voiceclone.dao.VoiceCloneDao">
<select id="getTrainSuccess" resultType="xiaozhi.modules.model.dto.VoiceDTO">
select id, name, voice_id as voiceDemo
select id, name, voice_id as voiceDemo, languages
from ai_voice_clone
where model_id = #{modelId} and user_id = #{userId} and train_status = 2
</select>