From 864057c9cd259a6b60dc1184a063bf40d8467bb4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 12 Jan 2026 12:20:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E7=94=9F=E5=9B=BE=E6=A8=A1=E5=9E=8B=E5=8D=A0=E4=BD=8D=E5=9B=BE?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 isAlibabaImageModel 添加到图片模型判断逻辑中 - 更新 hasImageContent 检测逻辑,支持多种图片格式 - 添加 isAlibabaImageModel 到 useEffect 依赖数组 --- components/messages.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/components/messages.tsx b/components/messages.tsx index b51458be2..1d165be9c 100644 --- a/components/messages.tsx +++ b/components/messages.tsx @@ -147,9 +147,13 @@ function PureMessages({ }); } - // 对于图片模型,检查是否有图片内容(包含 ![thumb| 标记) + // 对于图片模型,检查是否有图片内容(包含 ![thumb| 或 ![thumb||| 标记) const hasImageContent = lastMessage?.parts && lastMessage.parts.some( - (part: any) => part.type === "text" && part.text && part.text.includes("![thumb|") + (part: any) => part.type === "text" && part.text && ( + part.text.includes("![thumb|") || + part.text.includes("![thumb|||") || + part.text.includes("![Generated Image") + ) ); // 对于其他模型,检查是否有实际的文本内容 @@ -157,18 +161,21 @@ function PureMessages({ (part: any) => part.type === "text" && part.text && part.text.trim().length > 0 ); + // 判断是否是图片生成模型(包括 Gemini、火山、阿里) + const isImageGenModel = isGeminiModel || isVolcanoVisionModel || isAlibabaImageModel; + // 根据模型类型判断是否有有效内容 let hasContent = false; if (isQianwenVideoModel || isVideoModel) { hasContent = hasVideoContent ?? false; // 视频模型:只有真正的视频才算有内容 - } else if (isGeminiModel || isVolcanoVisionModel) { + } else if (isImageGenModel) { hasContent = hasImageContent ?? false; // 图片模型:只有图片才算有内容 } else { hasContent = hasTextContent ?? false; // 其他模型:任何文本都算有内容 } // 根据模型类型设置延迟时间(视频模型 60 秒,图片模型 4 秒,其他 6 秒) - const delayTime = (isQianwenVideoModel || isVideoModel) ? 60000 : (isGeminiModel || isVolcanoVisionModel) ? 4000 : 6000; + const delayTime = (isQianwenVideoModel || isVideoModel) ? 60000 : isImageGenModel ? 4000 : 6000; // 如果是 submitted 状态,立即显示 if (status === "submitted") { @@ -190,7 +197,7 @@ function PureMessages({ else { setShowThinkingWithDelay(false); } - }, [status, messages, isGeminiModel, isQianwenVideoModel, isVolcanoVisionModel, isVideoModel]); + }, [status, messages, isGeminiModel, isQianwenVideoModel, isVolcanoVisionModel, isVideoModel, isAlibabaImageModel]); // 🆕 监听新消息添加,当用户发送带图片的消息或添加加载消息时,强制滚动到底部 const prevMessagesLengthRef = useRef(messages.length);