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
4adc5677
authored
Jun 05, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】增加 action 操作
parent
1b070e72
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
src/api/ai/image/index.ts
+16
-3
src/views/ai/image/ImageTask.vue
+10
-2
src/views/ai/image/ImageTaskCard.vue
+1
-1
No files found.
src/api/ai/image/index.ts
View file @
4adc5677
...
@@ -27,6 +27,12 @@ export interface ImageMjButtonsVO {
...
@@ -27,6 +27,12 @@ export interface ImageMjButtonsVO {
style
:
number
// 样式: 2(Primary)、3(Green)
style
:
number
// 样式: 2(Primary)、3(Green)
}
}
export
interface
ImageMjActionVO
{
id
:
string
// MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
customId
:
string
// MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
}
export
interface
ImagePageReqVO
{
export
interface
ImagePageReqVO
{
pageNo
:
number
// 分页编号
pageNo
:
number
// 分页编号
pageSize
:
number
// 分页大小
pageSize
:
number
// 分页大小
...
@@ -74,12 +80,19 @@ export const ImageApi = {
...
@@ -74,12 +80,19 @@ export const ImageApi = {
drawImage
:
async
(
data
:
ImageDrawReqVO
)
=>
{
drawImage
:
async
(
data
:
ImageDrawReqVO
)
=>
{
return
await
request
.
post
({
url
:
`/ai/image/draw`
,
data
})
return
await
request
.
post
({
url
:
`/ai/image/draw`
,
data
})
},
},
// 删除
deleteImage
:
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/image/delete-my?id=
${
id
}
`
})
},
// ------------ midjourney
// midjourney - imagine
// midjourney - imagine
midjourneyImagine
:
async
(
data
:
ImageMidjourneyImagineReqVO
)
=>
{
midjourneyImagine
:
async
(
data
:
ImageMidjourneyImagineReqVO
)
=>
{
return
await
request
.
post
({
url
:
`/ai/image/midjourney/imagine`
,
data
})
return
await
request
.
post
({
url
:
`/ai/image/midjourney/imagine`
,
data
})
},
},
//
删除
//
midjourney - action
deleteImage
:
async
(
id
:
number
)
=>
{
midjourneyAction
:
async
(
params
:
ImageMjActionVO
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/image/delete-my?id=
${
id
}
`
})
return
await
request
.
get
({
url
:
`/ai/image/midjourney/action`
,
params
})
},
},
}
}
src/views/ai/image/ImageTask.vue
View file @
4adc5677
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
/>
/>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageDetailVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
;
import
{
ImageApi
,
ImageDetailVO
,
ImageMj
ActionVO
,
ImageMj
ButtonsVO
}
from
'@/api/ai/image'
;
import
ImageDetailDrawer
from
'./ImageDetailDrawer.vue'
import
ImageDetailDrawer
from
'./ImageDetailDrawer.vue'
import
ImageTaskCard
from
'./ImageTaskCard.vue'
import
ImageTaskCard
from
'./ImageTaskCard.vue'
...
@@ -64,7 +64,15 @@ const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => {
...
@@ -64,7 +64,15 @@ const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => {
/** 图片 - mj btn click */
/** 图片 - mj btn click */
const
handlerImageMjBtnClick
=
async
(
button
:
ImageMjButtonsVO
,
imageDetail
:
ImageDetailVO
)
=>
{
const
handlerImageMjBtnClick
=
async
(
button
:
ImageMjButtonsVO
,
imageDetail
:
ImageDetailVO
)
=>
{
console
.
log
(
'mj click'
,
button
,
imageDetail
)
// 1、构建 params 参数
const
params
=
{
id
:
imageDetail
.
id
,
customId
:
button
.
customId
,
}
as
ImageMjActionVO
// 2、发送 action
await
ImageApi
.
midjourneyAction
(
params
)
// 3、刷新列表
await
getImageList
()
}
}
/** 下载 - image */
/** 下载 - image */
...
...
src/views/ai/image/ImageTaskCard.vue
View file @
4adc5677
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
</div>
</div>
<div
class=
"image-mj-btns"
>
<div
class=
"image-mj-btns"
>
<el-button
size=
"small"
v-for=
"button in imageDetail?.buttons"
:key=
"button"
<el-button
size=
"small"
v-for=
"button in imageDetail?.buttons"
:key=
"button"
style=
"width: 40px;margin-left: 0; margin-right: 10px; margin-top: 5px;"
style=
"
min-
width: 40px;margin-left: 0; margin-right: 10px; margin-top: 5px;"
@
click=
"handlerMjBtnClick(button)"
@
click=
"handlerMjBtnClick(button)"
>
>
{{
button
.
label
}}{{
button
.
emoji
}}
{{
button
.
label
}}{{
button
.
emoji
}}
...
...
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