parent
983c203aa9
commit
0ac9a6ff44
|
@ -24,8 +24,22 @@ export class RedisTaskProcessor {
|
||||||
console.log(job.data);
|
console.log(job.data);
|
||||||
console.log(`开始处理任务 [第${job.attemptsMade + 1}次尝试]: ${job.data.roleName}`);
|
console.log(`开始处理任务 [第${job.attemptsMade + 1}次尝试]: ${job.data.roleName}`);
|
||||||
|
|
||||||
|
// 先查询人物是否有 voiceId, 如果有就用当前用户的 voiceId
|
||||||
const volcenAudioSpeakService = new VolcenAudioSpeakService();
|
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';
|
// voiceId = 'S_VK2Yw0Gb1';
|
||||||
// 请求ossurl获取base64
|
// 请求ossurl获取base64
|
||||||
const base64 = await volcenAudioSpeakService.getAudioBase64(ossUrl);
|
const base64 = await volcenAudioSpeakService.getAudioBase64(ossUrl);
|
||||||
|
|
|
@ -30,7 +30,7 @@ export class SystemCharterController {
|
||||||
@Get('/getList')
|
@Get('/getList')
|
||||||
async getList(@Query() query: SystemCharterlDto & { originAudioUrl?: string }) {
|
async getList(@Query() query: SystemCharterlDto & { originAudioUrl?: string }) {
|
||||||
const { current, pageSize, ...other } = query;
|
const { current, pageSize, ...other } = query;
|
||||||
const where = {};
|
let where = {};
|
||||||
if (other.roleName) {
|
if (other.roleName) {
|
||||||
where['roleName'] = {
|
where['roleName'] = {
|
||||||
contains: other.roleName,
|
contains: other.roleName,
|
||||||
|
@ -41,13 +41,25 @@ export class SystemCharterController {
|
||||||
// 根据原始音频状态筛选
|
// 根据原始音频状态筛选
|
||||||
if (query.originAudioUrl == 'true') {
|
if (query.originAudioUrl == 'true') {
|
||||||
// 已克隆的
|
// 已克隆的
|
||||||
where['originAudioUrl'] = {
|
where['voiceId'] = {
|
||||||
not: null,
|
not: null,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// 为空的数据
|
// 为空的数据
|
||||||
// where['OR'] = [{ originAudioUrl: null }, { originAudioUrl: '' }, { originAudioUrl: undefined }];
|
// where['OR'] = [{ originAudioUrl: null }, { originAudioUrl: '' }, { originAudioUrl: undefined }];
|
||||||
where['originAudioUrl'] = undefined;
|
where = {
|
||||||
|
...where,
|
||||||
|
OR: [
|
||||||
|
{
|
||||||
|
voiceId: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
voiceId: {
|
||||||
|
isSet: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,14 @@ export class VolcenAudioSpeakService {
|
||||||
bits: 16,
|
bits: 16,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// model_type:1,
|
model_type: 1,
|
||||||
|
// cn = 0 中文(默认)
|
||||||
|
// en = 1 英文
|
||||||
|
// ja = 2 日语
|
||||||
|
// es = 3 西班牙语
|
||||||
|
// id = 4 印尼语
|
||||||
|
// pt = 5 葡萄牙语
|
||||||
|
language: 0,
|
||||||
source: 2,
|
source: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue