From b77e8f16e9e8948a05ee332a59cb433d00f7cf08 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 4 Apr 2024 19:38:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20mj=20Imagine=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/ai/image/MjTests.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java 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 new file mode 100644 index 000000000..df8fea90d --- /dev/null +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/image/MjTests.java @@ -0,0 +1,34 @@ +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.Test; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * mj + * + * author: fansili + * time: 2024/4/4 18:59 + */ +public class MjTests { + + @Test + public void mjImage() { + String token = "NTY5MDY4NDAxNzEyOTU1Mzky.G4-Fu0.MzD-7ll-ElbXTTgDPHF-WS_UyhMAfbKN3WyyBc"; + 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); + MjImagineInteractions mjImagineInteractions = new MjImagineInteractions(midjourneyConfig); + mjImagineInteractions.execute("童话里应该是什么样子?"); + } +}