From 0e755acf523b846cd1bf088c2f17a910983e76cd Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 2 Jul 2024 21:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90sd=E3=80=91=E5=A2=9E=E5=8A=A0=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/stable-diffusion/index.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/views/ai/image/stable-diffusion/index.vue b/src/views/ai/image/stable-diffusion/index.vue index 15a8cf4d..bf49b83d 100644 --- a/src/views/ai/image/stable-diffusion/index.vue +++ b/src/views/ai/image/stable-diffusion/index.vue @@ -329,10 +329,19 @@ const handleHotWordClick = async (hotWord: string) => { prompt.value = hotWord } +/** 判断字符串是否包含中文 */ +function hasChinese(str) { + return /[\u4E00-\u9FA5]+/g.test(str) +} + /** 图片生产 */ const handleGenerateImage = async () => { // 二次确认 await message.confirm(`确认生成内容?`) + if (hasChinese(prompt.value)) { + message.alert('暂不支持中文!') + return + } try { // 加载中 drawIn.value = true