From bd0fd55e9c33d6f5a3f11f9748313e2890fc378d Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 18 Jun 2026 14:48:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8B=AC=E7=AB=8B=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=A8=E8=A7=86=E9=A2=91=E5=B8=A7=E4=B9=8B=E5=89=8D=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=EF=BC=8C=E6=98=8E=E7=A1=AE=20images=20=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E7=B4=A2=E5=BC=95=E8=BE=B9=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 图片: images[0] 请单独分析 - 视频帧: images[1..30] 为帧序列 - 避免模型把独立图片混入视频帧 --- src/renderer/components/input-area.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 1f73dda..025817c 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -1013,6 +1013,13 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio apiParts.push(...fileParts); logInfo('📄 文件内容已注入', `${fileParts.length} 段, 共 ${fileContents.reduce((s, f) => s + f.content.length, 0)} 字符`); } + // 独立图片(与 images 数组前 N 张对应,在视频帧之前描述) + if (pendingImages.length === 1) { + apiParts.push(`[独立图片: ${pendingImages[0].name}](images[0],请单独分析)`); + } else if (pendingImages.length > 1) { + const imgNames = pendingImages.map(img => img.name).join(', '); + apiParts.push(`[${pendingImages.length} 张独立图片: ${imgNames}](images[0..${pendingImages.length - 1}],请分别分析)`); + } let allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string }> }> = []; if (hasVideos) { if (pendingVideoMeta && pendingVideoFrames.length > 0) { @@ -1026,12 +1033,11 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio const fl = v.frames.map(f => ` ${String(f.timestampSeconds).padStart(4, ' ')}s — ${f.name}`).join('\n'); parts.push(`[视频帧序列 · ${v.name} · ${v.count}帧 · 1fps · ${v.dur.toFixed(0)}s]\n${fl}`); } + const offset = pendingImages.length; + apiParts.push(`以下 images[${offset}..${offset + allVids.reduce((s, v) => s + v.count, 0) - 1}] 为视频帧序列:`); apiParts.push(parts.join('\n\n')); apiParts.push('上述帧按时间顺序排列,帧间存在时序关系。请分析视频内容。'); } - if (pendingImages.length > 0) { - apiParts.push(pendingImages.length === 1 ? `[同时上传了图片: ${pendingImages[0].name}]` : `[同时上传了 ${pendingImages.length} 张图片]`); - } apiContentForModel = apiParts.join('\n\n'); const msg: ChatMessage = {