1. 修复2.0克隆问题

2. 修复条件筛选
3. 使用角色自定的voiceID
main
guofei 2024-12-04 15:23:35 +08:00
parent 983c203aa9
commit 0ac9a6ff44
3 changed files with 38 additions and 5 deletions

View File

@ -24,8 +24,22 @@ export class RedisTaskProcessor {
console.log(job.data);
console.log(`开始处理任务 [第${job.attemptsMade + 1}次尝试]: ${job.data.roleName}`);
// 先查询人物是否有 voiceId, 如果有就用当前用户的 voiceId
const volcenAudioSpeakService = new VolcenAudioSpeakService();
voiceId = await volcenAudioSpeakService.getVoiceId();
const user = await this.dbService.systemCharter.findUnique({
where: {
id: charterInfo.roleId,
},
});
console.log('用户是否有voiceID', user.voiceId);
if (user.voiceId) {
voiceId = user.voiceId;
} else {
voiceId = await volcenAudioSpeakService.getVoiceId();
}
if (!voiceId) {
throw new Error('获取voiceId失败' + JSON.stringify(voiceId));
}
// voiceId = 'S_VK2Yw0Gb1';
// 请求ossurl获取base64
const base64 = await volcenAudioSpeakService.getAudioBase64(ossUrl);

View File

@ -30,7 +30,7 @@ export class SystemCharterController {
@Get('/getList')
async getList(@Query() query: SystemCharterlDto & { originAudioUrl?: string }) {
const { current, pageSize, ...other } = query;
const where = {};
let where = {};
if (other.roleName) {
where['roleName'] = {
contains: other.roleName,
@ -41,13 +41,25 @@ export class SystemCharterController {
// 根据原始音频状态筛选
if (query.originAudioUrl == 'true') {
// 已克隆的
where['originAudioUrl'] = {
where['voiceId'] = {
not: null,
};
} else {
// 为空的数据
// where['OR'] = [{ originAudioUrl: null }, { originAudioUrl: '' }, { originAudioUrl: undefined }];
where['originAudioUrl'] = undefined;
where = {
...where,
OR: [
{
voiceId: null,
},
{
voiceId: {
isSet: false,
},
},
],
};
}
}

View File

@ -102,7 +102,14 @@ export class VolcenAudioSpeakService {
bits: 16,
},
],
// model_type:1,
model_type: 1,
// cn = 0 中文(默认)
// en = 1 英文
// ja = 2 日语
// es = 3 西班牙语
// id = 4 印尼语
// pt = 5 葡萄牙语
language: 0,
source: 2,
};