From 5251319efb5d72f1de684a21f8c4af2d453257b1 Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 18 Jun 2026 12:41:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20startsWith=20=E2=86=92=20includes?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=96=87=E5=AD=97=E5=90=8E=E8=A7=86=E9=A2=91=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/chat-area.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/chat-area.ts b/src/renderer/components/chat-area.ts index 87deb9c..1cc36cb 100644 --- a/src/renderer/components/chat-area.ts +++ b/src/renderer/components/chat-area.ts @@ -150,10 +150,10 @@ export function appendMessageDOM(msg: ChatMessage, index: number): void { let safeContent = (msg.content != null) ? String(msg.content) : ''; // 视频消息:折叠帧列表,只显示摘要 - if (safeContent.startsWith('[视频帧序列')) { - const lines = safeContent.split('\n'); - const header = lines[0]; // "[视频帧序列 · 30帧 · 1fps · 30s]" - safeContent = header; + const isVideoMsg = safeContent.includes('[视频帧序列'); + if (isVideoMsg) { + const idx = safeContent.indexOf('[视频帧序列'); + safeContent = safeContent.slice(0, idx) + safeContent.slice(idx).split('\n')[0]; } if (msg.role === 'assistant') { @@ -184,7 +184,7 @@ export function appendMessageDOM(msg: ChatMessage, index: number): void { if (msg.images && msg.images.length > 0) { // 视频帧序列:不逐帧渲染缩略图,只显示视频指示 - const isVideo = msg.content?.startsWith('[视频帧序列'); + const isVideo = msg.content?.includes('[视频帧序列'); if (isVideo) { const frameCount = msg.images.length; contentHtml += `
🎬 视频帧序列 · ${frameCount} 帧 · 1fps
`;