From fdfbaf65c7df9b0c12fb8abe9fc2a9c94541c503 Mon Sep 17 00:00:00 2001 From: xiao Date: Fri, 19 Jun 2026 21:33:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BE=E7=89=87=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E4=B8=8D=E5=86=8D=E8=AF=AF=E5=AF=BC?= =?UTF-8?q?=20Claude?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 图片下载/解析失败后 images 为空,但 prompt 仍默认成「请分析这张图片」, Claude 会对着一张不存在的图瞎猜。 - 图片失败且有文字:提示图片没收到,只按文字内容处理 - 图片失败且无文字:提示用户重发,恢复 idle 状态并退出,不调用 Claude --- src/main.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.ts b/src/main.ts index e0bb69b..5b1f95a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -478,6 +478,18 @@ async function sendToClaude( } } + // 图片下载/解析失败:明确告知用户,不要用「请分析这张图片」让 Claude 对着不存在的图瞎猜 + if (imageItem && !images) { + if (userText) { + await sender.sendText(fromUserId, contextToken, '⚠️ 图片接收失败,我先按你的文字内容处理;图片可以重发一次。'); + } else { + await sender.sendText(fromUserId, contextToken, '⚠️ 图片接收失败,请重新发送一次。'); + session.state = 'idle'; + sessionStore.save(account.accountId, session); + return; + } + } + // Download file if present let prompt = userText || '请分析这张图片'; if (fileItem) {