fix: 修复阿里生图模型占位图不显示的问题
- 将 isAlibabaImageModel 添加到图片模型判断逻辑中 - 更新 hasImageContent 检测逻辑,支持多种图片格式 - 添加 isAlibabaImageModel 到 useEffect 依赖数组
This commit is contained in:
parent
aba3e3a066
commit
864057c9cd
@ -147,9 +147,13 @@ function PureMessages({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对于图片模型,检查是否有图片内容(包含 ![thumb| 标记)
|
// 对于图片模型,检查是否有图片内容(包含 ![thumb| 或 ![thumb||| 标记)
|
||||||
const hasImageContent = lastMessage?.parts && lastMessage.parts.some(
|
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
|
(part: any) => part.type === "text" && part.text && part.text.trim().length > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 判断是否是图片生成模型(包括 Gemini、火山、阿里)
|
||||||
|
const isImageGenModel = isGeminiModel || isVolcanoVisionModel || isAlibabaImageModel;
|
||||||
|
|
||||||
// 根据模型类型判断是否有有效内容
|
// 根据模型类型判断是否有有效内容
|
||||||
let hasContent = false;
|
let hasContent = false;
|
||||||
if (isQianwenVideoModel || isVideoModel) {
|
if (isQianwenVideoModel || isVideoModel) {
|
||||||
hasContent = hasVideoContent ?? false; // 视频模型:只有真正的视频才算有内容
|
hasContent = hasVideoContent ?? false; // 视频模型:只有真正的视频才算有内容
|
||||||
} else if (isGeminiModel || isVolcanoVisionModel) {
|
} else if (isImageGenModel) {
|
||||||
hasContent = hasImageContent ?? false; // 图片模型:只有图片才算有内容
|
hasContent = hasImageContent ?? false; // 图片模型:只有图片才算有内容
|
||||||
} else {
|
} else {
|
||||||
hasContent = hasTextContent ?? false; // 其他模型:任何文本都算有内容
|
hasContent = hasTextContent ?? false; // 其他模型:任何文本都算有内容
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据模型类型设置延迟时间(视频模型 60 秒,图片模型 4 秒,其他 6 秒)
|
// 根据模型类型设置延迟时间(视频模型 60 秒,图片模型 4 秒,其他 6 秒)
|
||||||
const delayTime = (isQianwenVideoModel || isVideoModel) ? 60000 : (isGeminiModel || isVolcanoVisionModel) ? 4000 : 6000;
|
const delayTime = (isQianwenVideoModel || isVideoModel) ? 60000 : isImageGenModel ? 4000 : 6000;
|
||||||
|
|
||||||
// 如果是 submitted 状态,立即显示
|
// 如果是 submitted 状态,立即显示
|
||||||
if (status === "submitted") {
|
if (status === "submitted") {
|
||||||
@ -190,7 +197,7 @@ function PureMessages({
|
|||||||
else {
|
else {
|
||||||
setShowThinkingWithDelay(false);
|
setShowThinkingWithDelay(false);
|
||||||
}
|
}
|
||||||
}, [status, messages, isGeminiModel, isQianwenVideoModel, isVolcanoVisionModel, isVideoModel]);
|
}, [status, messages, isGeminiModel, isQianwenVideoModel, isVolcanoVisionModel, isVideoModel, isAlibabaImageModel]);
|
||||||
|
|
||||||
// 🆕 监听新消息添加,当用户发送带图片的消息或添加加载消息时,强制滚动到底部
|
// 🆕 监听新消息添加,当用户发送带图片的消息或添加加载消息时,强制滚动到底部
|
||||||
const prevMessagesLengthRef = useRef(messages.length);
|
const prevMessagesLengthRef = useRef(messages.length);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user