From 214c1f0f371b8f7e6a8be075f54c545922a15411 Mon Sep 17 00:00:00 2001
From: shenaowei <450702724@qq.com>
Date: Wed, 25 Feb 2026 14:56:39 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E9=9D=A2=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/app/web-gold/src/views/kling/IdentifyFace.vue | 10 +++++++++-
.../src/views/kling/hooks/useDigitalHumanGeneration.ts | 9 +++++++++
.../src/views/kling/hooks/useIdentifyFaceController.ts | 6 ++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/frontend/app/web-gold/src/views/kling/IdentifyFace.vue b/frontend/app/web-gold/src/views/kling/IdentifyFace.vue
index bd30c471e6..a346f7eb4d 100644
--- a/frontend/app/web-gold/src/views/kling/IdentifyFace.vue
+++ b/frontend/app/web-gold/src/views/kling/IdentifyFace.vue
@@ -131,7 +131,14 @@
-
+
{{ videoState.videoFile?.name }}
@@ -262,6 +269,7 @@ const {
handleSelectFromLibrary,
handleVideoSelect,
handleVideoLoaded,
+ handleVideoError,
replaceVideo,
// UI 辅助方法
diff --git a/frontend/app/web-gold/src/views/kling/hooks/useDigitalHumanGeneration.ts b/frontend/app/web-gold/src/views/kling/hooks/useDigitalHumanGeneration.ts
index e9e2c107e6..1d869d0f62 100644
--- a/frontend/app/web-gold/src/views/kling/hooks/useDigitalHumanGeneration.ts
+++ b/frontend/app/web-gold/src/views/kling/hooks/useDigitalHumanGeneration.ts
@@ -59,6 +59,11 @@ export function useDigitalHumanGeneration() {
return
}
+ // 释放旧的 blob URL
+ if (videoState.value.uploadedVideo && videoState.value.uploadedVideo.startsWith('blob:')) {
+ URL.revokeObjectURL(videoState.value.uploadedVideo)
+ }
+
videoState.value.videoFile = file
videoState.value.uploadedVideo = URL.createObjectURL(file)
videoState.value.selectedVideo = null
@@ -119,6 +124,10 @@ export function useDigitalHumanGeneration() {
}
function resetVideoState(): void {
+ // 释放 blob URL 避免内存泄漏
+ if (videoState.value.uploadedVideo && videoState.value.uploadedVideo.startsWith('blob:')) {
+ URL.revokeObjectURL(videoState.value.uploadedVideo)
+ }
videoState.value.uploadedVideo = ''
videoState.value.videoFile = null
videoState.value.selectedVideo = null
diff --git a/frontend/app/web-gold/src/views/kling/hooks/useIdentifyFaceController.ts b/frontend/app/web-gold/src/views/kling/hooks/useIdentifyFaceController.ts
index 245b0c1d97..7db2894f0c 100644
--- a/frontend/app/web-gold/src/views/kling/hooks/useIdentifyFaceController.ts
+++ b/frontend/app/web-gold/src/views/kling/hooks/useIdentifyFaceController.ts
@@ -290,6 +290,11 @@ export function useIdentifyFaceController() {
digitalHuman.videoState.value.previewVideoUrl = videoUrl
}
+ function handleVideoError(event: Event): void {
+ console.error('视频加载失败:', event)
+ message.error('视频无法播放,请尝试其他视频文件')
+ }
+
// ==================== UI 工具方法 ====================
function formatDuration(seconds: number): string {
@@ -347,6 +352,7 @@ export function useIdentifyFaceController() {
handleSelectFromLibrary,
handleVideoSelect,
handleVideoLoaded,
+ handleVideoError,
// UI 工具
formatDuration,