Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8f6e6fdb
authored
Jul 04, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【优化】hasChinese 抽离 utils
parent
ed786b2d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
src/views/ai/image/stable-diffusion/index.vue
+1
-5
src/views/ai/utils/common-utils.ts
+13
-0
No files found.
src/views/ai/image/stable-diffusion/index.vue
View file @
8f6e6fdb
...
...
@@ -121,6 +121,7 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageDrawReqVO
,
ImageVO
}
from
'@/api/ai/image'
import
{
hasChinese
}
from
'../../utils/common-utils'
// image 模型
interface
ImageModelVO
{
...
...
@@ -329,11 +330,6 @@ const handleHotWordClick = async (hotWord: string) => {
prompt
.
value
=
hotWord
}
/** 判断字符串是否包含中文 */
function
hasChinese
(
str
)
{
return
/
[\u
4E00-
\u
9FA5
]
+/g
.
test
(
str
)
}
/** 图片生产 */
const
handleGenerateImage
=
async
()
=>
{
// 二次确认
...
...
src/views/ai/utils/common-utils.ts
0 → 100644
View file @
8f6e6fdb
/**
* Created by 芋道源码
*
* AI 枚举类
*
* 问题:为什么不放在 src/utils/common-utils.ts 呢?
* 回答:主要 AI 是可选模块,考虑到独立、解耦,所以放在了 /views/ai/utils/common-utils.ts
*/
/** 判断字符串是否包含中文 */
export
const
hasChinese
=
async
(
str
)
=>
{
return
/
[\u
4E00-
\u
9FA5
]
+/g
.
test
(
str
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment