From ec0722170edf22f92769d2b6794a226ee6f06a84 Mon Sep 17 00:00:00 2001 From: thzxx Date: Thu, 18 Jun 2026 13:59:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20apiContentForModel=20=E7=B4=AF=E7=A7=AF?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=86=85=E5=AE=B9=E2=80=94=E2=80=94=E6=96=87?= =?UTF-8?q?=E5=AD=97+=E6=96=87=E4=BB=B6+=E8=A7=86=E9=A2=91=E5=B8=A7+?= =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=8F=AA=E5=8F=91?= =?UTF-8?q?=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/input-area.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 2691014..97fb6c2 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -1001,7 +1001,13 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio } const displayContent = displayParts.join('\n'); - // Ollama API 用的完整描述(视频带帧序列) + // Ollama API 用的完整描述(文字 + 文件 + 视频帧序列 + 图片提示) + const apiParts: string[] = []; + if (text) apiParts.push(text); + if (userFiles.length > 0) { + const fileContents = pendingFiles.map(f => ({ language: f.language, content: f.content })); + apiParts.push(...buildFileContentParts(fileContents)); + } let allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string }> }> = []; if (hasVideos) { if (pendingVideoMeta && pendingVideoFrames.length > 0) { @@ -1015,13 +1021,13 @@ 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}`); } - apiContentForModel = (text || '') + '\n\n' + parts.join('\n\n') + '\n\n上述帧按时间顺序排列,帧间存在时序关系。请分析视频内容。'; - if (pendingImages.length > 0) { - apiContentForModel += `\n\n[同时上传了 ${pendingImages.length} 张图片]`; - } - } else if (displayContent) { - apiContentForModel = displayContent; + 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 = { role: 'user',