Commit dfbd75b53c529f50a6a33ff498a623c2539a8baa
1 parent
44e44dc4
修改test,增加before初始化
Showing
2 changed files
with
14 additions
and
9 deletions
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; |
| 3 | 3 | import cn.hutool.core.io.FileUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.ai.midjourney.MidjourneyConfig; |
| 5 | 5 | import cn.iocoder.yudao.framework.ai.midjourney.interactions.MjImagineInteractions; |
| 6 | +import org.junit.Before; | |
| 6 | 7 | import org.junit.Test; |
| 7 | 8 | |
| 8 | 9 | import java.io.File; |
| ... | ... | @@ -18,16 +19,20 @@ import java.util.Map; |
| 18 | 19 | */ |
| 19 | 20 | public class MjTests { |
| 20 | 21 | |
| 21 | - @Test | |
| 22 | - public void mjImage() { | |
| 23 | - String token = "NTY5MDY4NDAxNzEyOTU1Mzky.G4-Fu0.MzD-7ll-ElbXTTgDPHF-WS_UyhMAfbKN3WyyBc"; | |
| 22 | + private MidjourneyConfig midjourneyConfig; | |
| 23 | + @Before | |
| 24 | + public void setup() { | |
| 25 | + String token = "OTcwNDc3NzQxMjUyMTY5NzI4.GJcVxa.VrzMii8dsHOJAPZn4Mw8GuEo7_nIUJij9JIHD4"; | |
| 24 | 26 | Map<String, String> requestTemplates = new HashMap<>(); |
| 25 | 27 | List<File> files = FileUtil.loopFiles("/Users/fansili/projects/github/ruoyi-vue-pro/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body"); |
| 26 | 28 | for (File file : files) { |
| 27 | 29 | requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file)); |
| 28 | 30 | } |
| 29 | - MidjourneyConfig midjourneyConfig = new MidjourneyConfig( | |
| 30 | - token, "1221445697157468200", "1221445862962630706", requestTemplates); | |
| 31 | + this.midjourneyConfig = new MidjourneyConfig(token, "1225414986084388926", "1225414986587832385", requestTemplates); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Test | |
| 35 | + public void mjImage() { | |
| 31 | 36 | MjImagineInteractions mjImagineInteractions = new MjImagineInteractions(midjourneyConfig); |
| 32 | 37 | mjImagineInteractions.execute("童话里应该是什么样子?"); |
| 33 | 38 | } | ... | ... |
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; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.FileUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.ai.midjourney.MidjourneyConfig; |
| 5 | -import cn.iocoder.yudao.framework.ai.midjourney.demo.wss.user.MjMessageListener; | |
| 6 | -import cn.iocoder.yudao.framework.ai.midjourney.demo.wss.user.MjWebSocketStarter; | |
| 5 | +import cn.iocoder.yudao.framework.ai.midjourney.webSocket.listener.MjMessageListener; | |
| 6 | +import cn.iocoder.yudao.framework.ai.midjourney.webSocket.MjWebSocketStarter; | |
| 7 | 7 | import org.junit.Before; |
| 8 | 8 | import org.junit.Test; |
| 9 | 9 | |
| ... | ... | @@ -23,13 +23,13 @@ public class MjWebSocketTests { |
| 23 | 23 | |
| 24 | 24 | @Before |
| 25 | 25 | public void setup() { |
| 26 | - String token = "OTcwNDc3NzQxMjUyMTY5NzI4.GJcVxa.VrzMii8dsHOJAPZn4Mw8GuEo7_nIUJij9JIHD4"; | |
| 26 | + String token = "OTcyNzIxMzA0ODkxNDUzNDUw.G_vMOz.BO_Q0sXAD80u5ZKIHPNYDTRX_FgeKL3cKFc53I"; | |
| 27 | 27 | Map<String, String> requestTemplates = new HashMap<>(); |
| 28 | 28 | List<File> files = FileUtil.loopFiles("/Users/fansili/projects/github/ruoyi-vue-pro/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body"); |
| 29 | 29 | for (File file : files) { |
| 30 | 30 | requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file)); |
| 31 | 31 | } |
| 32 | - this.midjourneyConfig = new MidjourneyConfig(token, "1225414986084388926", "1225414986587832385", requestTemplates); | |
| 32 | + this.midjourneyConfig = new MidjourneyConfig(token, "1225608134878302329", "1225608134878302332", requestTemplates); | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | @Test | ... | ... |