【增加】image 增加重新生成操作(值已经完成切换,还不能完全填充值)
parent
5c560e2fbe
commit
ed786b2db6
|
@ -130,6 +130,10 @@ const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => {
|
||||||
message.success('删除成功!')
|
message.success('删除成功!')
|
||||||
} else if (type === 'download') {
|
} else if (type === 'download') {
|
||||||
await downloadImage(imageDetail.picUrl)
|
await downloadImage(imageDetail.picUrl)
|
||||||
|
} else if (type === 'regeneration') {
|
||||||
|
// Midjourney 平台
|
||||||
|
console.log('regeneration', imageDetail.id)
|
||||||
|
await emits('onRegeneration', imageDetail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +179,9 @@ const handlerPageChange = async (page) => {
|
||||||
/** 暴露组件方法 */
|
/** 暴露组件方法 */
|
||||||
defineExpose({ getImageList })
|
defineExpose({ getImageList })
|
||||||
|
|
||||||
|
// emits
|
||||||
|
const emits = defineEmits(['onRegeneration'])
|
||||||
|
|
||||||
/** 组件挂在的时候 */
|
/** 组件挂在的时候 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 获取 image 列表
|
// 获取 image 列表
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
:icon="Download"
|
:icon="Download"
|
||||||
@click="handlerBtnClick('download', imageDetail)"
|
@click="handlerBtnClick('download', imageDetail)"
|
||||||
/>
|
/>
|
||||||
|
<el-button
|
||||||
|
class="btn"
|
||||||
|
text
|
||||||
|
:icon="RefreshRight"
|
||||||
|
@click="handlerBtnClick('regeneration', imageDetail)"
|
||||||
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
class="btn"
|
class="btn"
|
||||||
text
|
text
|
||||||
|
@ -56,7 +62,7 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Delete, Download, More } from '@element-plus/icons-vue'
|
import {Delete, Download, More, RefreshRight} from '@element-plus/icons-vue'
|
||||||
import { ImageVO, ImageMjButtonsVO } from '@/api/ai/image'
|
import { ImageVO, ImageMjButtonsVO } from '@/api/ai/image'
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { ElLoading } from 'element-plus'
|
import { ElLoading } from 'element-plus'
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ImageApi, ImageDrawReqVO} from '@/api/ai/image';
|
import {ImageApi, ImageDrawReqVO, ImageVO} from '@/api/ai/image';
|
||||||
|
|
||||||
// image 模型
|
// image 模型
|
||||||
interface ImageModelVO {
|
interface ImageModelVO {
|
||||||
|
@ -257,6 +257,13 @@ const handlerGenerateImage = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 填充值 */
|
||||||
|
const settingValues = async (imageDetail: ImageVO) => {
|
||||||
|
prompt.value = imageDetail.prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 暴露组件方法 */
|
||||||
|
defineExpose({ settingValues })
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,23 @@
|
||||||
<div class="modal-switch-container">
|
<div class="modal-switch-container">
|
||||||
<Dall3
|
<Dall3
|
||||||
v-if="selectPlatform === AiPlatformEnum.OPENAI"
|
v-if="selectPlatform === AiPlatformEnum.OPENAI"
|
||||||
|
ref="dall3Ref"
|
||||||
@on-draw-start="handlerDrawStart"
|
@on-draw-start="handlerDrawStart"
|
||||||
@on-draw-complete="handlerDrawComplete"
|
@on-draw-complete="handlerDrawComplete"
|
||||||
/>
|
/>
|
||||||
<Midjourney v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY" />
|
<Midjourney
|
||||||
|
v-if="selectPlatform === AiPlatformEnum.MIDJOURNEY"
|
||||||
|
ref="midjourneyRef"
|
||||||
|
/>
|
||||||
<StableDiffusion
|
<StableDiffusion
|
||||||
v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
|
v-if="selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
|
||||||
|
ref="stableDiffusionRef"
|
||||||
@on-draw-complete="handlerDrawComplete"
|
@on-draw-complete="handlerDrawComplete"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<ImageTask ref="imageTaskRef" />
|
<ImageTask ref="imageTaskRef" @on-regeneration="handlerRegeneration" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -31,8 +36,13 @@ import Midjourney from './midjourney/index.vue'
|
||||||
import StableDiffusion from './stable-diffusion/index.vue'
|
import StableDiffusion from './stable-diffusion/index.vue'
|
||||||
import ImageTask from './ImageTask.vue'
|
import ImageTask from './ImageTask.vue'
|
||||||
import { AiPlatformEnum } from '@/views/ai/utils/constants'
|
import { AiPlatformEnum } from '@/views/ai/utils/constants'
|
||||||
|
import {ImageVO} from "@/api/ai/image";
|
||||||
|
|
||||||
|
|
||||||
const imageTaskRef = ref<any>() // image task ref
|
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')
|
const selectPlatform = ref('StableDiffusion')
|
||||||
|
@ -64,6 +74,28 @@ const handlerDrawComplete = async (type) => {
|
||||||
// todo
|
// todo
|
||||||
await imageTaskRef.value.getImageList()
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
// image 模型
|
// image 模型
|
||||||
import {ImageApi, ImageMidjourneyImagineReqVO} from "@/api/ai/image";
|
import {ImageApi, ImageMidjourneyImagineReqVO, ImageVO} from "@/api/ai/image";
|
||||||
// message
|
// message
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
// 定义 emits
|
// 定义 emits
|
||||||
|
@ -274,6 +274,14 @@ const handlerGenerateImage = async () => {
|
||||||
emits('onDrawComplete', selectModel.value.key)
|
emits('onDrawComplete', selectModel.value.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 填充值 */
|
||||||
|
const settingValues = async (imageDetail: ImageVO) => {
|
||||||
|
prompt.value = imageDetail.prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 暴露组件方法 */
|
||||||
|
defineExpose({ settingValues })
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ImageApi, ImageDrawReqVO} from '@/api/ai/image'
|
import {ImageApi, ImageDrawReqVO, ImageVO} from '@/api/ai/image'
|
||||||
|
|
||||||
// image 模型
|
// image 模型
|
||||||
interface ImageModelVO {
|
interface ImageModelVO {
|
||||||
|
@ -371,6 +371,14 @@ const handleGenerateImage = async () => {
|
||||||
drawIn.value = false
|
drawIn.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 填充值 */
|
||||||
|
const settingValues = async (imageDetail: ImageVO) => {
|
||||||
|
prompt.value = imageDetail.prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 暴露组件方法 */
|
||||||
|
defineExpose({ settingValues })
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
// 提示词
|
// 提示词
|
||||||
|
|
Loading…
Reference in New Issue