From 6099c2ad2133422291078dc59e004112980087a3 Mon Sep 17 00:00:00 2001 From: thzxx Date: Sat, 20 Jun 2026 14:58:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20/retry=20=E4=B8=A2=E5=A4=B1=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=B8=A7=E5=92=8C=E6=96=87=E4=BB=B6=E9=99=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E9=87=8D=E8=AF=95=E6=97=B6=E5=AE=8C=E6=95=B4=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/input-area.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 6675640..90aecf9 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -482,7 +482,7 @@ async function handleRetry(): Promise { const fileParts = buildFileContentParts(m._fileContents); content = content ? content + '\n\n---\n' + fileParts.join('\n\n---\n') : fileParts.join('\n\n---\n'); } - return { role: m.role, content, ...(m.images?.length && { images: m.images }) }; + return { role: m.role, content, ...(m.images?.length && { images: m.images }), ...((m as any)._videoFrames?.length && { images: [...(m.images || []), ...(m as any)._videoFrames.map((f: any) => f.base64)] }) }; }); let retryMonitor: ReturnType | null = null; @@ -492,13 +492,24 @@ async function handleRetry(): Promise { let retryThinkContent = ''; let retryIterations = 0; + // 构建重试用的完整内容和 images(含文件内容和视频帧) + let retryUserContent = userMsg.content || ''; + const retryImages: string[] = [...(userMsg.images || [])]; + if ((userMsg as any)._fileContents?.length) { + const fileParts = buildFileContentParts((userMsg as any)._fileContents); + retryUserContent = retryUserContent ? retryUserContent + '\n\n---\n' + fileParts.join('\n\n---\n') : fileParts.join('\n\n---\n'); + } + if ((userMsg as any)._videoFrames?.length) { + retryImages.push(...(userMsg as any)._videoFrames.map((f: any) => f.base64)); + } + // ── 监控定时器 ── retryMonitor = setInterval(() => { if (!hasActiveCards()) { showWorkingHint('⏳ AI 正在处理中...'); } }, 2000); - await runAgentLoop(userMsg.content || '', userMsg.images || [], historyMessages, { + await runAgentLoop(retryUserContent, retryImages, historyMessages, { onToolCallPrepare: (call) => { addToolCard({ name: call.function.name, arguments: call.function.arguments,