From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/ai/image/index/index.vue |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/src/views/ai/image/index/index.vue b/src/views/ai/image/index/index.vue
new file mode 100644
index 0000000..1550db8
--- /dev/null
+++ b/src/views/ai/image/index/index.vue
@@ -0,0 +1,114 @@
+<!-- image -->
+<template>
+  <div class="absolute inset-0 flex flex-row wh-full">
+    <div class="flex flex-col p-5 w-[390px]">
+      <div class="mb-[30px]">
+        <el-segmented
+          v-model="selectPlatform"
+          :options="platformOptions"
+          class="w-[350px] !bg-[#ececec] [--el-border-radius-base:16px] [--el-segmented-item-selected-color:#fff]"
+        />
+      </div>
+      <div class="h-full overflow-y-auto">
+        <Common
+          v-if="selectPlatform === 'common'"
+          ref="commonRef"
+          :models="models"
+          @on-draw-complete="handleDrawComplete"
+        />
+        <Dall3
+          v-if="selectPlatform === AiPlatformEnum.OPENAI"
+          ref="dall3Ref"
+          :models="models"
+          @on-draw-start="handleDrawStart"
+          @on-draw-complete="handleDrawComplete"
+        />
+        <Midjourney
+          v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY"
+          ref="midjourneyRef"
+          :models="models"
+        />
+        <StableDiffusion
+          v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
+          ref="stableDiffusionRef"
+          :models="models"
+          @on-draw-complete="handleDrawComplete"
+        />
+      </div>
+    </div>
+    <div class="flex-1 bg-white">
+      <ImageList ref="imageListRef" @on-regeneration="handleRegeneration" />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import ImageList from './components/ImageList.vue'
+import { AiPlatformEnum } from '@/views/ai/utils/constants'
+import { ImageVO } from '@/api/ai/image'
+import Dall3 from './components/dall3/index.vue'
+import Midjourney from './components/midjourney/index.vue'
+import StableDiffusion from './components/stableDiffusion/index.vue'
+import Common from './components/common/index.vue'
+import { ModelApi, ModelVO } from '@/api/ai/model/model'
+import { AiModelTypeEnum } from '@/views/ai/utils/constants'
+
+const imageListRef = ref<any>() // image 鍒楄〃 ref
+const dall3Ref = ref<any>() // dall3(openai) ref
+const midjourneyRef = ref<any>() // midjourney ref
+const stableDiffusionRef = ref<any>() // stable diffusion ref
+const commonRef = ref<any>() // stable diffusion ref
+
+// 瀹氫箟灞炴��
+const selectPlatform = ref('common') // 閫変腑鐨勫钩鍙�
+const platformOptions = [
+  {
+    label: '閫氱敤',
+    value: 'common'
+  },
+  {
+    label: 'DALL3 缁樼敾',
+    value: AiPlatformEnum.OPENAI
+  },
+  {
+    label: 'MJ 缁樼敾',
+    value: AiPlatformEnum.MIDJOURNEY
+  },
+  {
+    label: 'SD 缁樺浘',
+    value: AiPlatformEnum.STABLE_DIFFUSION
+  }
+]
+
+const models = ref<ModelVO[]>([]) // 妯″瀷鍒楄〃
+
+/** 缁樼敾 start  */
+const handleDrawStart = async (_platform: string) => {}
+
+/** 缁樼敾 complete */
+const handleDrawComplete = async (_platform: string) => {
+  await imageListRef.value.getImageList()
+}
+
+/** 閲嶆柊鐢熸垚锛氬皢鐢诲浘璇︽儏濉厖鍒板搴斿钩鍙� */
+const handleRegeneration = async (image: ImageVO) => {
+  // 鍒囨崲骞冲彴
+  selectPlatform.value = image.platform
+  // 鏍规嵁涓嶅悓骞冲彴濉厖 image
+  await nextTick()
+  if (image.platform === AiPlatformEnum.MIDJOURNEY) {
+    midjourneyRef.value.settingValues(image)
+  } else if (image.platform === AiPlatformEnum.OPENAI) {
+    dall3Ref.value.settingValues(image)
+  } else if (image.platform === AiPlatformEnum.STABLE_DIFFUSION) {
+    stableDiffusionRef.value.settingValues(image)
+  }
+  // TODO @fan锛氳矊浼� other 閲嶆柊璁剧疆涓嶈锛�
+}
+
+/** 缁勪欢鎸傝浇鐨勬椂鍊� */
+onMounted(async () => {
+  // 鑾峰彇妯″瀷鍒楄〃
+  models.value = await ModelApi.getModelSimpleList(AiModelTypeEnum.IMAGE)
+})
+</script>

--
Gitblit v1.8.0