File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
views/ai/image/midjourney Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,27 @@ export interface ImagePageReqVO {
23
23
pageSize : number // 分页大小
24
24
}
25
25
26
+ export interface ImageDallReqVO {
27
+ prompt : string // 提示词
28
+ model : string // 模型
29
+ style : string // 图像生成的风格
30
+ width : string // 图片宽度
31
+ height : string // 图片高度
32
+ }
33
+
26
34
export interface ImageDallReqVO {
27
35
prompt : string // 提示词
28
36
model : string // 模型
29
37
style : string // 图像生成的风格
30
38
size : string // size不能为空
31
39
}
32
40
41
+ export interface ImageMidjourneyImagineReqVO {
42
+ prompt : string // 提示词
43
+ base64Array : string [ ] // size不能为空
44
+ }
45
+
46
+
33
47
// AI API 密钥 API
34
48
export const ImageApi = {
35
49
// 获取 image 列表
@@ -44,8 +58,12 @@ export const ImageApi = {
44
58
dall : async ( data : ImageDallReqVO ) => {
45
59
return await request . post ( { url : `/ai/image/dall` , data } )
46
60
} ,
61
+ // midjourney - imagine
62
+ midjourneyImagine : async ( data : ImageMidjourneyImagineReqVO ) => {
63
+ return await request . post ( { url : `/ai/image/midjourney/imagine` , data } )
64
+ } ,
47
65
// 删除
48
66
deleteImage : async ( id : number ) => {
49
- return await request . delete ( { url : `/ai/image/delete-my?id=${ id } ` } )
67
+ return await request . delete ( { url : `/ai/image/delete-id- my?id=${ id } ` } )
50
68
} ,
51
69
}
Original file line number Diff line number Diff line change 74
74
<script setup lang="ts">
75
75
76
76
// image 模型
77
+ import {ImageApi , ImageMidjourneyImagineReqVO } from " @/api/ai/image" ;
78
+
79
+ // 定义 emits
80
+ const emits = defineEmits ([' onDrawStart' , ' onDrawComplete' ])
81
+
77
82
interface ImageModelVO {
78
83
key: string
79
84
name: string
@@ -172,6 +177,19 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
172
177
*/
173
178
const handlerGenerateImage = async () => {
174
179
// todo @范 图片生产逻辑
180
+ try {
181
+ // 回调
182
+ // emits('onDrawStart', selectModel.value.key)
183
+ // 发送请求
184
+ const req = {
185
+ prompt: prompt .value ,
186
+ base64Array: [],
187
+ } as ImageMidjourneyImagineReqVO
188
+ await ImageApi .midjourneyImagine (req )
189
+ } finally {
190
+ // 回调
191
+ // emits('onDrawComplete', selectModel.value.key)
192
+ }
175
193
}
176
194
</script >
177
195
<style scoped lang="scss">
You can’t perform that action at this time.
0 commit comments