12
12
@on-draw-start =" handleDrawStart"
13
13
@on-draw-complete =" handleDrawComplete"
14
14
/>
15
- <Midjourney
16
- v-if =" selectPlatform === AiPlatformEnum.MIDJOURNEY"
17
- ref =" midjourneyRef"
18
- />
15
+ <Midjourney v-if =" selectPlatform === AiPlatformEnum.MIDJOURNEY" ref =" midjourneyRef" />
19
16
<StableDiffusion
20
17
v-if =" selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
21
18
ref =" stableDiffusionRef"
24
21
</div >
25
22
</div >
26
23
<div class =" main" >
27
- <ImageTask ref =" imageTaskRef " @on-regeneration =" handleRegeneration" />
24
+ <ImageList ref =" imageListRef " @on-regeneration =" handleRegeneration" />
28
25
</div >
29
26
</div >
30
27
</template >
31
28
32
29
<script setup lang="ts">
33
- // TODO @fan:在整个挪到 /views/ai/image/index 目录。因为我想在 /views/ai/image/manager 做管理的功能,进行下区分!
34
30
import Dall3 from ' ./dall3/index.vue'
35
31
import Midjourney from ' ./midjourney/index.vue'
36
32
import StableDiffusion from ' ./stable-diffusion/index.vue'
37
- import ImageTask from ' ./ImageTask .vue'
33
+ import ImageList from ' ./components/ImageList .vue'
38
34
import { AiPlatformEnum } from ' @/views/ai/utils/constants'
39
- import {ImageVO } from " @/api/ai/image" ;
40
-
35
+ import { ImageVO } from ' @/api/ai/image'
41
36
42
- const imageTaskRef = ref <any >() // image task ref
37
+ const imageListRef = ref <any >() // image 列表 ref
43
38
const dall3Ref = ref <any >() // openai ref
44
39
const midjourneyRef = ref <any >() // midjourney ref
45
40
const stableDiffusionRef = ref <any >() // stable diffusion ref
@@ -61,35 +56,27 @@ const platformOptions = [
61
56
}
62
57
]
63
58
64
- /** 绘画 - start */
65
- const handleDrawStart = async (type ) => {
66
- }
59
+ /** 绘画 start */
60
+ const handleDrawStart = async (type ) => {}
67
61
68
- /** 绘画 - complete */
62
+ /** 绘画 complete */
69
63
const handleDrawComplete = async (type ) => {
70
- await imageTaskRef .value .getImageList ()
64
+ await imageListRef .value .getImageList ()
71
65
}
72
66
73
- /** 绘画 - 重新生成 */
74
- const handleRegeneration = async (imageDetail : ImageVO ) => {
67
+ /** 重新生成:将画图详情填充到对应平台 */
68
+ const handleRegeneration = async (image : ImageVO ) => {
75
69
// 切换平台
76
- selectPlatform .value = imageDetail .platform
77
- console .log (' 切换平台' , imageDetail .platform )
78
- // 根据不同平台填充 imageDetail
79
- if (imageDetail .platform === AiPlatformEnum .MIDJOURNEY ) {
80
- await nextTick (async () => {
81
- midjourneyRef .value .settingValues (imageDetail )
82
- })
83
- } else if (imageDetail .platform === AiPlatformEnum .OPENAI ) {
84
- await nextTick (async () => {
85
- dall3Ref .value .settingValues (imageDetail )
86
- })
87
- } else if (imageDetail .platform === AiPlatformEnum .STABLE_DIFFUSION ) {
88
- await nextTick (async () => {
89
- stableDiffusionRef .value .settingValues (imageDetail )
90
- })
70
+ selectPlatform .value = image .platform
71
+ // 根据不同平台填充 image
72
+ await nextTick ()
73
+ if (image .platform === AiPlatformEnum .MIDJOURNEY ) {
74
+ midjourneyRef .value .settingValues (image )
75
+ } else if (image .platform === AiPlatformEnum .OPENAI ) {
76
+ dall3Ref .value .settingValues (image )
77
+ } else if (image .platform === AiPlatformEnum .STABLE_DIFFUSION ) {
78
+ stableDiffusionRef .value .settingValues (image )
91
79
}
92
-
93
80
}
94
81
</script >
95
82
0 commit comments