Commit 6dc9204d by haojie

洗稿提交

parent 65a30295
...@@ -50,12 +50,10 @@ export const processTextCallback = () => { ...@@ -50,12 +50,10 @@ export const processTextCallback = () => {
}; };
// 生成音频 // 生成音频
let res: any = await liveTts(params); let res: any = await liveTts(params);
if (res.code == 0) {
console.log('等待音频生成完成');
// 开始轮询
openInterval(true);
}
} }
console.log('等待音频生成完成');
// 开始轮询
openInterval(true, '', true, currentConfuseId.value, false, list.length);
}; };
// 洗稿列表变化 // 洗稿列表变化
...@@ -150,6 +148,7 @@ export const processTextCallback = () => { ...@@ -150,6 +148,7 @@ export const processTextCallback = () => {
try { try {
let res: any = await createLiveTask(filterFiled()); let res: any = await createLiveTask(filterFiled());
if (res.code == 0) { if (res.code == 0) {
console.log('创建成功-', res.data.id);
live_task_id.value = res.data.id; live_task_id.value = res.data.id;
return true; return true;
} }
...@@ -296,6 +295,9 @@ export const processTextCallback = () => { ...@@ -296,6 +295,9 @@ export const processTextCallback = () => {
params.type_content = list; params.type_content = list;
let res: any = await liveTaskRegenerate(live_task_id.value, params); let res: any = await liveTaskRegenerate(live_task_id.value, params);
if (res.code == 0) { if (res.code == 0) {
console.log('提交的参数', params);
console.log(JSON.stringify(params));
console.log('重新生成直播,已经提交-', live_task_id.value);
if (successCallback) { if (successCallback) {
submitSuccessed(); submitSuccessed();
} }
...@@ -326,31 +328,32 @@ export const processTextCallback = () => { ...@@ -326,31 +328,32 @@ export const processTextCallback = () => {
successCallback: boolean, successCallback: boolean,
uuid: string, uuid: string,
customRegenerate: any = false, customRegenerate: any = false,
confuseLength: number = 0,
) => { ) => {
try { try {
let res: any = await getLiveTtsCallback({ let res: any = await getLiveTtsCallback({
task_id: getTaskId(isConfuse, uuid), task_id: getTaskId(isConfuse, uuid),
}); });
if (res.code == 0) { if (res.code == 0) {
if (isDev()) { // if (isDev()) {
let params = { // let params = {
data: { // data: {
audio_address: // audio_address:
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/ed71050141c74954ac779cfbb9dd9604.wav?Expires=1691136228&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=jE01uOk8Vfa08ovlPbJYI2Bhwvs%3D', // 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/ed71050141c74954ac779cfbb9dd9604.wav?Expires=1691136228&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=jE01uOk8Vfa08ovlPbJYI2Bhwvs%3D',
task_id: 0, // task_id: 0,
}, // },
}; // };
for (let i = 0; i < 10; i++) { // for (let i = 0; i < 10; i++) {
res.data.push(params); // res.data.push(params);
} // }
} // }
if (res.data.length) { if (res.data.length) {
console.log('音频任务回调成功'); console.log('音频任务回调成功');
console.log(res.data); console.log(res.data);
// 关闭定时器
closeInterval();
if (!isConfuse) { if (!isConfuse) {
if (res.data.length >= createLiveInfo.value[createLiveKeys.textScriptList].length) { if (res.data.length >= createLiveInfo.value[createLiveKeys.textScriptList].length) {
// 关闭定时器
closeInterval();
let list = JSON.parse(JSON.stringify(createLiveInfo.value[createLiveKeys.textScriptList])); let list = JSON.parse(JSON.stringify(createLiveInfo.value[createLiveKeys.textScriptList]));
let audio_list = []; let audio_list = [];
// 本次任务不是洗稿任务才修改store // 本次任务不是洗稿任务才修改store
...@@ -397,26 +400,29 @@ export const processTextCallback = () => { ...@@ -397,26 +400,29 @@ export const processTextCallback = () => {
} }
} }
} else { } else {
let audio_list = []; if (res.data.length >= confuseLength) {
// 洗稿任务 closeInterval();
res.data.forEach((item: any) => { let audio_list = [];
let data = item.data; // 洗稿任务
if (data && data.audio_address) { res.data.forEach((item: any) => {
audio_list.push(data.audio_address); let data = item.data;
if (data && data.audio_address) {
audio_list.push(data.audio_address);
} else {
show_message('洗稿缺少参数');
}
});
let resultList = await audioStart(audio_list, false);
console.log('提交的个数');
console.log(resultList.length);
// 提交
if (customRegenerate) {
await customRegenerate(resultList);
} else { } else {
show_message('洗稿缺少参数'); await regenerate(resultList, successCallback);
} }
}); loading.value = false;
let resultList = await audioStart(audio_list, false);
console.log('提交的个数');
console.log(resultList.length);
// 提交
if (customRegenerate) {
await customRegenerate(resultList);
} else {
await regenerate(resultList, successCallback);
} }
loading.value = false;
} }
} }
} }
...@@ -430,9 +436,10 @@ export const processTextCallback = () => { ...@@ -430,9 +436,10 @@ export const processTextCallback = () => {
successCallback: boolean = true, successCallback: boolean = true,
uuid: string = '', uuid: string = '',
customRegenerate: any = false, customRegenerate: any = false,
confuseLength: number = 0,
) => { ) => {
interval.value = window.setInterval(() => { interval.value = window.setInterval(() => {
getTaskStatus(isConfuse, type, successCallback, uuid, customRegenerate); getTaskStatus(isConfuse, type, successCallback, uuid, customRegenerate, confuseLength);
}, 3000); }, 3000);
}; };
......
...@@ -150,12 +150,10 @@ const submitAudioTask = async (list: any[]) => { ...@@ -150,12 +150,10 @@ const submitAudioTask = async (list: any[]) => {
}; };
// 生成音频 // 生成音频
let res: any = await liveTts(params); let res: any = await liveTts(params);
if (res.code == 0) {
console.log('等待音频生成完成');
// 开始轮询
confuseInterval(true, '', false, currentConfuseId.value, regenerate);
}
} }
console.log('等待音频生成完成');
// 开始轮询
confuseInterval(true, '', false, currentConfuseId.value, regenerate, list.length);
}; };
// 洗稿列表变化 // 洗稿列表变化
......
...@@ -72,12 +72,12 @@ import ChoseDigitalPerson from './components/ChoseDigitalPerson.vue'; ...@@ -72,12 +72,12 @@ import ChoseDigitalPerson from './components/ChoseDigitalPerson.vue';
import HomeSvg from '@/assets/svg/createLive/home.svg'; import HomeSvg from '@/assets/svg/createLive/home.svg';
import InteractSvg from '@/assets/svg/createLive/interact.svg'; import InteractSvg from '@/assets/svg/createLive/interact.svg';
import ScriptsSvg from '@/assets/svg/createLive/scripts.svg'; import ScriptsSvg from '@/assets/svg/createLive/scripts.svg';
import { computed, onMounted, onBeforeMount, ref, onBeforeUnmount, onActivated, onDeactivated } from 'vue'; import { computed, onBeforeMount, ref, onBeforeUnmount, onActivated } from 'vue';
import { getElBounding, show_message, isDev, DataType, dimensionalConvert } from '@/utils/tool'; import { getElBounding, show_message, isDev, DataType, dimensionalConvert } from '@/utils/tool';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { createLiveKeys, scriptTypeText, scriptTypePhonetics } from '@/service/CreateLive'; import { createLiveKeys, scriptTypeText, scriptTypePhonetics } from '@/service/CreateLive';
import { createLiveTask, getLiveTaskInfo, createDrafts, getDraftsDetail, liveTts } from '@/utils/api/userApi'; import { getLiveTaskInfo, createDrafts, getDraftsDetail, liveTts } from '@/utils/api/userApi';
import { useRoute, useRouter, onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'; import { useRoute, onBeforeRouteLeave } from 'vue-router';
import routerConfig from '@/router/tool'; import routerConfig from '@/router/tool';
import { onUpdateLiveTask } from '@/service/Common'; import { onUpdateLiveTask } from '@/service/Common';
import { callPyjsInWindow } from '@/utils/pyqt'; import { callPyjsInWindow } from '@/utils/pyqt';
...@@ -93,7 +93,6 @@ const store = useStore(); ...@@ -93,7 +93,6 @@ const store = useStore();
const route = useRoute(); const route = useRoute();
// 离开页面前的query // 离开页面前的query
const currentQuery = ref({}); const currentQuery = ref({});
const router = useRouter();
const liveImage = computed(() => store.getters['live/getLiveimage']); const liveImage = computed(() => store.getters['live/getLiveimage']);
// 创建直播的已有的字段 // 创建直播的已有的字段
const createLiveInfo = computed(() => store.getters['live/getLiveInfo']); const createLiveInfo = computed(() => store.getters['live/getLiveInfo']);
...@@ -457,9 +456,6 @@ const initPage = () => { ...@@ -457,9 +456,6 @@ const initPage = () => {
// 获取uuid // 获取uuid
const getUuid = () => { const getUuid = () => {
if (isDev()) {
return 'e6e973a5-ccdd-4779-a09a-be1658ecbea2';
}
return v4(); return v4();
}; };
...@@ -508,9 +504,6 @@ onBeforeRouteLeave(() => { ...@@ -508,9 +504,6 @@ onBeforeRouteLeave(() => {
currentQuery.value = route.query; currentQuery.value = route.query;
}); });
// 缓存离开
// onDeactivated(() => {});
onBeforeUnmount(() => { onBeforeUnmount(() => {
// 清空选择的数字人 // 清空选择的数字人
store.commit('live/setLiveImage', ''); store.commit('live/setLiveImage', '');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment