feat: 优化

This commit is contained in:
2026-02-24 23:58:17 +08:00
parent caa69d7353
commit cfaf8cab49
8 changed files with 754 additions and 609 deletions

View File

@@ -90,17 +90,13 @@ export function getLipSyncTask(taskId) {
* 识别已上传的视频
*/
export async function identifyUploadedVideo(videoFile) {
try {
const urlRes = await MaterialService.getVideoPlayUrl(videoFile.fileId)
if (urlRes.code !== 0 || !urlRes.data) {
throw new Error(urlRes.msg || '获取播放链接失败')
}
const identifyData = await performFaceIdentification(urlRes.data)
return buildIdentifyResponse(videoFile.id, urlRes.data, identifyData, false)
} catch (error) {
throw error
const urlRes = await MaterialService.getVideoPlayUrl(videoFile.fileId)
if (urlRes.code !== 0 || !urlRes.data) {
throw new Error(urlRes.msg || '获取播放链接失败')
}
const identifyData = await performFaceIdentification(urlRes.data)
return buildIdentifyResponse(videoFile.id, urlRes.data, identifyData, false)
}
/**
@@ -109,23 +105,19 @@ export async function identifyUploadedVideo(videoFile) {
export async function uploadAndIdentifyVideo(file) {
const coverBase64 = await extractVideoCoverOptional(file)
try {
const uploadRes = await MaterialService.uploadFile(file, 'video', coverBase64, null, null)
if (uploadRes.code !== 0) {
throw new Error(uploadRes.msg || '上传失败')
}
const fileId = uploadRes.data
const urlRes = await MaterialService.getVideoPlayUrl(fileId)
if (urlRes.code !== 0) {
throw new Error(urlRes.msg || '获取播放链接失败')
}
const identifyData = await performFaceIdentification(urlRes.data)
return buildIdentifyResponse(fileId, urlRes.data, identifyData, true)
} catch (error) {
throw error
const uploadRes = await MaterialService.uploadFile(file, 'digital_human', coverBase64, null, null)
if (uploadRes.code !== 0) {
throw new Error(uploadRes.msg || '上传失败')
}
const fileId = uploadRes.data
const urlRes = await MaterialService.getVideoPlayUrl(fileId)
if (urlRes.code !== 0) {
throw new Error(urlRes.msg || '获取播放链接失败')
}
const identifyData = await performFaceIdentification(urlRes.data)
return buildIdentifyResponse(fileId, urlRes.data, identifyData, true)
}