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 = {