【sd】增加中文判断

pull/470/MERGE
cherishsince 2024-07-02 21:58:44 +08:00
parent 16d53bbf4b
commit 0e755acf52
1 changed files with 9 additions and 0 deletions

View File

@ -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