From 9c43594010cc7be21b02ea7b443e53b4ea784fb4 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 2 Jul 2024 21:58:14 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E3=80=90sd=E3=80=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/midjourney/index.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index 7f288747..64ab4fed 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -88,6 +88,14 @@ +
+
+ 参考图 +
+ + + +
生成内容 @@ -118,6 +126,7 @@ interface ImageSizeVO { // 定义属性 const prompt = ref('') // 提示词 +const referImage = ref() // 参考图 const selectHotWord = ref('') // 选中的热词 const hotWords = ref(['中国旗袍', '古装美女', '卡通头像', '机甲战士', '童话小屋', '中国长城']) // 热词 const selectModel = ref() // 选中的热词 @@ -247,6 +256,7 @@ const handlerGenerateImage = async () => { await message.confirm(`确认生成内容?`) // todo @范 图片生产逻辑 try { + console.log('referImage.value', referImage.value) // 回调 emits('onDrawStart', selectModel.value.key) // 发送请求 @@ -256,7 +266,7 @@ const handlerGenerateImage = async () => { width: selectImageSize.value.width, height: selectImageSize.value.height, version: selectVersion.value, - base64Array: [], + referImageUrl: referImage.value, } as ImageMidjourneyImagineReqVO await ImageApi.midjourneyImagine(req) } finally { From 16d53bbf4bde721e2975a68ebd19f662d63b079e Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 2 Jul 2024 21:58:33 +0800 Subject: [PATCH 02/21] =?UTF-8?q?Revert=20"=E3=80=90sd=E3=80=91=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=AD=E6=96=87=E5=88=A4=E6=96=AD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 47636a8a87a3f4b4d4e1bd36ca05eb65b9a66167. --- src/views/ai/image/midjourney/index.vue | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index 64ab4fed..7f288747 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -88,14 +88,6 @@
-
-
- 参考图 -
- - - -
生成内容 @@ -126,7 +118,6 @@ interface ImageSizeVO { // 定义属性 const prompt = ref('') // 提示词 -const referImage = ref() // 参考图 const selectHotWord = ref('') // 选中的热词 const hotWords = ref(['中国旗袍', '古装美女', '卡通头像', '机甲战士', '童话小屋', '中国长城']) // 热词 const selectModel = ref() // 选中的热词 @@ -256,7 +247,6 @@ const handlerGenerateImage = async () => { await message.confirm(`确认生成内容?`) // todo @范 图片生产逻辑 try { - console.log('referImage.value', referImage.value) // 回调 emits('onDrawStart', selectModel.value.key) // 发送请求 @@ -266,7 +256,7 @@ const handlerGenerateImage = async () => { width: selectImageSize.value.width, height: selectImageSize.value.height, version: selectVersion.value, - referImageUrl: referImage.value, + base64Array: [], } as ImageMidjourneyImagineReqVO await ImageApi.midjourneyImagine(req) } finally { From 0e755acf523b846cd1bf088c2f17a910983e76cd Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 2 Jul 2024 21:58:44 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E3=80=90sd=E3=80=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/stable-diffusion/index.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/views/ai/image/stable-diffusion/index.vue b/src/views/ai/image/stable-diffusion/index.vue index 15a8cf4d..bf49b83d 100644 --- a/src/views/ai/image/stable-diffusion/index.vue +++ b/src/views/ai/image/stable-diffusion/index.vue @@ -329,10 +329,19 @@ const handleHotWordClick = async (hotWord: string) => { prompt.value = hotWord } +/** 判断字符串是否包含中文 */ +function hasChinese(str) { + return /[\u4E00-\u9FA5]+/g.test(str) +} + /** 图片生产 */ const handleGenerateImage = async () => { // 二次确认 await message.confirm(`确认生成内容?`) + if (hasChinese(prompt.value)) { + message.alert('暂不支持中文!') + return + } try { // 加载中 drawIn.value = true From 5c560e2fbeeedf47190610e10714611be523a152 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 3 Jul 2024 20:21:08 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91mj=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E8=80=83=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/midjourney/index.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index 7f288747..64ab4fed 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -88,6 +88,14 @@
+
+
+ 参考图 +
+ + + +
生成内容 @@ -118,6 +126,7 @@ interface ImageSizeVO { // 定义属性 const prompt = ref('') // 提示词 +const referImage = ref() // 参考图 const selectHotWord = ref('') // 选中的热词 const hotWords = ref(['中国旗袍', '古装美女', '卡通头像', '机甲战士', '童话小屋', '中国长城']) // 热词 const selectModel = ref() // 选中的热词 @@ -247,6 +256,7 @@ const handlerGenerateImage = async () => { await message.confirm(`确认生成内容?`) // todo @范 图片生产逻辑 try { + console.log('referImage.value', referImage.value) // 回调 emits('onDrawStart', selectModel.value.key) // 发送请求 @@ -256,7 +266,7 @@ const handlerGenerateImage = async () => { width: selectImageSize.value.width, height: selectImageSize.value.height, version: selectVersion.value, - base64Array: [], + referImageUrl: referImage.value, } as ImageMidjourneyImagineReqVO await ImageApi.midjourneyImagine(req) } finally { From ed786b2db68ccaba88d132bc8b87b82eb93c85f4 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 3 Jul 2024 22:04:59 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91image?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=93=8D=E4=BD=9C(=E5=80=BC=E5=B7=B2=E7=BB=8F=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=88=87=E6=8D=A2=EF=BC=8C=E8=BF=98=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E5=A1=AB=E5=85=85=E5=80=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 7 ++++ src/views/ai/image/ImageTaskCard.vue | 8 ++++- src/views/ai/image/dall3/index.vue | 9 ++++- src/views/ai/image/index.vue | 36 +++++++++++++++++-- src/views/ai/image/midjourney/index.vue | 10 +++++- src/views/ai/image/stable-diffusion/index.vue | 10 +++++- 6 files changed, 74 insertions(+), 6 deletions(-) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index 36eb4595..9ddd7461 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -130,6 +130,10 @@ const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => { message.success('删除成功!') } else if (type === 'download') { 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 }) +// emits +const emits = defineEmits(['onRegeneration']) + /** 组件挂在的时候 */ onMounted(async () => { // 获取 image 列表 diff --git a/src/views/ai/image/ImageTaskCard.vue b/src/views/ai/image/ImageTaskCard.vue index 62ba222e..4f8525f6 100644 --- a/src/views/ai/image/ImageTaskCard.vue +++ b/src/views/ai/image/ImageTaskCard.vue @@ -25,6 +25,12 @@ :icon="Download" @click="handlerBtnClick('download', imageDetail)" /> +