From d4e121247931560c5581b03f206ec04beda946d3 Mon Sep 17 00:00:00 2001 From: LeafYeeXYZ Date: Sat, 20 Apr 2024 13:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=87=8D=E5=A4=8D=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Prompt.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/Prompt.jsx b/src/components/Prompt.jsx index 6b65a3f..caa83cd 100644 --- a/src/components/Prompt.jsx +++ b/src/components/Prompt.jsx @@ -60,6 +60,8 @@ function Prompt({ children, images, setImages, dialogAction, zhMode, status }) { if (blob.size < 1024) throw { title: '生成失败', message: '服务端返回空白图片, 可能是服务器错误或提示词不当', deleteLoading: true, self: true } // 获取图片 Hash const hash = await getHash(blob) + // 如果 hash 重复, 不添加图片 + if (images.some(image => image.hash === hash)) throw { title: '生成失败', message: '服务端返回相同的图片, 请修改提示词或换一个模型', deleteLoading: true, self: true } // 转换为 base64 const base64 = await blobToBase64(blob) // 移除加载图片, 并更新图片列表