|
@@ -8,18 +8,23 @@
|
|
|
<div class="modal-switch-container">
|
|
|
<Dall3
|
|
|
v-if="selectPlatform === AiPlatformEnum.OPENAI"
|
|
|
+ ref="dall3Ref"
|
|
|
@on-draw-start="handlerDrawStart"
|
|
|
@on-draw-complete="handlerDrawComplete"
|
|
|
/>
|
|
|
- <Midjourney v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY" />
|
|
|
+ <Midjourney
|
|
|
+ v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY"
|
|
|
+ ref="midjourneyRef"
|
|
|
+ />
|
|
|
<StableDiffusion
|
|
|
v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
|
|
|
+ ref="stableDiffusionRef"
|
|
|
@on-draw-complete="handlerDrawComplete"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="main">
|
|
|
- <ImageTask ref="imageTaskRef" />
|
|
|
+ <ImageTask ref="imageTaskRef" @on-regeneration="handlerRegeneration" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -31,8 +36,13 @@ import Midjourney from './midjourney/index.vue'
|
|
|
import StableDiffusion from './stable-diffusion/index.vue'
|
|
|
import ImageTask from './ImageTask.vue'
|
|
|
import { AiPlatformEnum } from '@/views/ai/utils/constants'
|
|
|
+import {ImageVO} from "@/api/ai/image";
|
|
|
+
|
|
|
|
|
|
const imageTaskRef = ref<any>() // image task ref
|
|
|
+const dall3Ref = ref<any>() // image task ref
|
|
|
+const midjourneyRef = ref<any>() // image task ref
|
|
|
+const stableDiffusionRef = ref<any>() // image task ref
|
|
|
|
|
|
// 定义属性
|
|
|
const selectPlatform = ref('StableDiffusion')
|
|
@@ -64,6 +74,28 @@ const handlerDrawComplete = async (type) => {
|
|
|
// todo
|
|
|
await imageTaskRef.value.getImageList()
|
|
|
}
|
|
|
+
|
|
|
+/** 绘画 - 重新生成 */
|
|
|
+const handlerRegeneration = async (imageDetail: ImageVO) => {
|
|
|
+ // 切换平台
|
|
|
+ selectPlatform.value = imageDetail.platform
|
|
|
+
|
|
|
+ // 根据不同平台填充 imageDetail
|
|
|
+ if (imageDetail.platform === AiPlatformEnum.MIDJOURNEY) {
|
|
|
+ await nextTick(async () => {
|
|
|
+ midjourneyRef.value.settingValues(imageDetail)
|
|
|
+ })
|
|
|
+ } else if (imageDetail.platform === AiPlatformEnum.OPENAI) {
|
|
|
+ await nextTick(async () => {
|
|
|
+ dall3Ref.value.settingValues(imageDetail)
|
|
|
+ })
|
|
|
+ } else if (imageDetail.platform === AiPlatformEnum.STABLE_DIFFUSION) {
|
|
|
+ await nextTick(async () => {
|
|
|
+ stableDiffusionRef.value.settingValues(imageDetail)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|