From 96bf48aaf5be3e4b77f831e83c810b9a1daec6f1 Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 18 Jun 2026 13:16:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=86=E9=A2=91=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=E7=AB=8B=E5=8D=B3=E6=B8=85=E9=99=A4?= =?UTF-8?q?=20pending=20=E7=8A=B6=E6=80=81=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=87=8D=E5=A4=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/input-area.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 55ec44c..5c54550 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -287,17 +287,21 @@ async function handleVideoPath(filePath: string): Promise { return; } - pendingVideoFrames = result.frames!; - pendingVideoMeta = { fileName: name, ...result.videoInfo! }; - completedVideos.push({ fileName: name, duration: result.videoInfo!.duration, frames: [...result.frames!] }); + const frameCount = result.frames!.length; + const duration = result.videoInfo!.duration; + + // 移入 completedVideos,清除 pending 状态(避免预览重复) + completedVideos.push({ fileName: name, duration, frames: [...result.frames!] }); + pendingVideoFrames = []; + pendingVideoMeta = null; // 完成:聊天区系统消息原地更新为完成 const sysMsg = document.querySelector('.sysmsg-video-progress'); if (sysMsg) { sysMsg.classList.remove('sysmsg-video-progress'); - sysMsg.textContent = `✅ ${name}: 已提取 ${pendingVideoFrames.length} 帧 (1fps 采样)`; + sysMsg.textContent = `✅ ${name}: 已提取 ${frameCount} 帧 (1fps 采样)`; } - logSuccess('✅ 视频帧提取完成', `${pendingVideoFrames.length} 帧 / ${pendingVideoMeta.duration.toFixed(1)}s (1fps)`); + logSuccess('✅ 视频帧提取完成', `${frameCount} 帧 / ${duration.toFixed(1)}s (1fps)`); renderVideoPreview(); } catch (err) { bridge.video.removeProgressListener();