Skip to content

Commit 4adc567

Browse files
committed
【增加】增加 action 操作
1 parent 1b070e7 commit 4adc567

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

src/api/ai/image/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export interface ImageMjButtonsVO {
2727
style: number // 样式: 2(Primary)、3(Green)
2828
}
2929

30+
export interface ImageMjActionVO {
31+
id: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
32+
customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识
33+
}
34+
35+
3036
export interface ImagePageReqVO {
3137
pageNo: number // 分页编号
3238
pageSize: number // 分页大小
@@ -74,12 +80,19 @@ export const ImageApi = {
7480
drawImage: async (data: ImageDrawReqVO)=> {
7581
return await request.post({ url: `/ai/image/draw`, data })
7682
},
83+
// 删除
84+
deleteImage: async (id: number)=> {
85+
return await request.delete({ url: `/ai/image/delete-my?id=${id}`})
86+
},
87+
88+
// ------------ midjourney
89+
7790
// midjourney - imagine
7891
midjourneyImagine: async (data: ImageMidjourneyImagineReqVO)=> {
7992
return await request.post({ url: `/ai/image/midjourney/imagine`, data })
8093
},
81-
// 删除
82-
deleteImage: async (id: number)=> {
83-
return await request.delete({ url: `/ai/image/delete-my?id=${id}`})
94+
// midjourney - action
95+
midjourneyAction: async (params: ImageMjActionVO)=> {
96+
return await request.get({ url: `/ai/image/midjourney/action`, params })
8497
},
8598
}

src/views/ai/image/ImageTask.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/>
1717
</template>
1818
<script setup lang="ts">
19-
import {ImageApi, ImageDetailVO, ImageMjButtonsVO} from '@/api/ai/image';
19+
import {ImageApi, ImageDetailVO, ImageMjActionVO, ImageMjButtonsVO} from '@/api/ai/image';
2020
import ImageDetailDrawer from './ImageDetailDrawer.vue'
2121
import ImageTaskCard from './ImageTaskCard.vue'
2222
@@ -64,7 +64,15 @@ const handlerImageBtnClick = async (type, imageDetail: ImageDetailVO) => {
6464
6565
/** 图片 - mj btn click */
6666
const handlerImageMjBtnClick = async (button: ImageMjButtonsVO, imageDetail: ImageDetailVO) => {
67-
console.log('mj click', button, imageDetail)
67+
// 1、构建 params 参数
68+
const params = {
69+
id: imageDetail.id,
70+
customId: button.customId,
71+
} as ImageMjActionVO
72+
// 2、发送 action
73+
await ImageApi.midjourneyAction(params)
74+
// 3、刷新列表
75+
await getImageList()
6876
}
6977
7078
/** 下载 - image */

src/views/ai/image/ImageTaskCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222
<div class="image-mj-btns">
2323
<el-button size="small" v-for="button in imageDetail?.buttons" :key="button"
24-
style="width: 40px;margin-left: 0; margin-right: 10px; margin-top: 5px;"
24+
style="min-width: 40px;margin-left: 0; margin-right: 10px; margin-top: 5px;"
2525
@click="handlerMjBtnClick(button)"
2626
>
2727
{{ button.label }}{{ button.emoji }}

0 commit comments

Comments
 (0)