Skip to content

Commit

Permalink
新增服务端返回重复图片的提示
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed Apr 20, 2024
1 parent ec476ab commit d4e1212
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Prompt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
// 移除加载图片, 并更新图片列表
Expand Down

0 comments on commit d4e1212

Please sign in to comment.