update:声音复刻功能的部分修改

This commit is contained in:
3030332422
2025-10-17 18:22:38 +08:00
parent 66fb7933b7
commit d3eb8df7f0
3 changed files with 18 additions and 6 deletions
@@ -233,7 +233,7 @@ public class VoiceCloneServiceImpl extends BaseServiceImpl<VoiceCloneDao, VoiceC
}
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public void cloneAudio(String cloneId) {
VoiceCloneEntity entity = baseDao.selectById(cloneId);
if (entity == null) {
+11 -2
View File
@@ -79,7 +79,7 @@ export default {
},
// 复刻音频
cloneAudio(params, callback) {
cloneAudio(params, callback, errorCallback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/voiceClone/cloneAudio`)
.method('POST')
@@ -88,10 +88,19 @@ export default {
RequestService.clearRequestTime();
callback(res);
})
.fail((res) => {
// 业务失败回调
RequestService.clearRequestTime();
if (errorCallback) {
errorCallback(res);
} else {
callback(res);
}
})
.networkFail((err) => {
console.error('上传失败:', err);
RequestService.reAjaxFun(() => {
this.cloneAudio(params, callback);
this.cloneAudio(params, callback, errorCallback);
});
}).send();
}
@@ -360,13 +360,16 @@ export default {
}
}
} catch (error) {
// 出错时更新状态为训练失败
this.updateRowStatus(row, 3);
console.error('处理响应时出错:', error);
this.$message.error('处理响应时出错');
} finally {
row._submitting = false;
this.fetchVoiceCloneList();
}
}, (error) => {
// 出错时更新状态为训练失败
this.updateRowStatus(row, 3);
console.error('API调用失败:', error);
// 尝试从错误信息中提取状态码
let statusCode = null;
@@ -379,9 +382,10 @@ export default {
this.updateRowStatus(row, 3, statusCode);
this.$message.error('请求失败');
row._submitting = false;
this.fetchVoiceCloneList();
});
} catch (error) {
// 出错时更新状态为训练失败
this.updateRowStatus(row, 3);
console.error('调用API时出错:', error);
// 尝试从错误信息中提取状态码
let statusCode = null;
@@ -394,7 +398,6 @@ export default {
this.updateRowStatus(row, 3, statusCode);
this.$message.error('调用API时出错');
row._submitting = false;
this.fetchVoiceCloneList();
}
},