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
2ae7838a
authored
May 27, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】Dall 增加 style 选择
parent
fd4ef4b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
3 deletions
+88
-3
src/views/ai/image/dall3/index.vue
+88
-3
No files found.
src/views/ai/image/dall3/index.vue
View file @
2ae7838a
...
@@ -50,6 +50,26 @@
...
@@ -50,6 +50,26 @@
</div>
</div>
</el-space>
</el-space>
</div>
</div>
<div
class=
"image-style"
>
<div>
<el-text
tag=
"b"
>
样式
</el-text>
</div>
<el-space
wrap
class=
"image-style-list"
>
<div
:class=
"selectImageStyle === imageStyle ? 'image-style-item selectImageStyle' : 'image-style-item'"
v-for=
"imageStyle in imageStyleList"
:key=
"imageStyle"
>
<el-image
:src=
"imageStyle.image"
fit=
"contain"
@
click=
"handlerStyleClick(imageStyle)"
/>
<div
class=
"style-font"
>
{{
imageStyle
.
name
}}
</div>
</div>
</el-space>
</div>
<div
class=
"image-size"
>
<div
class=
"image-size"
>
<div>
<div>
<el-text
tag=
"b"
>
尺寸
</el-text>
<el-text
tag=
"b"
>
尺寸
</el-text>
...
@@ -72,6 +92,7 @@
...
@@ -72,6 +92,7 @@
</div>
</div>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageDallReqVO
}
from
'@/api/ai/image'
;
// image 模型
// image 模型
interface
ImageModelVO
{
interface
ImageModelVO
{
...
@@ -90,10 +111,24 @@ interface ImageSizeVO {
...
@@ -90,10 +111,24 @@ interface ImageSizeVO {
const
prompt
=
ref
<
string
>
(
''
)
// 提示词
const
prompt
=
ref
<
string
>
(
''
)
// 提示词
const
selectHotWord
=
ref
<
string
>
(
''
)
// 选中的热词
const
selectHotWord
=
ref
<
string
>
(
''
)
// 选中的热词
const
hotWords
=
ref
<
string
[]
>
([
'中国旗袍'
,
'古装美女'
,
'卡通头像'
,
'机甲战士'
,
'童话小屋'
,
'中国长城'
])
// 热词
const
hotWords
=
ref
<
string
[]
>
([
'中国旗袍'
,
'古装美女'
,
'卡通头像'
,
'机甲战士'
,
'童话小屋'
,
'中国长城'
])
// 热词
const
selectModel
=
ref
<
any
>
()
//
选中的热词
const
selectModel
=
ref
<
any
>
()
//
模型
const
models
=
ref
<
ImageModelVO
[]
>
([
const
models
=
ref
<
ImageModelVO
[]
>
([
{
{
key
:
'qinxi'
,
key
:
'dall2'
,
name
:
'dall2'
,
image
:
'https://h5.cxyhub.com/images/model_1.png'
,
},
{
key
:
'dall3'
,
name
:
'dall3'
,
image
:
'https://h5.cxyhub.com/images/model_2.png'
,
},
])
// 模型
const
selectImageStyle
=
ref
<
any
>
()
// style 样式
const
imageStyleList
=
ref
<
ImageModelVO
[]
>
([
{
key
:
'qingxi'
,
name
:
'清晰'
,
name
:
'清晰'
,
image
:
'https://h5.cxyhub.com/images/model_1.png'
,
image
:
'https://h5.cxyhub.com/images/model_1.png'
,
},
},
...
@@ -148,6 +183,17 @@ const handlerModelClick = async (model: ImageModelVO) => {
...
@@ -148,6 +183,17 @@ const handlerModelClick = async (model: ImageModelVO) => {
}
}
/**
/**
* 样式 - click
*/
const
handlerStyleClick
=
async
(
imageStyle
:
ImageModelVO
)
=>
{
if
(
selectImageStyle
.
value
===
imageStyle
)
{
selectImageStyle
.
value
=
{}
as
ImageModelVO
return
}
selectImageStyle
.
value
=
imageStyle
}
/**
* size - click
* size - click
*/
*/
const
handlerSizeClick
=
async
(
imageSize
:
ImageSizeVO
)
=>
{
const
handlerSizeClick
=
async
(
imageSize
:
ImageSizeVO
)
=>
{
...
@@ -156,7 +202,6 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
...
@@ -156,7 +202,6 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
return
return
}
}
selectImageSize
.
value
=
imageSize
selectImageSize
.
value
=
imageSize
console
.
log
(
imageSize
)
}
}
/**
/**
...
@@ -164,7 +209,16 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
...
@@ -164,7 +209,16 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
*/
*/
const
handlerGenerateImage
=
async
()
=>
{
const
handlerGenerateImage
=
async
()
=>
{
// todo @范 图片生产逻辑
// todo @范 图片生产逻辑
const
form
=
{
prompt
:
prompt
.
value
,
// 提示词
model
:
selectModel
.
value
,
// 模型
style
:
selectImageStyle
.
value
,
// 图像生成的风格
size
:
selectImageSize
.
value
,
// size不能为空
}
as
ImageDallReqVO
// 发送请求
await
ImageApi
.
dall
(
form
)
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
@@ -223,6 +277,37 @@ const handlerGenerateImage = async () => {
...
@@ -223,6 +277,37 @@ const handlerGenerateImage = async () => {
}
}
//
样式
style
.image-style
{
margin-top
:
30px
;
.image-style-list
{
margin-top
:
15px
;
.image-style-item
{
width
:
110px
;
//
outline
:
1px
solid
blue
;
overflow
:
hidden
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
border
:
3px
solid
transparent
;
cursor
:
pointer
;
.style-font
{
font-size
:
14px
;
color
:
#3e3e3e
;
font-weight
:
bold
;
}
}
.selectImageStyle
{
border
:
3px
solid
#1293ff
;
border-radius
:
5px
;
}
}
}
//
尺寸
//
尺寸
.image-size
{
.image-size
{
width
:
100%
;
width
:
100%
;
...
...
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