From dfbd75b53c529f50a6a33ff498a623c2539a8baa Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 5 Apr 2024 10:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9test=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0before=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/framework/ai/image/MjTests.java | 15 ++++++++++----- .../framework/ai/image/MjWebSocketTests.java | 8 ++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java index df8fea90d..b5c434a94 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.ai.image; import cn.hutool.core.io.FileUtil; import cn.iocoder.yudao.framework.ai.midjourney.MidjourneyConfig; import cn.iocoder.yudao.framework.ai.midjourney.interactions.MjImagineInteractions; +import org.junit.Before; import org.junit.Test; import java.io.File; @@ -18,16 +19,20 @@ import java.util.Map; */ public class MjTests { - @Test - public void mjImage() { - String token = "NTY5MDY4NDAxNzEyOTU1Mzky.G4-Fu0.MzD-7ll-ElbXTTgDPHF-WS_UyhMAfbKN3WyyBc"; + private MidjourneyConfig midjourneyConfig; + @Before + public void setup() { + String token = "OTcwNDc3NzQxMjUyMTY5NzI4.GJcVxa.VrzMii8dsHOJAPZn4Mw8GuEo7_nIUJij9JIHD4"; Map requestTemplates = new HashMap<>(); List files = FileUtil.loopFiles("/Users/fansili/projects/github/ruoyi-vue-pro/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body"); for (File file : files) { requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file)); } - MidjourneyConfig midjourneyConfig = new MidjourneyConfig( - token, "1221445697157468200", "1221445862962630706", requestTemplates); + this.midjourneyConfig = new MidjourneyConfig(token, "1225414986084388926", "1225414986587832385", requestTemplates); + } + + @Test + public void mjImage() { MjImagineInteractions mjImagineInteractions = new MjImagineInteractions(midjourneyConfig); mjImagineInteractions.execute("童话里应该是什么样子?"); } diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjWebSocketTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjWebSocketTests.java index 177b7c733..786eb6570 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjWebSocketTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjWebSocketTests.java @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.ai.image; import cn.hutool.core.io.FileUtil; import cn.iocoder.yudao.framework.ai.midjourney.MidjourneyConfig; -import cn.iocoder.yudao.framework.ai.midjourney.demo.wss.user.MjMessageListener; -import cn.iocoder.yudao.framework.ai.midjourney.demo.wss.user.MjWebSocketStarter; +import cn.iocoder.yudao.framework.ai.midjourney.webSocket.listener.MjMessageListener; +import cn.iocoder.yudao.framework.ai.midjourney.webSocket.MjWebSocketStarter; import org.junit.Before; import org.junit.Test; @@ -23,13 +23,13 @@ public class MjWebSocketTests { @Before public void setup() { - String token = "OTcwNDc3NzQxMjUyMTY5NzI4.GJcVxa.VrzMii8dsHOJAPZn4Mw8GuEo7_nIUJij9JIHD4"; + String token = "OTcyNzIxMzA0ODkxNDUzNDUw.G_vMOz.BO_Q0sXAD80u5ZKIHPNYDTRX_FgeKL3cKFc53I"; Map requestTemplates = new HashMap<>(); List files = FileUtil.loopFiles("/Users/fansili/projects/github/ruoyi-vue-pro/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body"); for (File file : files) { requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file)); } - this.midjourneyConfig = new MidjourneyConfig(token, "1225414986084388926", "1225414986587832385", requestTemplates); + this.midjourneyConfig = new MidjourneyConfig(token, "1225608134878302329", "1225608134878302332", requestTemplates); } @Test