From 5e043e5fbb21479ce534be121a32eb738931c3d6 Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 18 Jun 2026 13:30:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=AF=8F=E4=B8=AA=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E6=8C=87=E7=A4=BA=E7=89=8C=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E2=80=94=E2=80=94=5Fvideos=20=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E9=80=90=E4=B8=AA=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/chat-area.ts | 10 ++++++---- src/renderer/components/input-area.ts | 6 +----- src/renderer/types.d.ts | 2 ++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/renderer/components/chat-area.ts b/src/renderer/components/chat-area.ts index bc53990..8048e76 100644 --- a/src/renderer/components/chat-area.ts +++ b/src/renderer/components/chat-area.ts @@ -183,11 +183,13 @@ export function appendMessageDOM(msg: ChatMessage, index: number): void { contentHtml += ''; } - if ((msg as any)._videoFrames && (msg as any)._videoFrames.length > 0) { + if ((msg as any)._videos && (msg as any)._videos.length > 0) { + for (const v of (msg as any)._videos) { + contentHtml += `
🎬 ${v.fileName} · ${v.frameCount} 帧 · 1fps
`; + } + } else if ((msg as any)._videoFrames && (msg as any)._videoFrames.length > 0) { const n = (msg as any)._videoFrames.length; - const name = (msg as any)._videoMeta?.fileName || ''; - const label = name ? `${name} · ` : ''; - contentHtml += `
🎬 ${label}${n} 帧 · 1fps
`; + contentHtml += `
🎬 ${n} 帧 · 1fps
`; } if (msg.files && msg.files.length > 0) { diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 4700030..2691014 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -1032,11 +1032,7 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio if (allVids.length > 0) { const totalFrames = allVids.flatMap(v => v.frames); msg._videoFrames = totalFrames; - msg._videoMeta = { - fileName: allVids.length === 1 ? allVids[0].name : `${allVids.length}个视频`, - duration: allVids[0].dur, - frameCount: totalFrames.length - }; + msg._videos = allVids.map(v => ({ fileName: v.name, frameCount: v.count, duration: v.dur })); } if (userFiles.length > 0) { msg.files = userFiles; diff --git a/src/renderer/types.d.ts b/src/renderer/types.d.ts index 4b7aa76..516b7c0 100644 --- a/src/renderer/types.d.ts +++ b/src/renderer/types.d.ts @@ -114,6 +114,8 @@ export interface ChatMessage { /** 视频帧数据(用于消息卡片渲染,不走 images 缩略图) */ _videoFrames?: Array<{ name: string; base64: string; timestampSeconds: number }>; _videoMeta?: { fileName: string; duration: number; frameCount: number }; + /** 多视频独立指示牌 */ + _videos?: Array<{ fileName: string; frameCount: number; duration: number }>; stopped?: boolean; toolCalls?: ToolCallRecord[]; /** 标记此消息为 LLM 压缩摘要生成 */