Commit 88142ed74c47e2cd555e65aed0fc78fdf247cc2a

Authored by YunaiV
1 parent 75a91a2c

【代码评审】AI:移除老版本的 MJ 接入

Showing 64 changed files with 1 additions and 4875 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/midjourneyHandler/YuDaoMidjourneyMessageHandler.java deleted
1 -package cn.iocoder.yudao.module.ai.service.image.midjourneyHandler;  
2 -  
3 -import cn.hutool.core.collection.CollUtil;  
4 -import cn.hutool.core.util.StrUtil;  
5 -import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyOperationsVO;  
6 -import cn.iocoder.yudao.module.ai.dal.dataobject.image.AiImageDO;  
7 -import cn.iocoder.yudao.module.ai.dal.mysql.image.AiImageMapper;  
8 -import cn.iocoder.yudao.module.ai.enums.image.AiImageStatusEnum;  
9 -import com.alibaba.fastjson.JSON;  
10 -import lombok.AllArgsConstructor;  
11 -import lombok.extern.slf4j.Slf4j;  
12 -import org.springframework.ai.models.midjourney.MidjourneyMessage;  
13 -import org.springframework.ai.models.midjourney.constants.MidjourneyGennerateStatusEnum;  
14 -import org.springframework.ai.models.midjourney.webSocket.MidjourneyMessageHandler;  
15 -import org.springframework.stereotype.Component;  
16 -  
17 -import java.util.List;  
18 -  
19 -/**  
20 - * yudao message handler  
21 - *  
22 - * @author fansili  
23 - * @time 2024/4/29 14:34  
24 - * @since 1.0  
25 - */  
26 -@Component  
27 -@Slf4j  
28 -@AllArgsConstructor  
29 -public class YuDaoMidjourneyMessageHandler implements MidjourneyMessageHandler {  
30 -  
31 - private final AiImageMapper aiImageMapper;  
32 -  
33 - @Override  
34 - public void messageHandler(MidjourneyMessage midjourneyMessage) {  
35 - log.info("yudao-midjourney-midjourney-message-handler {}", JSON.toJSONString(midjourneyMessage));  
36 - if (midjourneyMessage.getContent() != null) {  
37 - log.info("进度id {} 状态 {} 进度 {}",  
38 - midjourneyMessage.getNonce(),  
39 - midjourneyMessage.getGenerateStatus(),  
40 - midjourneyMessage.getContent().getProgress());  
41 - }  
42 - //  
43 - updateImage(midjourneyMessage);  
44 - }  
45 -  
46 - private void updateImage(MidjourneyMessage midjourneyMessage) {  
47 - // Nonce 不存在不更新  
48 - if (StrUtil.isBlank(midjourneyMessage.getNonce())) {  
49 - return;  
50 - }  
51 - // 根据 Embeds 来判断是否异常  
52 - if (CollUtil.isEmpty(midjourneyMessage.getEmbeds())) {  
53 - successHandler(midjourneyMessage);  
54 - } else {  
55 - errorHandler(midjourneyMessage);  
56 - }  
57 - }  
58 -  
59 - private void errorHandler(MidjourneyMessage midjourneyMessage) {  
60 - // image 编号  
61 - Long nonceId = Long.valueOf(midjourneyMessage.getNonce());  
62 - // 获取 error message  
63 - String errorMessage = getErrorMessage(midjourneyMessage);  
64 - aiImageMapper.updateByMjNonce(nonceId,  
65 - new AiImageDO()  
66 - .setErrorMessage(errorMessage)  
67 - .setStatus(AiImageStatusEnum.FAIL.getStatus())  
68 - );  
69 - }  
70 -  
71 - private String getErrorMessage(MidjourneyMessage midjourneyMessage) {  
72 - StringBuilder errorMessage = new StringBuilder();  
73 - for (MidjourneyMessage.Embed embed : midjourneyMessage.getEmbeds()) {  
74 - errorMessage.append(embed.getDescription());  
75 - }  
76 - return errorMessage.toString();  
77 - }  
78 -  
79 - private void successHandler(MidjourneyMessage midjourneyMessage) {  
80 - // 获取id  
81 - Long nonceId = Long.valueOf(midjourneyMessage.getNonce());  
82 - // TODO @芋艿 这个地方有问题,不能根据 nonce来更新,不返回这个信息(别人获取了 image-xxx-xx 后面一段hash,由于没有mj账号测试,暂不清楚。)  
83 - // 获取生成 url  
84 - String imageUrl = null;  
85 - if (CollUtil.isNotEmpty(midjourneyMessage.getAttachments())) {  
86 - imageUrl = midjourneyMessage.getAttachments().get(0).getUrl();  
87 - }  
88 - // 转换状态  
89 - AiImageStatusEnum drawingStatusEnum = null;  
90 - String generateStatus = midjourneyMessage.getGenerateStatus();  
91 - if (MidjourneyGennerateStatusEnum.COMPLETED.getStatus().equals(generateStatus)) {  
92 - drawingStatusEnum = AiImageStatusEnum.SUCCESS;  
93 - } else if (MidjourneyGennerateStatusEnum.IN_PROGRESS.getStatus().equals(generateStatus)) {  
94 - drawingStatusEnum = AiImageStatusEnum.IN_PROGRESS;  
95 - }  
96 -// else if (MidjourneyGennerateStatusEnum.WAITING.getStatus().equals(generateStatus)) {  
97 -// drawingStatusEnum = AiImageStatusEnum.WAITING;  
98 -// }  
99 - // 获取 midjourneyOperations  
100 - List<AiImageMidjourneyOperationsVO> midjourneyOperations = getMidjourneyOperationsList(midjourneyMessage);  
101 - // 更新数据库  
102 - aiImageMapper.updateByMjNonce(nonceId,  
103 - new AiImageDO()  
104 - .setStatus(drawingStatusEnum == null ? null : drawingStatusEnum.getStatus())  
105 -// .setMjNonceId(midjourneyMessage.getId())  
106 -// .setMjOperations(JsonUtils.toJsonString(midjourneyOperations))  
107 - );  
108 - }  
109 -  
110 - private List<AiImageMidjourneyOperationsVO> getMidjourneyOperationsList(MidjourneyMessage midjourneyMessage) {  
111 -// // 为空直接返回  
112 -// if (CollUtil.isEmpty(midjourneyMessage.getComponents())) {  
113 -// return Collections.emptyList();  
114 -// }  
115 -// // 将 component 转成 AiImageMidjourneyOperationsVO  
116 -// return midjourneyMessage.getComponents().stream()  
117 -// .map(componentType -> componentType.getComponents().stream()  
118 -// .map(AiImageConvert.INSTANCE::convertAiImageMidjourneyOperationsVO)  
119 -// .collect(Collectors.toList()))  
120 -// .toList().stream().flatMap(List::stream).toList();  
121 - return null;  
122 - }  
123 -}  
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/image/midjourneyHandler/typeHandler/AiChatModelConfigTypeHandler.java deleted
1 -//package cn.iocoder.yudao.module.ai.mapper.typeHandler;  
2 -//  
3 -//import cn.hutool.core.util.StrUtil;  
4 -//import cn.iocoder.yudao.framework.ai.AiPlatformEnum;  
5 -//import cn.iocoder.yudao.framework.common.util.json.JsonUtils;  
6 -//import cn.iocoder.yudao.module.ai.dal.dataobject.AiChatModalDO;  
7 -//import org.apache.ibatis.type.BaseTypeHandler;  
8 -//import org.apache.ibatis.type.JdbcType;  
9 -//import org.apache.ibatis.type.MappedTypes;  
10 -//  
11 -//import java.sql.CallableStatement;  
12 -//import java.sql.PreparedStatement;  
13 -//import java.sql.ResultSet;  
14 -//import java.sql.SQLException;  
15 -//  
16 -///**  
17 -// * chat modal config  
18 -// *  
19 -// * @author fansili  
20 -// * @time 2024/5/6 11:18  
21 -// * @since 1.0  
22 -// */  
23 -//@MappedTypes(value = AiChatModalDO.Config.class)  
24 -//public class AiChatModelConfigTypeHandler extends BaseTypeHandler<AiChatModalDO.Config> {  
25 -//  
26 -// @Override  
27 -// public void setNonNullParameter(PreparedStatement ps, int i, AiChatModalDO.Config parameter, JdbcType jdbcType) throws SQLException {  
28 -// // 将 MyCustomType 转换为数据库类型并设置到 PreparedStatement 中  
29 -// if (parameter == null) {  
30 -// ps.setString(i, "");  
31 -// } else {  
32 -// ps.setString(i, JsonUtils.toJsonString(parameter));  
33 -// }  
34 -// }  
35 -//  
36 -// @Override  
37 -// public AiChatModalDO.Config getNullableResult(ResultSet rs, String columnName) throws SQLException {  
38 -// // 从 ResultSet 中获取数据库类型并转换为 MyCustomType  
39 -// String str = rs.getString(columnName);  
40 -// if (StrUtil.isBlank(str)) {  
41 -// return null;  
42 -// }  
43 -// AiChatModalDO.Config config = JsonUtils.parseObject(str, AiChatModalDO.Config.class);  
44 -// // 获取平台  
45 -// AiPlatformEnum platformEnum = AiPlatformEnum.valueOfPlatform(config.getModelPlatform());  
46 -// if (AiPlatformEnum.CHAT_PLATFORM_LIST.contains(platformEnum)) {  
47 -// return JsonUtils.parseObject(str, AiChatModalDO.ChatConfig.class);  
48 -// } else if (AiPlatformEnum.OPEN_AI_DALL == platformEnum) {  
49 -// return JsonUtils.parseObject(str, AiChatModalDO.OpenAiImageConfig.class);  
50 -// } else if (AiPlatformEnum.MIDJOURNEY == platformEnum) {  
51 -// return JsonUtils.parseObject(str, AiChatModalDO.MidjourneyConfig.class);  
52 -// }  
53 -// throw new IllegalArgumentException("ai模型中config不能转换! json: " + str);  
54 -// }  
55 -//  
56 -// @Override  
57 -// public AiChatModalDO.Config getNullableResult(ResultSet rs, int columnIndex) throws SQLException {  
58 -// // 从 ResultSet 中获取数据库类型并转换为 MyCustomType  
59 -// String str = rs.getString(columnIndex);  
60 -// if (StrUtil.isBlank(str)) {  
61 -// return null;  
62 -// }  
63 -// return JsonUtils.parseObject(str, AiChatModalDO.Config.class);  
64 -// }  
65 -//  
66 -// @Override  
67 -// public AiChatModalDO.Config getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {  
68 -// // 从 CallableStatement 中获取数据库类型并转换为 MyCustomType  
69 -// String str = cs.getString(columnIndex);  
70 -// if (StrUtil.isBlank(str)) {  
71 -// return null;  
72 -// }  
73 -// return JsonUtils.parseObject(str, AiChatModalDO.Config.class);  
74 -// }  
75 -//}  
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-conversation.http deleted
1 -  
2 -### 登录 详细使用 https://www.jetbrains.com/help/idea/testing-restful-web-services.html、https://www.cnblogs.com/crazymakercircle/p/14317222.html  
3 -  
4 -  
5 -### 对话 - list  
6 -GET {{baseUrl}}/admin-api/ai/chat/conversation/list  
7 -Authorization: {{token}}  
8 -  
9 -  
10 -### 对话 - 创建对话  
11 -POST {{baseUrl}}/admin-api/ai/chat/conversation/create  
12 -Content-Type: application/json  
13 -Authorization: {{token}}  
14 -  
15 -{  
16 - "roleId": "9"  
17 -}  
18 -  
19 -### 对话 - id获取  
20 -GET {{baseUrl}}/admin-api/ai/chat/conversation/get?id=1781604279872581647  
21 -Authorization: {{token}}  
22 -  
23 -  
24 -### 对话 - 删除  
25 -DELETE {{baseUrl}}/admin-api/ai/chat/conversation/delete?id=1781604279872581647  
26 -Authorization: {{token}}  
27 -  
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http deleted
1 -  
2 -### chat call  
3 -GET {{baseUrl}}/admin-api/ai/chat/model/list  
4 -Authorization: {{token}}  
5 -  
6 -  
7 -### chat call  
8 -PUT {{baseUrl}}/admin-api/ai/chat/model/add  
9 -Content-Type: application/json  
10 -Authorization: {{token}}  
11 -  
12 -{  
13 - "keyId": "1",  
14 - "name": "小红书Ai写作大模型4.0",  
15 - "model": "ERNIE 4.0",  
16 - "platform": "yiyan",  
17 - "sort": 100  
18 -}  
19 -  
20 -### chat call  
21 -POST {{baseUrl}}/admin-api/ai/chat/model/update  
22 -Content-Type: application/json  
23 -Authorization: {{token}}  
24 -  
25 -{  
26 - "id": 9,  
27 - "keyId": "1",  
28 - "name": "小红书Ai写作大模型3.5 8k",  
29 - "model": "ERNIE-3.5-8K",  
30 - "platform": "yiyan",  
31 - "sort": 100  
32 -}  
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-role.http deleted
1 -  
2 -### chat角色 - list  
3 -GET {{baseUrl}}/admin-api/ai/chat/role/list?pageNo=1&pageSize=20&search=  
4 -Authorization: {{token}}  
5 -  
6 -### chat add  
7 -PUT {{baseUrl}}/admin-api/ai/chat/role/add  
8 -Content-Type: application/json  
9 -Authorization: {{token}}  
10 -  
11 -{  
12 - "modelId": 9,  
13 - "name": "小红书写作v1",  
14 - "avatar": "http://baidu.com",  
15 - "category": "writing",  
16 - "description": "采用gpt3.5模型,拥有小红书优质作者写作经验。",  
17 - "systemMessage": "你是一名优秀的小红书人文、风光作者,你热爱旅游,每去往一个城市你都会用美妙的文字抒写着这座城市的大街小巷,描述着这座城市的美好。",  
18 - "publicStatus": 0,  
19 - "sort": 0  
20 -}  
21 -  
22 -  
23 -### chat update  
24 -POST {{baseUrl}}/admin-api/ai/chat/role/update  
25 -Content-Type: application/json  
26 -Authorization: {{token}}  
27 -  
28 -{  
29 - "id": 8,  
30 - "modelId": 9,  
31 - "name": "小红书写作v2",  
32 - "avatar": "http://baidu.com",  
33 - "category": "writing",  
34 - "description": "采用gpt3.5模型,拥有小红书优质作者写作经验。",  
35 - "systemMessage": "你是一名优秀的小红书人文、风光作者,你热爱旅游,每去往一个城市你都会用美妙的文字抒写着这座城市的大街小巷,描述着这座城市的美好。",  
36 - "publicStatus": 0,  
37 - "sort": 0,  
38 - "status": 0  
39 -}  
40 -  
41 -### chat update  
42 -POST {{baseUrl}}/admin-api/ai/chat/role/update-public-status  
43 -Content-Type: application/json  
44 -Authorization: {{token}}  
45 -  
46 -{  
47 - "id": "8",  
48 - "publicStatus": true  
49 -}  
50 -  
51 -  
52 -### chat update  
53 -DELETE {{baseUrl}}/admin-api/ai/chat/role/delete?id=8  
54 -Authorization: {{token}}  
55 -  
56 -  
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/http-client.env.json deleted
1 -{  
2 - "global": {  
3 - "token": "--"  
4 - },  
5 - "dev": {  
6 - "baseUrl": "http://127.0.0.1:48080",  
7 - "token": "Bearer 66346cc899e243b081321bd1336a257a"  
8 - }  
9 -}  
10 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/login.http deleted
1 -  
2 -  
3 -### 登录  
4 -  
5 -POST {{baseUrl}}/admin-api/system/auth/login  
6 -Content-Type: application/json  
7 -tenant-id: 1  
8 -  
9 -{  
10 - "username": "admin",  
11 - "password": "123456",  
12 - "captchaVerification": "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==",  
13 - "socialCode": "1024",  
14 - "socialState": "9b2ffbc1-7425-4155-9894-9d5c08541d62",  
15 - "socialCodeValid": true  
16 -}  
17 -  
18 -  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java
1 package cn.iocoder.yudao.framework.ai.config; 1 package cn.iocoder.yudao.framework.ai.config;
2 2
3 -import cn.hutool.core.io.IoUtil;  
4 import cn.iocoder.yudao.framework.ai.core.factory.AiClientFactory; 3 import cn.iocoder.yudao.framework.ai.core.factory.AiClientFactory;
5 import cn.iocoder.yudao.framework.ai.core.factory.AiClientFactoryImpl; 4 import cn.iocoder.yudao.framework.ai.core.factory.AiClientFactoryImpl;
6 import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi; 5 import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
@@ -15,24 +14,10 @@ import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient; @@ -15,24 +14,10 @@ import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatClient;
15 import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatOptions; 14 import cn.iocoder.yudao.framework.ai.core.model.yiyan.YiYanChatOptions;
16 import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanApi; 15 import cn.iocoder.yudao.framework.ai.core.model.yiyan.api.YiYanApi;
17 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
18 -import org.jetbrains.annotations.NotNull;  
19 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
20 -import org.springframework.ai.models.midjourney.MidjourneyMessage;  
21 -import org.springframework.ai.models.midjourney.api.MidjourneyInteractionsApi;  
22 -import org.springframework.ai.models.midjourney.webSocket.MidjourneyMessageHandler;  
23 -import org.springframework.ai.models.midjourney.webSocket.MidjourneyWebSocketStarter;  
24 -import org.springframework.ai.models.midjourney.webSocket.listener.MidjourneyMessageListener;  
25 import org.springframework.boot.autoconfigure.AutoConfiguration; 17 import org.springframework.boot.autoconfigure.AutoConfiguration;
26 -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;  
27 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 18 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
28 import org.springframework.boot.context.properties.EnableConfigurationProperties; 19 import org.springframework.boot.context.properties.EnableConfigurationProperties;
29 -import org.springframework.context.ApplicationContext;  
30 import org.springframework.context.annotation.Bean; 20 import org.springframework.context.annotation.Bean;
31 -import org.springframework.core.io.Resource;  
32 -  
33 -import java.io.IOException;  
34 -import java.util.HashMap;  
35 -import java.util.Map;  
36 21
37 /** 22 /**
38 * 芋道 AI 自动配置 23 * 芋道 AI 自动配置
@@ -112,62 +97,9 @@ public class YudaoAiAutoConfiguration { @@ -112,62 +97,9 @@ public class YudaoAiAutoConfiguration {
112 } 97 }
113 98
114 @Bean 99 @Bean
115 - @ConditionalOnMissingBean(value = MidjourneyMessageHandler.class)  
116 - public MidjourneyMessageHandler defaultMidjourneyMessageHandler() {  
117 - // 如果没有实现 MidjourneyMessageHandler 默认注入一个  
118 - return new MidjourneyMessageHandler() {  
119 - @Override  
120 - public void messageHandler(MidjourneyMessage midjourneyMessage) {  
121 - log.info("default midjourney message: {}", midjourneyMessage);  
122 - }  
123 - };  
124 - }  
125 -  
126 - @Bean  
127 - @ConditionalOnProperty(value = "yudao.ai.midjourney.enable", havingValue = "true")  
128 - public MidjourneyWebSocketStarter midjourneyWebSocketStarter(ApplicationContext applicationContext,  
129 - MidjourneyMessageHandler midjourneyMessageHandler,  
130 - YudaoAiProperties yudaoAiProperties) {  
131 - // 获取 midjourneyProperties  
132 - YudaoAiProperties.MidjourneyProperties midjourneyProperties = yudaoAiProperties.getMidjourney();  
133 - // 获取 midjourneyConfig  
134 - MidjourneyConfig midjourneyConfig = getMidjourneyConfig(applicationContext, midjourneyProperties);  
135 - // 创建 socket messageListener  
136 - MidjourneyMessageListener messageListener = new MidjourneyMessageListener(midjourneyConfig, midjourneyMessageHandler);  
137 - // 创建 MidjourneyWebSocketStarter  
138 - return new MidjourneyWebSocketStarter(midjourneyProperties.getWssUrl(), null, midjourneyConfig, messageListener);  
139 - }  
140 -  
141 - @Bean  
142 - @ConditionalOnProperty(value = "yudao.ai.midjourney.enable", havingValue = "true")  
143 - public MidjourneyInteractionsApi midjourneyInteractionsApi(ApplicationContext applicationContext, YudaoAiProperties yudaoAiProperties) {  
144 - // 获取 midjourneyConfig  
145 - MidjourneyConfig midjourneyConfig = getMidjourneyConfig(applicationContext, yudaoAiProperties.getMidjourney());  
146 - // 创建 MidjourneyInteractionsApi  
147 - return new MidjourneyInteractionsApi(midjourneyConfig);  
148 - }  
149 -  
150 - @Bean  
151 @ConditionalOnProperty(value = "yudao.ai.suno.enable", havingValue = "true") 100 @ConditionalOnProperty(value = "yudao.ai.suno.enable", havingValue = "true")
152 public SunoApi sunoApi(YudaoAiProperties yudaoAiProperties) { 101 public SunoApi sunoApi(YudaoAiProperties yudaoAiProperties) {
153 return new SunoApi(yudaoAiProperties.getSuno().getBaseUrl()); 102 return new SunoApi(yudaoAiProperties.getSuno().getBaseUrl());
154 } 103 }
155 104
156 - private static @NotNull MidjourneyConfig getMidjourneyConfig(ApplicationContext applicationContext,  
157 - YudaoAiProperties.MidjourneyProperties midjourneyProperties) {  
158 - Map<String, String> requestTemplates = new HashMap<>();  
159 - try {  
160 - Resource[] resources = applicationContext.getResources("classpath:http-body/*.json");  
161 - for (var resource : resources) {  
162 - String filename = resource.getFilename();  
163 - String params = IoUtil.readUtf8(resource.getInputStream());  
164 - requestTemplates.put(filename.substring(0, filename.length() - 5), params);  
165 - }  
166 - } catch (IOException e) {  
167 - throw new IllegalArgumentException("Midjourney json模板初始化出错! " + e.getMessage());  
168 - }  
169 - // 创建 midjourneyConfig  
170 - return new MidjourneyConfig(midjourneyProperties.getToken(),  
171 - midjourneyProperties.getGuildId(), midjourneyProperties.getChannelId(), requestTemplates);  
172 - }  
173 } 105 }
174 \ No newline at end of file 106 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/MidjourneyConfig.java deleted
1 -package org.springframework.ai.models.midjourney;  
2 -  
3 -import lombok.Data;  
4 -import lombok.experimental.Accessors;  
5 -  
6 -import java.util.Map;  
7 -import java.util.UUID;  
8 -  
9 -/**  
10 - * Midjourney 配置  
11 - *  
12 - * author: fansili  
13 - * time: 2024/4/3 17:10  
14 - */  
15 -@Data  
16 -@Accessors(chain = true)  
17 -public class MidjourneyConfig {  
18 -  
19 - /**  
20 - * token信息  
21 - *  
22 - * tip: 登录discard F12找 messages 接口  
23 - */  
24 - private String token;  
25 - /**  
26 - * 服务器id  
27 - */  
28 - private String guildId;  
29 - /**  
30 - * 频道id  
31 - */  
32 - private String channelId;  
33 -  
34 - //  
35 - // api 接口  
36 -  
37 - /**  
38 - * 服务地址  
39 - */  
40 - private String serverUrl = "https://discord.com/";  
41 - /**  
42 - * 发送命令  
43 - */  
44 - private String apiInteractions = "api/v9/interactions";  
45 - /**  
46 - * 附件  
47 - */  
48 - private String apiAttachments = "/api/v9/channels/%s/attachments";  
49 - /**  
50 - * 文件上传  
51 - */  
52 - private String apiAttachmentsUpload = "https://discord-attachments-uploads-prd.storage.googleapis.com/";  
53 -  
54 - //  
55 - // 浏览器配置  
56 -  
57 - private String userAage = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36";  
58 -  
59 - //  
60 - // 请求 json 文件  
61 -  
62 -  
63 - private Map<String, String> requestTemplates;  
64 -  
65 - //  
66 - //  
67 -  
68 - private String sessionId;  
69 -  
70 - public MidjourneyConfig(String token, String guildId, String channelId, Map<String, String> requestTemplates) {  
71 - this.token = token;  
72 - this.guildId = guildId;  
73 - this.channelId = channelId;  
74 - this.requestTemplates = requestTemplates;  
75 -  
76 - // 生成 session id  
77 - sessionId = UUID.randomUUID().toString().replaceAll("-", "");  
78 - }  
79 -  
80 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/MidjourneyMessage.java deleted
1 -package org.springframework.ai.models.midjourney;  
2 -  
3 -import org.springframework.ai.models.midjourney.constants.MidjourneyGennerateStatusEnum;  
4 -import lombok.Data;  
5 -import lombok.experimental.Accessors;  
6 -  
7 -import java.util.List;  
8 -  
9 -@Data  
10 -@Accessors(chain = true)  
11 -public class MidjourneyMessage {  
12 -  
13 - /**  
14 - * id是一个重要的字段,在同时生成多个的时候,可以区分生成信息  
15 - */  
16 - private String id;  
17 - /**  
18 - * 提交id(nonce 可能会不存在,系统提示的时候,这个为空)  
19 - */  
20 - private String nonce;  
21 - /**  
22 - * 现在已知:  
23 - * 0:我们发送的消息,和指令  
24 - * 20: mj生成图片发送过程中  
25 - * 19: 选择了某一张图片后的通知  
26 - */  
27 - private Integer type;  
28 - /**  
29 - * content  
30 - */  
31 - private Content content;  
32 - /**  
33 - * 图片生成完成才有  
34 - */  
35 - private List<ComponentType> components;  
36 - /**  
37 - * 生成过程中如果有,预展示图片,这里会有  
38 - */  
39 - private List<Attachment> attachments;  
40 - /**  
41 - * 原始数据(discard 返回的原始数据)  
42 - */  
43 - private String rawData;  
44 - /**  
45 - * 生成状态(用于区分生成状态)  
46 - * 1、等待  
47 - * 2、进行中  
48 - * 3、完成  
49 - * {@link MidjourneyGennerateStatusEnum}  
50 - */  
51 - private String generateStatus;  
52 - /**  
53 - * 一般用于提示信息  
54 - * - 错误  
55 - * - 并发队列满了  
56 - * - 账号违规了、敏感词  
57 - * - 账号被封  
58 - */  
59 - private List<Embed> embeds;  
60 -  
61 - @Data  
62 - @Accessors(chain = true)  
63 - public static class ComponentType {  
64 -  
65 - private int type;  
66 -  
67 - private List<Component> components;  
68 - }  
69 -  
70 - @Data  
71 - @Accessors(chain = true)  
72 - public static class Component {  
73 - /**  
74 - * 自定义ID,用于唯一标识特定交互动作及其上下文信息。  
75 - */  
76 - private String customId;  
77 -  
78 - /**  
79 - * 样式编号,用于确定按钮的样式外观。  
80 - * 在某些应用中,例如Discord,2可能表示一种特定的颜色或形状的按钮。  
81 - */  
82 - private int style;  
83 -  
84 - /**  
85 - * 按钮的标签文本,用户可见的内容。  
86 - */  
87 - private String label;  
88 -  
89 - /**  
90 - * 组件类型,此处为2可能表示这是一种特定类型的交互组件,  
91 - * 如在Discord API中,类型2对应的是一个可点击的按钮组件。  
92 - */  
93 - private int type;  
94 -  
95 - }  
96 -  
97 - @Data  
98 - @Accessors(chain = true)  
99 - public static class Attachment {  
100 - // 文件名  
101 - private String filename;  
102 -  
103 - // 附件大小(字节)  
104 - private int size;  
105 -  
106 - // 内容类型(例如:image/webp)  
107 - private String contentType;  
108 -  
109 - // 图像宽度(像素)  
110 - private int width;  
111 -  
112 - // 占位符版本号  
113 - private int placeholderVersion;  
114 -  
115 - // 代理URL,用于访问附件资源  
116 - private String proxyUrl;  
117 -  
118 - // 占位符标识符  
119 - private String placeholder;  
120 -  
121 - // 附件ID  
122 - private String id;  
123 -  
124 - // 直接访问附件资源的URL  
125 - private String url;  
126 -  
127 - // 图像高度(像素)  
128 - private int height;  
129 - }  
130 -  
131 - @Data  
132 - @Accessors(chain = true)  
133 - public static class Content {  
134 - private String prompt;  
135 - private String progress;  
136 - private String status;  
137 - }  
138 -  
139 - /**  
140 - * embed 用于警告、提示、错误  
141 - */  
142 - @Data  
143 - @Accessors(chain = true)  
144 - public static class Embed {  
145 -  
146 - // 内容扫描版本号  
147 - private int contentScanVersion;  
148 -  
149 - // 颜色值,这里用Java的Color类来表示,注意实际使用中可能需要自定义方法来从int转换为Color对象  
150 - private String color;  
151 -  
152 - // 页脚信息,包含文本  
153 - private Footer footer;  
154 -  
155 - // 描述信息  
156 - private String description;  
157 -  
158 - // 消息类型,这里是富文本类型(这个区分不同提示类型)  
159 - private String type;  
160 -  
161 - // 标题  
162 - private String title;  
163 -  
164 - // Footer类,作为嵌套类存在,用来表示footer部分的JSON对象  
165 - @Data  
166 - @Accessors(chain = true)  
167 - public static class Footer {  
168 - // 页脚文本  
169 - private String text;  
170 - }  
171 -  
172 - }  
173 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/MidjourneyInteractions.java deleted
1 -package org.springframework.ai.models.midjourney.api;  
2 -  
3 -import cn.hutool.core.util.IdUtil;  
4 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
5 -import org.springframework.ai.models.midjourney.constants.MidjourneyConstants;  
6 -import com.google.common.collect.Maps;  
7 -import lombok.extern.slf4j.Slf4j;  
8 -import org.springframework.http.HttpHeaders;  
9 -import org.springframework.http.MediaType;  
10 -  
11 -import java.util.HashMap;  
12 -  
13 -// TODO @fansili:按照 spring ai 的封装习惯,这个类是不是 MidjourneyApi  
14 -  
15 -/**  
16 - * 图片生成  
17 - *  
18 - * author: fansili  
19 - * time: 2024/4/3 17:36  
20 - */  
21 -@Slf4j  
22 -public abstract class MidjourneyInteractions {  
23 -  
24 - // TODO done @fansili:静态变量,放在最前面哈;  
25 - /**  
26 - * header - referer 头信息  
27 - */  
28 - private static final String HEADER_REFERER = "https://discord.com/channels/%s/%s";  
29 - /**  
30 - * mj配置文件  
31 - */  
32 - protected final MidjourneyConfig midjourneyConfig;  
33 -  
34 - protected MidjourneyInteractions(MidjourneyConfig midjourneyConfig) {  
35 - this.midjourneyConfig = midjourneyConfig;  
36 - }  
37 -  
38 - /**  
39 - * 获取headers - application json  
40 - *  
41 - * @return  
42 - */  
43 - protected HttpHeaders getHeadersOfAppJson() {  
44 - // 设置header值  
45 - HttpHeaders httpHeaders = new HttpHeaders();  
46 - httpHeaders.setContentType(MediaType.APPLICATION_JSON);  
47 - httpHeaders.set("Authorization", midjourneyConfig.getToken());  
48 - httpHeaders.set("User-Agent", midjourneyConfig.getUserAage());  
49 - httpHeaders.set("Cookie", MidjourneyConstants.HTTP_COOKIE);  
50 - httpHeaders.set("Referer", String.format(HEADER_REFERER, midjourneyConfig.getGuildId(), midjourneyConfig.getChannelId()));  
51 - return httpHeaders;  
52 - }  
53 -  
54 - /**  
55 - * 获取headers - http form data  
56 - *  
57 - * @return  
58 - */  
59 - protected HttpHeaders getHeadersOfFormData() {  
60 - // 设置header值  
61 - HttpHeaders httpHeaders = new HttpHeaders();  
62 - httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);  
63 - httpHeaders.set("Authorization", midjourneyConfig.getToken());  
64 - httpHeaders.set("User-Agent", midjourneyConfig.getUserAage());  
65 - httpHeaders.set("Cookie", MidjourneyConstants.HTTP_COOKIE);  
66 - httpHeaders.set("Referer", String.format(HEADER_REFERER, midjourneyConfig.getGuildId(), midjourneyConfig.getChannelId()));  
67 - return httpHeaders;  
68 - }  
69 -  
70 - /**  
71 - * 获取 - 默认参数  
72 - * @return  
73 - */  
74 - protected HashMap<String, String> getDefaultParams() {  
75 - HashMap<String, String> requestParams = Maps.newHashMap();  
76 - // TODO done @fansili:感觉参数的组装,可以搞成一个公用的方法;就是 config + 入参的感觉;  
77 - requestParams.put("guild_id", midjourneyConfig.getGuildId());  
78 - requestParams.put("channel_id", midjourneyConfig.getChannelId());  
79 - requestParams.put("session_id", midjourneyConfig.getSessionId());  
80 - requestParams.put("nonce", String.valueOf(IdUtil.getSnowflakeNextId())); // TODO @fansili:建议用 uuid 之类的;nextId 跨进程未必合适哈;  
81 - return requestParams;  
82 - }  
83 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/MidjourneyInteractionsApi.java deleted
1 -package org.springframework.ai.models.midjourney.api;  
2 -  
3 -import cn.hutool.core.util.StrUtil;  
4 -import com.alibaba.fastjson.JSON;  
5 -import com.alibaba.fastjson.JSONObject;  
6 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
7 -import org.springframework.ai.models.midjourney.api.req.AttachmentsReq;  
8 -import org.springframework.ai.models.midjourney.api.req.DescribeReq;  
9 -import org.springframework.ai.models.midjourney.api.req.ReRollReq;  
10 -import org.springframework.ai.models.midjourney.api.res.UploadAttachmentsRes;  
11 -import org.springframework.ai.models.midjourney.util.MidjourneyUtil;  
12 -import com.google.common.collect.Lists;  
13 -import lombok.extern.slf4j.Slf4j;  
14 -import org.springframework.core.io.FileSystemResource;  
15 -import org.springframework.http.*;  
16 -import org.springframework.util.LinkedMultiValueMap;  
17 -import org.springframework.util.MultiValueMap;  
18 -import org.springframework.web.client.RestTemplate;  
19 -  
20 -import java.io.IOException;  
21 -import java.util.HashMap;  
22 -  
23 -// TODO @fansili:按照 spring ai 的封装习惯,这个类是不是 MidjourneyApi  
24 -/**  
25 - * 图片生成  
26 - *  
27 - * author: fansili  
28 - * time: 2024/4/3 17:36  
29 - */  
30 -@Slf4j  
31 -public class MidjourneyInteractionsApi extends MidjourneyInteractions {  
32 -  
33 - private final String url;  
34 - private final RestTemplate restTemplate = new RestTemplate(); // TODO @fansili:优先级低:后续搞到统一的管理  
35 -  
36 - public MidjourneyInteractionsApi(MidjourneyConfig midjourneyConfig) {  
37 - super(midjourneyConfig);  
38 - this.url = midjourneyConfig.getServerUrl().concat(midjourneyConfig.getApiInteractions());  
39 - }  
40 -  
41 - public Boolean imagine(String nonce, String prompt) {  
42 - // 获取请求模板  
43 - String requestTemplate = midjourneyConfig.getRequestTemplates().get("imagine");  
44 - // 设置参数  
45 - HashMap<String, String> requestParams = getDefaultParams();  
46 - requestParams.put("nonce", nonce);  
47 - requestParams.put("prompt", prompt);  
48 - // 解析 template 参数占位符  
49 - String requestBody = MidjourneyUtil.parseTemplate(requestTemplate, requestParams);  
50 - // 获取 header  
51 - HttpHeaders httpHeaders = getHeadersOfAppJson();  
52 - // 发送请求  
53 - HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, httpHeaders);  
54 - String res = restTemplate.postForObject(url, requestEntity, String.class);  
55 - // 这个 res 只要不返回值,就是成功!  
56 - // TODO @fansili:可以直接 if (StrUtil.isBlank(res))  
57 - if (StrUtil.isBlank(res)) {  
58 - return true;  
59 - } else {  
60 - log.error("请求失败! 请求参数:{} 返回结果! {}", requestBody, res);  
61 - return false;  
62 - }  
63 - }  
64 - // TODO done @fansili:方法和方法之间,空一行哈;  
65 -  
66 -  
67 - public Boolean reRoll(ReRollReq reRoll) {  
68 - // 获取请求模板  
69 - String requestTemplate = midjourneyConfig.getRequestTemplates().get("reroll");  
70 - // 设置参数  
71 - HashMap<String, String> requestParams = getDefaultParams();  
72 - requestParams.put("custom_id", reRoll.getCustomId());  
73 - requestParams.put("message_id", reRoll.getMessageId());  
74 - // 获取 header  
75 - HttpHeaders httpHeaders = getHeadersOfAppJson();  
76 - // 设置参数  
77 - String requestBody = MidjourneyUtil.parseTemplate(requestTemplate, requestParams);  
78 - // 发送请求  
79 - HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, httpHeaders);  
80 - String res = restTemplate.postForObject(url, requestEntity, String.class);  
81 - // 这个 res 只要不返回值,就是成功!  
82 - boolean isSuccess = StrUtil.isBlank(res);  
83 - if (isSuccess) {  
84 - return true;  
85 - }  
86 - log.error("请求失败! 请求参数:{} 返回结果! {}", requestBody, res);  
87 - return isSuccess;  
88 - }  
89 -  
90 - // TODO @fansili:搞成私有方法,可能会好点;  
91 - public UploadAttachmentsRes uploadAttachments(AttachmentsReq attachments) {  
92 - // file  
93 - JSONObject fileObj = new JSONObject();  
94 - fileObj.put("id", "0");  
95 - fileObj.put("filename", attachments.getFileSystemResource().getFilename());  
96 - // TODO @fansili:这块用 lombok 哪个异常处理,简化下代码;  
97 - try {  
98 - fileObj.put("file_size", attachments.getFileSystemResource().contentLength());  
99 - } catch (IOException e) {  
100 - throw new RuntimeException(e);  
101 - }  
102 - // 创建用于存放表单数据的MultiValueMap  
103 - MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>();  
104 - multipartRequest.put("files", Lists.newArrayList(fileObj));  
105 - // 设置header值  
106 - HttpHeaders httpHeaders = getHeadersOfAppJson();  
107 - // 创建HttpEntity对象,包含表单数据和头部信息  
108 - HttpEntity<MultiValueMap<String, Object>> multiValueMapHttpEntity = new HttpEntity<>(multipartRequest, httpHeaders);  
109 - // 发送POST请求并接收响应  
110 - String uri = String.format(midjourneyConfig.getApiAttachments(), midjourneyConfig.getChannelId());  
111 - String response = restTemplate.postForObject(midjourneyConfig.getServerUrl().concat(uri), multiValueMapHttpEntity, String.class);  
112 - UploadAttachmentsRes uploadAttachmentsRes = JSON.parseObject(response, UploadAttachmentsRes.class);  
113 -  
114 - //  
115 - // 上传文件  
116 - String uploadUrl = uploadAttachmentsRes.getAttachments().get(0).getUploadUrl();  
117 - httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);  
118 - HttpEntity<FileSystemResource> fileSystemResourceHttpEntity = new HttpEntity<>(attachments.getFileSystemResource(), httpHeaders);  
119 - ResponseEntity<String> exchange = restTemplate.exchange(uploadUrl, HttpMethod.PUT, fileSystemResourceHttpEntity, String.class);  
120 - String uploadRes = exchange.getBody();  
121 - return uploadAttachmentsRes;  
122 - }  
123 -  
124 - public Boolean describe(DescribeReq describe) {  
125 - // 获取请求模板  
126 - String requestTemplate = midjourneyConfig.getRequestTemplates().get("describe");  
127 - // 设置参数  
128 - HashMap<String, String> requestParams = getDefaultParams();  
129 - requestParams.put("file_name", describe.getFileName());  
130 - requestParams.put("final_file_name", describe.getFinalFileName());  
131 - // 设置 header  
132 - HttpHeaders httpHeaders = getHeadersOfFormData();  
133 - String requestBody = MidjourneyUtil.parseTemplate(requestTemplate, requestParams);  
134 - // 创建表单数据  
135 - MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();  
136 - formData.add("payload_json", requestBody);  
137 - // 发送请求  
138 - HttpEntity<MultiValueMap<String, String>> multiValueMapHttpEntity = new HttpEntity<>(formData, httpHeaders);  
139 - String res = restTemplate.postForObject(url, multiValueMapHttpEntity, String.class);  
140 - // 这个 res 只要不返回值,就是成功!  
141 - boolean isSuccess = StrUtil.isBlank(res);  
142 - if (isSuccess) {  
143 - return true;  
144 - }  
145 - log.error("请求失败! 请求参数:{} 返回结果! {}", requestBody, res);  
146 - return isSuccess;  
147 - }  
148 -  
149 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/req/AttachmentsReq.java deleted
1 -package org.springframework.ai.models.midjourney.api.req;  
2 -  
3 -import lombok.Data;  
4 -import lombok.experimental.Accessors;  
5 -import org.springframework.core.io.FileSystemResource;  
6 -  
7 -/**  
8 - * 附件  
9 - * <p>  
10 - * author: fansili  
11 - * time: 2024/4/7 17:18  
12 - */  
13 -@Data  
14 -@Accessors(chain = true)  
15 -public class AttachmentsReq {  
16 -  
17 - /**  
18 - * 创建文件系统资源对象  
19 - */  
20 - private FileSystemResource fileSystemResource;  
21 -  
22 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/req/DescribeReq.java deleted
1 -package org.springframework.ai.models.midjourney.api.req;  
2 -  
3 -import lombok.Data;  
4 -import lombok.experimental.Accessors;  
5 -  
6 -/**  
7 - * describe  
8 - *  
9 - * author: fansili  
10 - * time: 2024/4/7 12:30  
11 - */  
12 -@Data  
13 -@Accessors(chain = true)  
14 -public class DescribeReq {  
15 -  
16 - /**  
17 - * 文件名字  
18 - */  
19 - private String fileName;  
20 - /**  
21 - * UploadAttachmentsRes 里面的 finalFileName  
22 - */  
23 - private String finalFileName;  
24 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/req/ReRollReq.java deleted
1 -package org.springframework.ai.models.midjourney.api.req;  
2 -  
3 -import lombok.Data;  
4 -import lombok.experimental.Accessors;  
5 -  
6 -/**  
7 - * author: fansili  
8 - * time: 2024/4/6 21:33  
9 - */  
10 -@Data  
11 -@Accessors(chain = true)  
12 -public class ReRollReq {  
13 -  
14 - /**  
15 - * socket 消息里面收到的 messageId  
16 - */  
17 - private String messageId;  
18 - /**  
19 - * socket 消息里面的,操作按钮id(MJ::JOB::upsample::3::2aeefbef-43e2-4057-bcf1-43b5f39ab6f7)  
20 - */  
21 - private String customId;  
22 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/api/res/UploadAttachmentsRes.java deleted
1 -package org.springframework.ai.models.midjourney.api.res;  
2 -  
3 -import lombok.Data;  
4 -import lombok.experimental.Accessors;  
5 -  
6 -import java.util.List;  
7 -  
8 -/**  
9 - * 上传附件 - res  
10 - *  
11 - * author: fansili  
12 - * time: 2024/4/8 13:32  
13 - */  
14 -@Data  
15 -@Accessors(chain = true)  
16 -public class UploadAttachmentsRes {  
17 -  
18 - private List<Attachment> attachments;  
19 -  
20 - @Data  
21 - @Accessors(chain = true)  
22 - public static class Attachment {  
23 - /**  
24 - * 附件的ID。  
25 - */  
26 - private int id;  
27 - /**  
28 - * 附件的上传URL。  
29 - */  
30 - private String uploadUrl;  
31 - /**  
32 - * 上传到服务器的文件名。  
33 - */  
34 - private String uploadFilename;  
35 - }  
36 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/constants/MidjourneyConstants.java deleted
1 -package org.springframework.ai.models.midjourney.constants;  
2 -  
3 -public final class MidjourneyConstants {  
4 -  
5 - /**  
6 - * 消息 - 编号  
7 - */  
8 - public static final String MSG_ID = "id";  
9 - /**  
10 - * 用于区分操作唯一性  
11 - */  
12 - public static final String MSG_NONCE = "nonce";  
13 - /**  
14 - * 消息 - 类型  
15 - * 现在已知:  
16 - * 0:我们发送的消息,和指令  
17 - * 20: mj生成图片发送过程中  
18 - * 19: 选择了某一张图片后的通知  
19 - */  
20 - public static final String MSG_TYPE = "type";  
21 - /**  
22 - * 平道id  
23 - */  
24 - public static final String MSG_CHANNEL_ID = "channel_id";  
25 - /**  
26 - * 内容  
27 - *  
28 - * "**南极应该是什么样子? --v 6.0 --style raw** - <@972721304891453450> (32%) (fast, stealth)",  
29 - */  
30 - public static final String MSG_CONTENT = "content";  
31 - /**  
32 - * 组件(图片生成好之后才有)  
33 - */  
34 - public static final String MSG_COMPONENTS = "components";  
35 - /**  
36 - * 附件(生成中比较模糊的图片)  
37 - */  
38 - public static final String MSG_ATTACHMENTS = "attachments";  
39 - /**  
40 - * 一般用于提示  
41 - */  
42 - public static final String MSG_EMBEDS = "embeds";  
43 -  
44 -  
45 - //  
46 - //  
47 -  
48 - public static final String HTTP_COOKIE = "__dcfduid=6ca536c0e3fa11eeb7cbe34c31b49caf; __sdcfduid=6ca536c1e3fa11eeb7cbe34c31b49caf52cce5ffd8983d2a052cf6aba75fe5fe566f2c265902e283ce30dbf98b8c9c93; _gcl_au=1.1.245923998.1710853617; _ga=GA1.1.111061823.1710853617; __cfruid=6385bb3f48345a006b25992db7dcf984e395736d-1712124666; _cfuvid=O09la5ms0ypNptiG0iD8A6BKWlTxz1LG0WR7qRStD7o-1712124666575-0.0.1.1-604800000; locale=zh-CN; cf_clearance=l_YGod1_SUtYxpDVeZXiX7DLLPl1DYrquZe8WVltvYs-1712124668-1.0.1.1-Hl2.fToel23EpF2HCu9J20rB4D7OhhCzoajPSdo.9Up.wPxhvq22DP9RHzEBKuIUlKyH.kJLxXJfAt2N.LD5WQ; OptanonConsent=isIABGlobal=false&datestamp=Wed+Apr+03+2024+14%3A11%3A15+GMT%2B0800+(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)&version=6.33.0&hosts=&landingPath=https%3A%2F%2Fdiscord.com%2F&groups=C0001%3A1%2CC0002%3A1%2CC0003%3A1; _ga_Q149DFWHT7=GS1.1.1712124668.4.1.1712124679.0.0.0";  
49 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/constants/MidjourneyGennerateStatusEnum.java deleted
1 -package org.springframework.ai.models.midjourney.constants;  
2 -  
3 -import lombok.AllArgsConstructor;  
4 -import lombok.Getter;  
5 -  
6 -// TODO done @fansili:1)Mj 缩写,还是搞成全称。。虽然长一点,但是感觉会相对清晰一些哈;2)lombok 相关的注解,可以用用哈;3)value 改 status;  
7 -/**  
8 - * mj 生成状态  
9 - *  
10 - * author: fansili  
11 - * time: 2024/4/6 21:07  
12 - */  
13 -@Getter  
14 -@AllArgsConstructor  
15 -public enum MidjourneyGennerateStatusEnum {  
16 -  
17 - WAITING("waiting", "等待..."),  
18 - IN_PROGRESS("in_progress", "进行中"),  
19 - COMPLETED("completed", "完成"),  
20 -  
21 - ;  
22 -  
23 - /**  
24 - * 状态  
25 - */  
26 - private String status;  
27 - /**  
28 - * 状态信息  
29 - */  
30 - private String message;  
31 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/constants/MidjourneyInteractionsEnum.java deleted
1 -package org.springframework.ai.models.midjourney.constants;  
2 -  
3 -import lombok.Getter;  
4 -  
5 -/**  
6 - * MJ 命令  
7 - */  
8 -@Getter  
9 -public enum MidjourneyInteractionsEnum {  
10 -  
11 - IMAGINE("imagine", "生成图片"),  
12 - DESCRIBE("describe", "生成描述"),  
13 - FAST("fast", "快速生成"),  
14 - SETTINGS("settings", "设置"),  
15 - ASK("ask", "提问"),  
16 - BLEND("blend", "融合"),  
17 -  
18 - ;  
19 -  
20 - MidjourneyInteractionsEnum(String value, String message) {  
21 - this.value =value;  
22 - this.message =message;  
23 - }  
24 -  
25 - private String value;  
26 - private String message;  
27 -  
28 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/constants/MidjourneyMessageTypeEnum.java deleted
1 -package org.springframework.ai.models.midjourney.constants;  
2 -  
3 -  
4 -public enum MidjourneyMessageTypeEnum {  
5 - /**  
6 - * 创建.  
7 - */  
8 - CREATE,  
9 - /**  
10 - * 修改.  
11 - */  
12 - UPDATE,  
13 - /**  
14 - * 删除.  
15 - */  
16 - DELETE;  
17 -  
18 - public static MidjourneyMessageTypeEnum of(String type) {  
19 - return switch (type) {  
20 - case "MESSAGE_CREATE" -> CREATE;  
21 - case "MESSAGE_UPDATE" -> UPDATE;  
22 - case "MESSAGE_DELETE" -> DELETE;  
23 - default -> null;  
24 - };  
25 - }  
26 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/constants/MidjourneyNotifyCode.java deleted
1 -package org.springframework.ai.models.midjourney.constants;  
2 -  
3 -import lombok.experimental.UtilityClass;  
4 -  
5 -@UtilityClass  
6 -public final class MidjourneyNotifyCode {  
7 - /**  
8 - * 成功.  
9 - */  
10 - public static final int SUCCESS = 1;  
11 -  
12 -  
13 -  
14 -}  
15 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/util/MidjourneyUtil.java deleted
1 -package org.springframework.ai.models.midjourney.util;  
2 -  
3 -import cn.hutool.core.text.CharSequenceUtil;  
4 -import org.springframework.ai.models.midjourney.MidjourneyMessage;  
5 -  
6 -import java.util.Map;  
7 -import java.util.regex.Matcher;  
8 -import java.util.regex.Pattern;  
9 -  
10 -/**  
11 - * mj util  
12 - *  
13 - * author: fansili  
14 - * time: 2024/4/6 19:00  
15 - */  
16 -public class MidjourneyUtil {  
17 - /**  
18 - * content正则匹配prompt和进度.  
19 - */  
20 - public static final String CONTENT_REGEX = ".*?\\*\\*(.*?)\\*\\*.+<@\\d+> \\((.*?)\\)";  
21 - public static final String CONTENT_PROGRESS_REGEX = "\\(([^)]*)\\)";  
22 -  
23 - /**  
24 - * 解析 content 参数  
25 - *  
26 - * @param content  
27 - * @return  
28 - */  
29 - public static MidjourneyMessage.Content parseContent(String content) {  
30 - // 有三种格式。  
31 - // 南极应该是什么样子?  
32 - // "**南极应该是什么样子? --v 6.0 --style raw** - <@972721304891453450> (32%) (fast, stealth)",  
33 - // "**南极应该是什么样子? --v 6.0 --style raw** - <@972721304891453450> (fast, stealth)"  
34 - // Upscaling image #3 with **A girl from China, creator of ancient Chinese clothing, dances on the square** - <@975372485971312700> (Waiting to start)  
35 - MidjourneyMessage.Content mjContent = new MidjourneyMessage.Content();  
36 - if (CharSequenceUtil.isBlank(content)) {  
37 - return null;  
38 - }  
39 - if (!content.contains("<@")) {  
40 - return mjContent.setPrompt(content);  
41 - }  
42 - int rawIndex = content.indexOf("<@") - 3;  
43 - String prompt = content.substring(0, rawIndex).trim();  
44 - String contentTail = content.substring(rawIndex).trim();  
45 - // 检查是否存在进度条  
46 - Pattern pattern = Pattern.compile(CONTENT_PROGRESS_REGEX);  
47 - Matcher matcher = pattern.matcher(contentTail);  
48 -  
49 - if (contentTail.contains("%")) {  
50 - if (matcher.find()) {  
51 - // 获取第一个(也是此处唯一的)捕获组的内容  
52 - String progress = matcher.group(1);  
53 - mjContent.setProgress(progress);  
54 - }  
55 - if (matcher.find()) {  
56 - String status = matcher.group(1);  
57 - mjContent.setStatus(status);  
58 - }  
59 - } else {  
60 - if (matcher.find()) {  
61 - // 获取第一个(也是此处唯一的)捕获组的内容  
62 - String status = matcher.group(1);  
63 - mjContent.setStatus(status);  
64 - }  
65 - }  
66 - mjContent.setPrompt(prompt);  
67 - // tip:contentArray  
68 - return mjContent;  
69 - }  
70 -  
71 - /**  
72 - * 设置 params  
73 - *  
74 - * @param requestTemplate  
75 - * @param requestParams  
76 - * @return  
77 - */  
78 - public static String parseTemplate(String requestTemplate, Map<String, String> requestParams) {  
79 - for (Map.Entry<String, String> entry : requestParams.entrySet()) {  
80 - requestTemplate = requestTemplate.replace("$".concat(entry.getKey()), entry.getValue());  
81 - }  
82 - return requestTemplate;  
83 - }  
84 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/FailureCallback.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -  
4 -public interface FailureCallback {  
5 - void onFailure(int code, String reason);  
6 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/MidjourneyMessageHandler.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -import org.springframework.ai.models.midjourney.MidjourneyMessage;  
4 -  
5 -/**  
6 - * message handler  
7 - *  
8 - * @author fansili  
9 - * @time 2024/4/29 14:29  
10 - * @since 1.0  
11 - */  
12 -public interface MidjourneyMessageHandler {  
13 -  
14 - void messageHandler(MidjourneyMessage midjourneyMessage);  
15 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/MidjourneyWebSocketStarter.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -  
4 -import cn.hutool.core.text.CharSequenceUtil;  
5 -import cn.hutool.core.thread.ThreadUtil;  
6 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
7 -import org.springframework.ai.models.midjourney.constants.MidjourneyNotifyCode;  
8 -import org.springframework.ai.models.midjourney.webSocket.handler.MidjourneyWebSocketHandler;  
9 -import org.springframework.ai.models.midjourney.webSocket.listener.MidjourneyMessageListener;  
10 -import lombok.Getter;  
11 -import lombok.extern.slf4j.Slf4j;  
12 -import org.apache.tomcat.websocket.Constants;  
13 -import org.jetbrains.annotations.NotNull;  
14 -import org.springframework.util.concurrent.ListenableFuture;  
15 -import org.springframework.util.concurrent.ListenableFutureCallback;  
16 -import org.springframework.web.socket.CloseStatus;  
17 -import org.springframework.web.socket.WebSocketHttpHeaders;  
18 -import org.springframework.web.socket.WebSocketSession;  
19 -import org.springframework.web.socket.client.standard.StandardWebSocketClient;  
20 -  
21 -import java.io.IOException;  
22 -import java.net.URI;  
23 -  
24 -// TODO @fansili:mj 这块 websocket 有点小复杂,虽然代码量 400 多行;感觉可以考虑,有没第三方 sdk,通过它透明接入 mj  
25 -@Slf4j  
26 -public class MidjourneyWebSocketStarter implements WebSocketStarter {  
27 - /**  
28 - * 链接重试次数  
29 - */  
30 - private static final int CONNECT_RETRY_LIMIT = 5;  
31 - /**  
32 - * mj 配置文件  
33 - */  
34 - private final MidjourneyConfig midjourneyConfig;  
35 - /**  
36 - * mj 监听(所有message 都会 callback到这里)  
37 - */  
38 - private final MidjourneyMessageListener userMessageListener;  
39 - /**  
40 - * wss 服务器  
41 - */  
42 - private final String wssServer;  
43 - /**  
44 - *  
45 - */  
46 - private final String resumeWss;  
47 - /**  
48 - *  
49 - */  
50 - private ResumeData resumeData = null;  
51 - /**  
52 - * 是否运行成功  
53 - */  
54 - private boolean running = false;  
55 - /**  
56 - * 链接成功的 session  
57 - */  
58 - private WebSocketSession webSocketSession = null;  
59 - private WssNotify wssNotify = null;  
60 -  
61 - public MidjourneyWebSocketStarter(String wssServer,  
62 - String resumeWss,  
63 - MidjourneyConfig midjourneyConfig,  
64 - MidjourneyMessageListener userMessageListener) {  
65 - this.wssServer = wssServer;  
66 - this.resumeWss = resumeWss;  
67 - this.midjourneyConfig = midjourneyConfig;  
68 - this.userMessageListener = userMessageListener;  
69 - }  
70 -  
71 - @Override  
72 - public void start(WssNotify wssNotify) {  
73 - this.wssNotify = wssNotify;  
74 - start(false);  
75 - }  
76 -  
77 - private void start(boolean reconnect) {  
78 - // 设置header  
79 - WebSocketHttpHeaders headers = new WebSocketHttpHeaders();  
80 - headers.add("Accept-Encoding", "gzip, deflate, br");  
81 - headers.add("Accept-Language", "zh-CN,zh;q=0.9");  
82 - headers.add("Cache-Control", "no-cache");  
83 - headers.add("Pragma", "no-cache");  
84 - headers.add("Sec-Websocket-Extensions", "permessage-deflate; client_max_window_bits");  
85 - headers.add("User-Agent", this.midjourneyConfig.getUserAage());  
86 - // 创建 mjHeader  
87 - MidjourneyWebSocketHandler mjWebSocketHandler = new MidjourneyWebSocketHandler(  
88 - this.midjourneyConfig, this.userMessageListener, this::onSocketSuccess, this::onSocketFailure);  
89 - //  
90 - String gatewayUrl;  
91 - if (reconnect) {  
92 - gatewayUrl = getGatewayServer(this.resumeData.getResumeGatewayUrl()) + "/?encoding=json&v=9&compress=zlib-stream";  
93 - mjWebSocketHandler.setSessionId(this.resumeData.getSessionId());  
94 - mjWebSocketHandler.setSequence(this.resumeData.getSequence());  
95 - mjWebSocketHandler.setResumeGatewayUrl(this.resumeData.getResumeGatewayUrl());  
96 - } else {  
97 - gatewayUrl = getGatewayServer(null) + "/?encoding=json&v=9&compress=zlib-stream";  
98 - }  
99 - // 创建 StandardWebSocketClient  
100 - StandardWebSocketClient webSocketClient = new StandardWebSocketClient();  
101 - // 设置 io timeout 时间  
102 - webSocketClient.getUserProperties().put(Constants.IO_TIMEOUT_MS_PROPERTY, "10000");  
103 - //  
104 - ListenableFuture<WebSocketSession> socketSessionFuture = webSocketClient.doHandshake(mjWebSocketHandler, headers, URI.create(gatewayUrl));  
105 - // 添加 callback 进行回调  
106 - socketSessionFuture.addCallback(new ListenableFutureCallback<>() {  
107 - @Override  
108 - public void onFailure(@NotNull Throwable e) {  
109 - onSocketFailure(MidjourneyWebSocketHandler.CLOSE_CODE_EXCEPTION, e.getMessage());  
110 - }  
111 -  
112 - @Override  
113 - public void onSuccess(WebSocketSession session) {  
114 - MidjourneyWebSocketStarter.this.webSocketSession = session;  
115 - }  
116 - });  
117 - }  
118 -  
119 - private void onSocketSuccess(String sessionId, Object sequence, String resumeGatewayUrl) {  
120 - this.resumeData = new ResumeData(sessionId, sequence, resumeGatewayUrl);  
121 - this.running = true;  
122 - notifyWssLock(MidjourneyNotifyCode.SUCCESS, "");  
123 - }  
124 -  
125 - private void onSocketFailure(int code, String reason) {  
126 - // 1001异常可以忽略  
127 - if (code == 1001) {  
128 - return;  
129 - }  
130 - // 关闭 socket  
131 - closeSocketSessionWhenIsOpen();  
132 - // 没有运行通知  
133 - if (!this.running) {  
134 - notifyWssLock(code, reason);  
135 - return;  
136 - }  
137 - // 已经运行先设置为false,发起  
138 - this.running = false;  
139 - if (code >= 4000) {  
140 - log.warn("[wss-{}] Can't reconnect! Account disabled. Closed by {}({}).", this.midjourneyConfig.getChannelId(), code, reason);  
141 - } else if (code == 2001) {  
142 - log.warn("[wss-{}] Closed by {}({}). Try reconnect...", this.midjourneyConfig.getChannelId(), code, reason);  
143 - tryReconnect();  
144 - } else {  
145 - log.warn("[wss-{}] Closed by {}({}). Try new connection...", this.midjourneyConfig.getChannelId(), code, reason);  
146 - tryNewConnect();  
147 - }  
148 - }  
149 -  
150 - /**  
151 - * 重连  
152 - */  
153 - private void tryReconnect() {  
154 - try {  
155 - tryStart(true);  
156 - } catch (Exception e) {  
157 - log.warn("[wss-{}] Reconnect fail: {}, Try new connection...", this.midjourneyConfig.getChannelId(), e.getMessage());  
158 - ThreadUtil.sleep(1000);  
159 - tryNewConnect();  
160 - }  
161 - }  
162 -  
163 - private void tryNewConnect() {  
164 - // 链接重试次数5  
165 - for (int i = 1; i <= CONNECT_RETRY_LIMIT; i++) {  
166 - try {  
167 - tryStart(false);  
168 - return;  
169 - } catch (Exception e) {  
170 - log.warn("[wss-{}] New connect fail ({}): {}", this.midjourneyConfig.getChannelId(), i, e.getMessage());  
171 - ThreadUtil.sleep(5000);  
172 - }  
173 - }  
174 - log.error("[wss-{}] Account disabled", this.midjourneyConfig.getChannelId());  
175 - }  
176 -  
177 - public void tryStart(boolean reconnect) {  
178 - start(reconnect);  
179 - }  
180 -  
181 - private void notifyWssLock(int code, String reason) {  
182 - System.err.println("notifyWssLock: " + code + " - " + reason);  
183 - if (wssNotify != null) {  
184 - wssNotify.notify(code, reason);  
185 - }  
186 - }  
187 -  
188 - /**  
189 - * 关闭 socket session  
190 - */  
191 - private void closeSocketSessionWhenIsOpen() {  
192 - try {  
193 - if (this.webSocketSession != null && this.webSocketSession.isOpen()) {  
194 - this.webSocketSession.close(CloseStatus.GOING_AWAY);  
195 - }  
196 - } catch (IOException e) {  
197 - // do nothing  
198 - }  
199 - }  
200 -  
201 - private String getGatewayServer(String resumeGatewayUrl) {  
202 - if (CharSequenceUtil.isNotBlank(resumeGatewayUrl)) {  
203 - return CharSequenceUtil.isBlank(this.resumeWss) ? resumeGatewayUrl : this.resumeWss;  
204 - }  
205 - return this.wssServer;  
206 - }  
207 -  
208 - @Getter  
209 - public static class ResumeData {  
210 -  
211 - public ResumeData(String sessionId, Object sequence, String resumeGatewayUrl) {  
212 - this.sessionId = sessionId;  
213 - this.sequence = sequence;  
214 - this.resumeGatewayUrl = resumeGatewayUrl;  
215 - }  
216 -  
217 - /**  
218 - * socket session  
219 - */  
220 - private final String sessionId;  
221 - private final Object sequence;  
222 - private final String resumeGatewayUrl;  
223 - }  
224 -}  
225 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/SuccessCallback.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -  
4 -public interface SuccessCallback {  
5 -  
6 - void onSuccess(String sessionId, Object sequence, String resumeGatewayUrl);  
7 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/WebSocketStarter.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -  
4 -public interface WebSocketStarter {  
5 -  
6 - void start(WssNotify wssNotify) throws Exception;  
7 -  
8 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/WssNotify.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket;  
2 -  
3 -/**  
4 - * 通知信息  
5 - *  
6 - * @author fansili  
7 - * @time 2024/4/29 14:21  
8 - * @since 1.0  
9 - */  
10 -public interface WssNotify {  
11 -  
12 - void notify(int code, String message);  
13 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/handler/MidjourneyWebSocketHandler.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket.handler;  
2 -  
3 -import cn.hutool.core.text.CharSequenceUtil;  
4 -import cn.hutool.core.thread.ThreadUtil;  
5 -import cn.hutool.core.util.RandomUtil;  
6 -import cn.hutool.http.useragent.UserAgent;  
7 -import cn.hutool.http.useragent.UserAgentUtil;  
8 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
9 -import org.springframework.ai.models.midjourney.webSocket.FailureCallback;  
10 -import org.springframework.ai.models.midjourney.webSocket.SuccessCallback;  
11 -import org.springframework.ai.models.midjourney.webSocket.listener.MidjourneyMessageListener;  
12 -import lombok.Setter;  
13 -import lombok.extern.slf4j.Slf4j;  
14 -import net.dv8tion.jda.api.utils.data.DataArray;  
15 -import net.dv8tion.jda.api.utils.data.DataObject;  
16 -import net.dv8tion.jda.api.utils.data.DataType;  
17 -import net.dv8tion.jda.internal.requests.WebSocketCode;  
18 -import net.dv8tion.jda.internal.utils.compress.Decompressor;  
19 -import net.dv8tion.jda.internal.utils.compress.ZlibDecompressor;  
20 -import org.jetbrains.annotations.NotNull;  
21 -import org.springframework.web.socket.*;  
22 -  
23 -import java.io.IOException;  
24 -import java.nio.ByteBuffer;  
25 -import java.nio.charset.StandardCharsets;  
26 -import java.util.concurrent.Executors;  
27 -import java.util.concurrent.Future;  
28 -import java.util.concurrent.ScheduledExecutorService;  
29 -import java.util.concurrent.TimeUnit;  
30 -  
31 -@Slf4j  
32 -public class MidjourneyWebSocketHandler implements WebSocketHandler {  
33 - /**  
34 - * close 错误码:重连  
35 - */  
36 - public static final int CLOSE_CODE_RECONNECT = 2001;  
37 - /**  
38 - * close 错误码:无效、作废  
39 - */  
40 - public static final int CLOSE_CODE_INVALIDATE = 1009;  
41 - /**  
42 - * close 错误码:异常  
43 - */  
44 - public static final int CLOSE_CODE_EXCEPTION = 1011;  
45 - /**  
46 - * mj配置文件  
47 - */  
48 - private final MidjourneyConfig midjourneyConfig;  
49 - /**  
50 - * mj 消息监听  
51 - */  
52 - private final MidjourneyMessageListener userMessageListener;  
53 - /**  
54 - * 成功回调  
55 - */  
56 - private final SuccessCallback successCallback;  
57 - /**  
58 - * 失败回调  
59 - */  
60 - private final FailureCallback failureCallback;  
61 - /**  
62 - * 心跳执行器  
63 - */  
64 - private final ScheduledExecutorService heartExecutor;  
65 - /**  
66 - * auth数据  
67 - */  
68 - private final DataObject authData;  
69 -  
70 - @Setter  
71 - private String sessionId = null;  
72 - @Setter  
73 - private Object sequence = null;  
74 - @Setter  
75 - private String resumeGatewayUrl = null;  
76 -  
77 - private long interval = 41250;  
78 - private boolean heartbeatAck = false;  
79 -  
80 - private Future<?> heartbeatInterval;  
81 - private Future<?> heartbeatTimeout;  
82 -  
83 - /**  
84 - * 处理 message 消息的 Decompressor  
85 - */  
86 - private final Decompressor decompressor = new ZlibDecompressor(2048);  
87 -  
88 - public MidjourneyWebSocketHandler(MidjourneyConfig account,  
89 - MidjourneyMessageListener userMessageListener,  
90 - SuccessCallback successCallback,  
91 - FailureCallback failureCallback) {  
92 - this.midjourneyConfig = account;  
93 - this.userMessageListener = userMessageListener;  
94 - this.successCallback = successCallback;  
95 - this.failureCallback = failureCallback;  
96 - this.heartExecutor = Executors.newSingleThreadScheduledExecutor();  
97 - this.authData = createAuthData();  
98 - }  
99 -  
100 - @Override  
101 - public void afterConnectionEstablished(@NotNull WebSocketSession session) throws Exception {  
102 - // do nothing  
103 - }  
104 -  
105 - @Override  
106 - public void handleTransportError(@NotNull WebSocketSession session, @NotNull Throwable e) throws Exception {  
107 - log.error("[wss-{}] Transport error", this.midjourneyConfig.getChannelId(), e);  
108 - // 通知链接异常  
109 - onFailure(CLOSE_CODE_EXCEPTION, "transport error");  
110 - }  
111 -  
112 - @Override  
113 - public void afterConnectionClosed(@NotNull WebSocketSession session, @NotNull CloseStatus closeStatus) throws Exception {  
114 - // 链接关闭  
115 - onFailure(closeStatus.getCode(), closeStatus.getReason());  
116 - }  
117 -  
118 - @Override  
119 - public boolean supportsPartialMessages() {  
120 - return true;  
121 - }  
122 -  
123 - @Override  
124 - public void handleMessage(@NotNull WebSocketSession session, WebSocketMessage<?> message) throws Exception {  
125 - // 获取 message 消息  
126 - ByteBuffer buffer = (ByteBuffer) message.getPayload();  
127 - // 解析 message  
128 - byte[] decompressed = decompressor.decompress(buffer.array());  
129 - if (decompressed == null) {  
130 - return;  
131 - }  
132 - // 转换 json  
133 - String json = new String(decompressed, StandardCharsets.UTF_8);  
134 - // 转换 jda 自带的 dataObject(和json object 差不多)  
135 - DataObject data = DataObject.fromJson(json);  
136 - // 获取消息类型  
137 - int opCode = data.getInt("op");  
138 - switch (opCode) {  
139 - case WebSocketCode.HEARTBEAT -> handleHeartbeat(session);  
140 - case WebSocketCode.HEARTBEAT_ACK -> {  
141 - this.heartbeatAck = true;  
142 - clearHeartbeatTimeout();  
143 - }  
144 - case WebSocketCode.HELLO -> {  
145 - handleHello(session, data);  
146 - doResumeOrIdentify(session);  
147 - }  
148 - case WebSocketCode.RESUME -> onSuccess();  
149 - case WebSocketCode.RECONNECT -> onFailure(CLOSE_CODE_RECONNECT, "receive server reconnect");  
150 - case WebSocketCode.INVALIDATE_SESSION -> onFailure(CLOSE_CODE_INVALIDATE, "receive session invalid");  
151 - case WebSocketCode.DISPATCH -> handleDispatch(data);  
152 - default -> log.debug("[wss-{}] Receive unknown code: {}.", midjourneyConfig.getChannelId(), data);  
153 - }  
154 - }  
155 -  
156 - private void handleDispatch(DataObject raw) {  
157 - this.sequence = raw.opt("s").orElse(null);  
158 - if (!raw.isType("d", DataType.OBJECT)) {  
159 - return;  
160 - }  
161 - DataObject content = raw.getObject("d");  
162 - String t = raw.getString("t", null);  
163 - if ("READY".equals(t)) {  
164 - this.sessionId = content.getString("session_id");  
165 - this.resumeGatewayUrl = content.getString("resume_gateway_url");  
166 - onSuccess();  
167 - } else if ("RESUMED".equals(t)) {  
168 - onSuccess();  
169 - } else {  
170 - try {  
171 - this.userMessageListener.onMessage(raw);  
172 - } catch (Exception e) {  
173 - log.error("[wss-{}] Handle message error", this.midjourneyConfig.getChannelId(), e);  
174 - }  
175 - }  
176 - }  
177 -  
178 - private void handleHeartbeat(WebSocketSession session) {  
179 - sendMessage(session, WebSocketCode.HEARTBEAT, this.sequence);  
180 - this.heartbeatTimeout = ThreadUtil.execAsync(() -> {  
181 - ThreadUtil.sleep(this.interval);  
182 - onFailure(CLOSE_CODE_RECONNECT, "heartbeat has not ack");  
183 - });  
184 - }  
185 -  
186 - private void handleHello(WebSocketSession session, DataObject data) {  
187 - clearHeartbeatInterval();  
188 - this.interval = data.getObject("d").getLong("heartbeat_interval");  
189 - this.heartbeatAck = true;  
190 - this.heartbeatInterval = this.heartExecutor.scheduleAtFixedRate(() -> {  
191 - if (this.heartbeatAck) {  
192 - this.heartbeatAck = false;  
193 - sendMessage(session, WebSocketCode.HEARTBEAT, this.sequence);  
194 - } else {  
195 - onFailure(CLOSE_CODE_RECONNECT, "heartbeat has not ack interval");  
196 - }  
197 - }, (long) Math.floor(RandomUtil.randomDouble(0, 1) * this.interval), this.interval, TimeUnit.MILLISECONDS);  
198 - }  
199 -  
200 - private void doResumeOrIdentify(WebSocketSession session) {  
201 - if (CharSequenceUtil.isBlank(this.sessionId)) {  
202 - sendMessage(session, WebSocketCode.IDENTIFY, this.authData);  
203 - } else {  
204 - var data = DataObject.empty().put("token", this.midjourneyConfig.getToken())  
205 - .put("session_id", this.sessionId).put("seq", this.sequence);  
206 - sendMessage(session, WebSocketCode.RESUME, data);  
207 - }  
208 - }  
209 -  
210 - private void sendMessage(WebSocketSession session, int op, Object d) {  
211 - var data = DataObject.empty().put("op", op).put("d", d);  
212 - try {  
213 - session.sendMessage(new TextMessage(data.toString()));  
214 - } catch (IOException e) {  
215 - log.error("[wss-{}] Send message error", this.midjourneyConfig.getChannelId(), e);  
216 - onFailure(CLOSE_CODE_EXCEPTION, "send message error");  
217 - }  
218 - }  
219 -  
220 - private void onSuccess() {  
221 - ThreadUtil.execute(() -> this.successCallback.onSuccess(this.sessionId, this.sequence, this.resumeGatewayUrl));  
222 - }  
223 -  
224 - private void onFailure(int code, String reason) {  
225 - clearHeartbeatTimeout();  
226 - clearHeartbeatInterval();  
227 - ThreadUtil.execute(() -> this.failureCallback.onFailure(code, reason));  
228 - }  
229 -  
230 - private void clearHeartbeatTimeout() {  
231 - if (this.heartbeatTimeout != null) {  
232 - this.heartbeatTimeout.cancel(true);  
233 - this.heartbeatTimeout = null;  
234 - }  
235 - }  
236 -  
237 - private void clearHeartbeatInterval() {  
238 - if (this.heartbeatInterval != null) {  
239 - this.heartbeatInterval.cancel(true);  
240 - this.heartbeatInterval = null;  
241 - }  
242 - }  
243 -  
244 - private DataObject createAuthData() {  
245 - UserAgent userAgent = UserAgentUtil.parse(this.midjourneyConfig.getUserAage());  
246 - DataObject connectionProperties = DataObject.empty()  
247 - .put("browser", userAgent.getBrowser().getName())  
248 - .put("browser_user_agent", this.midjourneyConfig.getUserAage())  
249 - .put("browser_version", userAgent.getVersion())  
250 - .put("client_build_number", 222963)  
251 - .put("client_event_source", null)  
252 - .put("device", "")  
253 - .put("os", userAgent.getOs().getName())  
254 - .put("referer", "https://www.midjourney.com")  
255 - .put("referrer_current", "")  
256 - .put("referring_domain", "www.midjourney.com")  
257 - .put("referring_domain_current", "")  
258 - .put("release_channel", "stable")  
259 - .put("system_locale", "zh-CN");  
260 - DataObject presence = DataObject.empty()  
261 - .put("activities", DataArray.empty())  
262 - .put("afk", false)  
263 - .put("since", 0)  
264 - .put("status", "online");  
265 - DataObject clientState = DataObject.empty()  
266 - .put("api_code_version", 0)  
267 - .put("guild_versions", DataObject.empty())  
268 - .put("highest_last_message_id", "0")  
269 - .put("private_channels_version", "0")  
270 - .put("read_state_version", 0)  
271 - .put("user_guild_settings_version", -1)  
272 - .put("user_settings_version", -1);  
273 - return DataObject.empty()  
274 - .put("capabilities", 16381)  
275 - .put("client_state", clientState)  
276 - .put("compress", false)  
277 - .put("presence", presence)  
278 - .put("properties", connectionProperties)  
279 - .put("token", this.midjourneyConfig.getToken());  
280 - }  
281 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/org/springframework/ai/models/midjourney/webSocket/listener/MidjourneyMessageListener.java deleted
1 -package org.springframework.ai.models.midjourney.webSocket.listener;  
2 -  
3 -  
4 -import cn.hutool.core.collection.CollUtil;  
5 -import cn.hutool.core.text.CharSequenceUtil;  
6 -import cn.hutool.core.util.StrUtil;  
7 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
8 -import org.springframework.ai.models.midjourney.MidjourneyMessage;  
9 -import org.springframework.ai.models.midjourney.constants.MidjourneyConstants;  
10 -import org.springframework.ai.models.midjourney.constants.MidjourneyGennerateStatusEnum;  
11 -import org.springframework.ai.models.midjourney.constants.MidjourneyMessageTypeEnum;  
12 -import org.springframework.ai.models.midjourney.util.MidjourneyUtil;  
13 -import org.springframework.ai.models.midjourney.webSocket.MidjourneyMessageHandler;  
14 -import cn.iocoder.yudao.framework.common.util.json.JsonUtils;  
15 -import lombok.extern.slf4j.Slf4j;  
16 -import net.dv8tion.jda.api.utils.data.DataObject;  
17 -  
18 -import java.util.List;  
19 -  
20 -@Slf4j  
21 -public class MidjourneyMessageListener {  
22 -  
23 - private MidjourneyConfig midjourneyConfig;  
24 - private MidjourneyMessageHandler midjourneyMessageHandler = null;  
25 -  
26 - public MidjourneyMessageListener(MidjourneyConfig midjourneyConfig) {  
27 - this.midjourneyConfig = midjourneyConfig;  
28 - }  
29 -  
30 - public MidjourneyMessageListener(MidjourneyConfig midjourneyConfig,  
31 - MidjourneyMessageHandler midjourneyMessageHandler) {  
32 - this.midjourneyConfig = midjourneyConfig;  
33 - this.midjourneyMessageHandler = midjourneyMessageHandler;  
34 - }  
35 -  
36 - public void onMessage(DataObject raw) {  
37 - MidjourneyMessageTypeEnum messageType = MidjourneyMessageTypeEnum.of(raw.getString("t"));  
38 - if (messageType == null || MidjourneyMessageTypeEnum.DELETE == messageType) {  
39 - return;  
40 - }  
41 - DataObject data = raw.getObject("d");  
42 - if (ignoreAndLogMessage(data, messageType)) {  
43 - return;  
44 - }  
45 - log.info("socket message: {}", raw);  
46 - // 转换几个重要的信息  
47 - MidjourneyMessage mjMessage = new MidjourneyMessage();  
48 - mjMessage.setId(getString(data, MidjourneyConstants.MSG_ID, ""));  
49 - mjMessage.setNonce(getString(data, MidjourneyConstants.MSG_NONCE, ""));  
50 - mjMessage.setType(data.getInt(MidjourneyConstants.MSG_TYPE));  
51 - mjMessage.setRawData(StrUtil.str(raw.toJson(), "UTF-8"));  
52 - mjMessage.setContent(MidjourneyUtil.parseContent(data.getString(MidjourneyConstants.MSG_CONTENT)));  
53 - // 转换 components  
54 - if (!data.getArray(MidjourneyConstants.MSG_COMPONENTS).isEmpty()) {  
55 - String componentsJson = StrUtil.str(data.getArray(MidjourneyConstants.MSG_COMPONENTS).toJson(), "UTF-8");  
56 - List<MidjourneyMessage.ComponentType> components = JsonUtils.parseArray(componentsJson, MidjourneyMessage.ComponentType.class);  
57 - mjMessage.setComponents(components);  
58 - }  
59 - // 转换附件  
60 - if (!data.getArray(MidjourneyConstants.MSG_ATTACHMENTS).isEmpty()) {  
61 - String attachmentsJson = StrUtil.str(data.getArray(MidjourneyConstants.MSG_ATTACHMENTS).toJson(), "UTF-8");  
62 - List<MidjourneyMessage.Attachment> attachments = JsonUtils.parseArray(attachmentsJson, MidjourneyMessage.Attachment.class);  
63 - mjMessage.setAttachments(attachments);  
64 - }  
65 - // 转换 embeds 提示信息  
66 - if (!data.getArray(MidjourneyConstants.MSG_EMBEDS).isEmpty()) {  
67 - String embedJson = StrUtil.str(data.getArray(MidjourneyConstants.MSG_EMBEDS).toJson(), "UTF-8");  
68 - List<MidjourneyMessage.Embed> embeds = JsonUtils.parseArray(embedJson, MidjourneyMessage.Embed.class);  
69 - mjMessage.setEmbeds(embeds);  
70 - }  
71 - // 转换状态  
72 - convertGenerateStatus(mjMessage);  
73 - // message handler 调用  
74 - if (midjourneyMessageHandler != null) {  
75 - midjourneyMessageHandler.messageHandler(mjMessage);  
76 - }  
77 - }  
78 -  
79 - private String getString(DataObject data, String key, String defaultValue) {  
80 - if (!data.hasKey(key)) {  
81 - return defaultValue;  
82 - }  
83 - return data.getString(key);  
84 - }  
85 -  
86 - private void convertGenerateStatus(MidjourneyMessage mjMessage) {  
87 - //  
88 - // tip:提示、警告、异常 content是没有内容的  
89 - // tip: 一般错误信息在 Embeds 只要 Embeds有值,content就没信息。  
90 - if (CollUtil.isNotEmpty(mjMessage.getEmbeds())) {  
91 - return;  
92 - }  
93 - if (mjMessage.getType() == 20 && mjMessage.getContent().getStatus().contains("Waiting")) {  
94 - mjMessage.setGenerateStatus(MidjourneyGennerateStatusEnum.WAITING.getStatus());  
95 - } else if (mjMessage.getType() == 20 && !StrUtil.isBlank(mjMessage.getContent().getProgress())) {  
96 - mjMessage.setGenerateStatus(MidjourneyGennerateStatusEnum.IN_PROGRESS.getStatus());  
97 - } else if (mjMessage.getType() == 0 && !CollUtil.isEmpty(mjMessage.getComponents())) {  
98 - mjMessage.setGenerateStatus(MidjourneyGennerateStatusEnum.COMPLETED.getStatus());  
99 - }  
100 - }  
101 -  
102 - private boolean ignoreAndLogMessage(DataObject data, MidjourneyMessageTypeEnum messageType) {  
103 - String channelId = data.getString(MidjourneyConstants.MSG_CHANNEL_ID);  
104 - if (!CharSequenceUtil.equals(channelId, midjourneyConfig.getChannelId())) {  
105 - return true;  
106 - }  
107 - String authorName = data.optObject("author").map(a -> a.getString("username")).orElse("System");  
108 - log.debug("{} - {} - {}: {}", midjourneyConfig.getChannelId(), messageType.name(), authorName, data.opt("content").orElse(""));  
109 - return false;  
110 - }  
111 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body/describe.json deleted
1 -{  
2 - "type": 2,  
3 - "guild_id": "$guild_id",  
4 - "channel_id": "$channel_id",  
5 - "application_id": "936929561302675456",  
6 - "session_id": "$session_id",  
7 - "nonce": "$nonce",  
8 - "data": {  
9 - "version": "1204231436023111690",  
10 - "id": "1092492867185950852",  
11 - "name": "describe",  
12 - "type": 1,  
13 - "options": [  
14 - {  
15 - "type": 11,  
16 - "name": "image",  
17 - "value": 0  
18 - }  
19 - ],  
20 - "attachments": [  
21 - {  
22 - "id": "0",  
23 - "filename": "$file_name",  
24 - "uploaded_filename": "$final_file_name"  
25 - }  
26 - ]  
27 - }  
28 -}  
29 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body/imagine.json deleted
1 -{  
2 - "type": 2,  
3 - "guild_id": "$guild_id",  
4 - "channel_id": "$channel_id",  
5 - "application_id": "936929561302675456",  
6 - "session_id": "$session_id",  
7 - "nonce": "$nonce",  
8 - "data": {  
9 - "version": "1237876415471554623",  
10 - "id": "938956540159881230",  
11 - "name": "imagine",  
12 - "type": 1,  
13 - "options": [  
14 - {  
15 - "type": 3,  
16 - "name": "prompt",  
17 - "value": "$prompt"  
18 - }  
19 - ]  
20 - }  
21 -}  
22 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/http-body/reroll.json deleted
1 -{  
2 - "type": 3,  
3 - "guild_id": "$guild_id",  
4 - "channel_id": "$channel_id",  
5 - "message_id": "$message_id",  
6 - "application_id": "936929561302675456",  
7 - "session_id": "$session_id",  
8 - "nonce": "$nonce",  
9 - "message_flags": 0,  
10 - "data": {  
11 - "component_type": 2,  
12 - "custom_id": "$custom_id"  
13 - }  
14 -}  
15 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/1.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 17,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "nonce": "1784822781483888640",  
44 - "application_id": "936929561302675456",  
45 - "edited_timestamp": null,  
46 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (Waiting to start)",  
47 - "tts": false,  
48 - "webhook_id": "936929561302675456",  
49 - "mentions": [  
50 - {  
51 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
52 - "avatar_decoration_data": null,  
53 - "member": {  
54 - "premium_since": null,  
55 - "nick": null,  
56 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
57 - "communication_disabled_until": null,  
58 - "roles": [],  
59 - "pending": false,  
60 - "flags": 0,  
61 - "deaf": false,  
62 - "mute": false,  
63 - "avatar": null  
64 - },  
65 - "clan": null,  
66 - "public_flags": 0,  
67 - "id": "975372485971312700",  
68 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
69 - "username": "andrakosq9211",  
70 - "discriminator": "0"  
71 - }  
72 - ],  
73 - "member": {  
74 - "premium_since": null,  
75 - "nick": null,  
76 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
77 - "communication_disabled_until": null,  
78 - "roles": [  
79 - "1234355760184561747"  
80 - ],  
81 - "pending": false,  
82 - "flags": 0,  
83 - "deaf": false,  
84 - "mute": false,  
85 - "avatar": null  
86 - },  
87 - "interaction": {  
88 - "name": "imagine",  
89 - "member": {  
90 - "premium_since": null,  
91 - "nick": null,  
92 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
93 - "communication_disabled_until": null,  
94 - "roles": [],  
95 - "pending": false,  
96 - "flags": 0,  
97 - "deaf": false,  
98 - "mute": false,  
99 - "avatar": null  
100 - },  
101 - "id": "1234381513597128715",  
102 - "type": 2,  
103 - "user": {  
104 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
105 - "avatar_decoration_data": null,  
106 - "clan": null,  
107 - "public_flags": 0,  
108 - "id": "975372485971312700",  
109 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
110 - "username": "andrakosq9211",  
111 - "discriminator": "0"  
112 - }  
113 - },  
114 - "guild_id": "1234355413420347402",  
115 - "position": 0,  
116 - "id": "1234381516130357379",  
117 - "embeds": [],  
118 - "channel_id": "1234380679576424448",  
119 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
120 - }  
121 -}  
122 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/10.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 38,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [  
10 - {  
11 - "filename": "5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp",  
12 - "size": 40906,  
13 - "content_type": "image/webp",  
14 - "width": 512,  
15 - "placeholder_version": 1,  
16 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234381954301038622/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308747&is=662f35c7&hm=5cff8b62f6c174b45a80d096eefbea9bf791ccfb50f586734efadbd96b57a114&",  
17 - "placeholder": "W/gJHwiCN4VoaZZ4ePd3aIeFCJacgqAG",  
18 - "id": "1234381954301038622",  
19 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234381954301038622/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308747&is=662f35c7&hm=5cff8b62f6c174b45a80d096eefbea9bf791ccfb50f586734efadbd96b57a114&",  
20 - "height": 512  
21 - }  
22 - ],  
23 - "interaction_metadata": {  
24 - "user_id": "975372485971312700",  
25 - "name": "imagine",  
26 - "authorizing_integration_owners": {  
27 - "0": "1234355413420347402"  
28 - },  
29 - "id": "1234381513597128715",  
30 - "type": 2,  
31 - "user": {  
32 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
33 - "avatar_decoration_data": null,  
34 - "clan": null,  
35 - "public_flags": 0,  
36 - "id": "975372485971312700",  
37 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
38 - "username": "andrakosq9211",  
39 - "discriminator": "0"  
40 - }  
41 - },  
42 - "author": {  
43 - "global_name": null,  
44 - "bot": true,  
45 - "avatar_decoration_data": null,  
46 - "clan": null,  
47 - "public_flags": 589824,  
48 - "id": "936929561302675456",  
49 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
50 - "username": "Midjourney Bot",  
51 - "discriminator": "9282"  
52 - },  
53 - "flags": 0,  
54 - "type": 20,  
55 - "mention_roles": [],  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": "2024-04-29T05:53:11.587132+00:00",  
58 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (75%) (relaxed)",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [  
62 - {  
63 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
64 - "avatar_decoration_data": null,  
65 - "member": {  
66 - "premium_since": null,  
67 - "nick": null,  
68 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
69 - "communication_disabled_until": null,  
70 - "roles": [],  
71 - "pending": false,  
72 - "flags": 0,  
73 - "deaf": false,  
74 - "mute": false,  
75 - "avatar": null  
76 - },  
77 - "clan": null,  
78 - "public_flags": 0,  
79 - "id": "975372485971312700",  
80 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
81 - "username": "andrakosq9211",  
82 - "discriminator": "0"  
83 - }  
84 - ],  
85 - "member": {  
86 - "premium_since": null,  
87 - "nick": null,  
88 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
89 - "communication_disabled_until": null,  
90 - "roles": [  
91 - "1234355760184561747"  
92 - ],  
93 - "pending": false,  
94 - "flags": 0,  
95 - "deaf": false,  
96 - "mute": false,  
97 - "avatar": null  
98 - },  
99 - "interaction": {  
100 - "name": "imagine",  
101 - "member": {  
102 - "premium_since": null,  
103 - "nick": null,  
104 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
105 - "communication_disabled_until": null,  
106 - "roles": [],  
107 - "pending": false,  
108 - "flags": 0,  
109 - "deaf": false,  
110 - "mute": false,  
111 - "avatar": null  
112 - },  
113 - "id": "1234381513597128715",  
114 - "type": 2,  
115 - "user": {  
116 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
117 - "avatar_decoration_data": null,  
118 - "clan": null,  
119 - "public_flags": 0,  
120 - "id": "975372485971312700",  
121 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
122 - "username": "andrakosq9211",  
123 - "discriminator": "0"  
124 - }  
125 - },  
126 - "guild_id": "1234355413420347402",  
127 - "position": 0,  
128 - "id": "1234381516130357379",  
129 - "embeds": [],  
130 - "channel_id": "1234380679576424448",  
131 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
132 - }  
133 -}  
134 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/11.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 39,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [  
10 - {  
11 - "filename": "5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp",  
12 - "size": 77746,  
13 - "content_type": "image/webp",  
14 - "width": 512,  
15 - "placeholder_version": 1,  
16 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234381963381444691/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308749&is=662f35c9&hm=f87113bb4f667e56747a26812260f18b5c59f1e47991457756e77b576309534a&",  
17 - "placeholder": "3OcJDwSASHWaWZZ4eNd2eHiGJyBMgKAG",  
18 - "id": "1234381963381444691",  
19 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234381963381444691/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308749&is=662f35c9&hm=f87113bb4f667e56747a26812260f18b5c59f1e47991457756e77b576309534a&",  
20 - "height": 512  
21 - }  
22 - ],  
23 - "interaction_metadata": {  
24 - "user_id": "975372485971312700",  
25 - "name": "imagine",  
26 - "authorizing_integration_owners": {  
27 - "0": "1234355413420347402"  
28 - },  
29 - "id": "1234381513597128715",  
30 - "type": 2,  
31 - "user": {  
32 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
33 - "avatar_decoration_data": null,  
34 - "clan": null,  
35 - "public_flags": 0,  
36 - "id": "975372485971312700",  
37 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
38 - "username": "andrakosq9211",  
39 - "discriminator": "0"  
40 - }  
41 - },  
42 - "author": {  
43 - "global_name": null,  
44 - "bot": true,  
45 - "avatar_decoration_data": null,  
46 - "clan": null,  
47 - "public_flags": 589824,  
48 - "id": "936929561302675456",  
49 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
50 - "username": "Midjourney Bot",  
51 - "discriminator": "9282"  
52 - },  
53 - "flags": 0,  
54 - "type": 20,  
55 - "mention_roles": [],  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": "2024-04-29T05:53:13.745586+00:00",  
58 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (95%) (relaxed)",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [  
62 - {  
63 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
64 - "avatar_decoration_data": null,  
65 - "member": {  
66 - "premium_since": null,  
67 - "nick": null,  
68 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
69 - "communication_disabled_until": null,  
70 - "roles": [],  
71 - "pending": false,  
72 - "flags": 0,  
73 - "deaf": false,  
74 - "mute": false,  
75 - "avatar": null  
76 - },  
77 - "clan": null,  
78 - "public_flags": 0,  
79 - "id": "975372485971312700",  
80 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
81 - "username": "andrakosq9211",  
82 - "discriminator": "0"  
83 - }  
84 - ],  
85 - "member": {  
86 - "premium_since": null,  
87 - "nick": null,  
88 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
89 - "communication_disabled_until": null,  
90 - "roles": [  
91 - "1234355760184561747"  
92 - ],  
93 - "pending": false,  
94 - "flags": 0,  
95 - "deaf": false,  
96 - "mute": false,  
97 - "avatar": null  
98 - },  
99 - "interaction": {  
100 - "name": "imagine",  
101 - "member": {  
102 - "premium_since": null,  
103 - "nick": null,  
104 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
105 - "communication_disabled_until": null,  
106 - "roles": [],  
107 - "pending": false,  
108 - "flags": 0,  
109 - "deaf": false,  
110 - "mute": false,  
111 - "avatar": null  
112 - },  
113 - "id": "1234381513597128715",  
114 - "type": 2,  
115 - "user": {  
116 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
117 - "avatar_decoration_data": null,  
118 - "clan": null,  
119 - "public_flags": 0,  
120 - "id": "975372485971312700",  
121 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
122 - "username": "andrakosq9211",  
123 - "discriminator": "0"  
124 - }  
125 - },  
126 - "guild_id": "1234355413420347402",  
127 - "position": 0,  
128 - "id": "1234381516130357379",  
129 - "embeds": [],  
130 - "channel_id": "1234380679576424448",  
131 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
132 - }  
133 -}  
134 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/12.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 40,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "custom_id": "MJ::JOB::upsample::1::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
13 - "style": 2,  
14 - "label": "U1",  
15 - "type": 2  
16 - },  
17 - {  
18 - "custom_id": "MJ::JOB::upsample::2::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
19 - "style": 2,  
20 - "label": "U2",  
21 - "type": 2  
22 - },  
23 - {  
24 - "custom_id": "MJ::JOB::upsample::3::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
25 - "style": 2,  
26 - "label": "U3",  
27 - "type": 2  
28 - },  
29 - {  
30 - "custom_id": "MJ::JOB::upsample::4::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
31 - "style": 2,  
32 - "label": "U4",  
33 - "type": 2  
34 - },  
35 - {  
36 - "emoji": {  
37 - "name": "\uD83D\uDD04"  
38 - },  
39 - "custom_id": "MJ::JOB::reroll::0::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660::SOLO",  
40 - "style": 2,  
41 - "type": 2  
42 - }  
43 - ],  
44 - "type": 1  
45 - },  
46 - {  
47 - "components": [  
48 - {  
49 - "custom_id": "MJ::JOB::variation::1::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
50 - "style": 2,  
51 - "label": "V1",  
52 - "type": 2  
53 - },  
54 - {  
55 - "custom_id": "MJ::JOB::variation::2::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
56 - "style": 2,  
57 - "label": "V2",  
58 - "type": 2  
59 - },  
60 - {  
61 - "custom_id": "MJ::JOB::variation::3::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
62 - "style": 2,  
63 - "label": "V3",  
64 - "type": 2  
65 - },  
66 - {  
67 - "custom_id": "MJ::JOB::variation::4::5d32f4e8-8d2f-4bef-82d8-bf517e3c3660",  
68 - "style": 2,  
69 - "label": "V4",  
70 - "type": 2  
71 - }  
72 - ],  
73 - "type": 1  
74 - }  
75 - ],  
76 - "attachments": [  
77 - {  
78 - "filename": "andrakosq9211__5d32f4e8-8d2f-4bef-82d8-bf517e3c3660.png",  
79 - "size": 8327001,  
80 - "content_type": "image/png",  
81 - "width": 2048,  
82 - "placeholder_version": 1,  
83 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234381975058514001/andrakosq9211__5d32f4e8-8d2f-4bef-82d8-bf517e3c3660.png?ex=6630874c&is=662f35cc&hm=20a8bb9b10c68645c9bd09a52b181de8566802590d070965d0a4738387781bb6&",  
84 - "placeholder": "3dcJBwaASHWaWZZ4eNd2aHiGRwE+gLAH",  
85 - "id": "1234381975058514001",  
86 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234381975058514001/andrakosq9211__5d32f4e8-8d2f-4bef-82d8-bf517e3c3660.png?ex=6630874c&is=662f35cc&hm=20a8bb9b10c68645c9bd09a52b181de8566802590d070965d0a4738387781bb6&",  
87 - "height": 2048  
88 - }  
89 - ],  
90 - "author": {  
91 - "global_name": null,  
92 - "bot": true,  
93 - "avatar_decoration_data": null,  
94 - "clan": null,  
95 - "public_flags": 589824,  
96 - "id": "936929561302675456",  
97 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
98 - "username": "Midjourney Bot",  
99 - "discriminator": "9282"  
100 - },  
101 - "flags": 0,  
102 - "type": 0,  
103 - "mention_roles": [],  
104 - "edited_timestamp": null,  
105 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (relaxed)",  
106 - "tts": false,  
107 - "referenced_message": null,  
108 - "mentions": [  
109 - {  
110 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
111 - "avatar_decoration_data": null,  
112 - "member": {  
113 - "premium_since": null,  
114 - "nick": null,  
115 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
116 - "communication_disabled_until": null,  
117 - "roles": [],  
118 - "pending": false,  
119 - "flags": 0,  
120 - "deaf": false,  
121 - "mute": false,  
122 - "avatar": null  
123 - },  
124 - "clan": null,  
125 - "public_flags": 0,  
126 - "id": "975372485971312700",  
127 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
128 - "username": "andrakosq9211",  
129 - "discriminator": "0"  
130 - }  
131 - ],  
132 - "member": {  
133 - "premium_since": null,  
134 - "nick": null,  
135 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
136 - "communication_disabled_until": null,  
137 - "roles": [  
138 - "1234355760184561747"  
139 - ],  
140 - "pending": false,  
141 - "flags": 0,  
142 - "deaf": false,  
143 - "mute": false,  
144 - "avatar": null  
145 - },  
146 - "guild_id": "1234355413420347402",  
147 - "id": "1234381975335342122",  
148 - "embeds": [],  
149 - "channel_id": "1234380679576424448",  
150 - "timestamp": "2024-04-29T05:53:16.628000+00:00"  
151 - }  
152 -}  
153 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/2.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 30,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:52:42.826454+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (0%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/3.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 31,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:52:48.793794+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (10%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/4.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 32,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:52:48.976941+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (20%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/5.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 33,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:52:54.993089+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (22%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/6.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 34,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:52:55.667426+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (32%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/7.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 35,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234381513597128715",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 0,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T05:53:01.235104+00:00",  
45 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (35%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "member": {  
53 - "premium_since": null,  
54 - "nick": null,  
55 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
56 - "communication_disabled_until": null,  
57 - "roles": [],  
58 - "pending": false,  
59 - "flags": 0,  
60 - "deaf": false,  
61 - "mute": false,  
62 - "avatar": null  
63 - },  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "member": {  
73 - "premium_since": null,  
74 - "nick": null,  
75 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
76 - "communication_disabled_until": null,  
77 - "roles": [  
78 - "1234355760184561747"  
79 - ],  
80 - "pending": false,  
81 - "flags": 0,  
82 - "deaf": false,  
83 - "mute": false,  
84 - "avatar": null  
85 - },  
86 - "interaction": {  
87 - "name": "imagine",  
88 - "member": {  
89 - "premium_since": null,  
90 - "nick": null,  
91 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
92 - "communication_disabled_until": null,  
93 - "roles": [],  
94 - "pending": false,  
95 - "flags": 0,  
96 - "deaf": false,  
97 - "mute": false,  
98 - "avatar": null  
99 - },  
100 - "id": "1234381513597128715",  
101 - "type": 2,  
102 - "user": {  
103 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
104 - "avatar_decoration_data": null,  
105 - "clan": null,  
106 - "public_flags": 0,  
107 - "id": "975372485971312700",  
108 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
109 - "username": "andrakosq9211",  
110 - "discriminator": "0"  
111 - }  
112 - },  
113 - "guild_id": "1234355413420347402",  
114 - "position": 0,  
115 - "id": "1234381516130357379",  
116 - "embeds": [],  
117 - "channel_id": "1234380679576424448",  
118 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
119 - }  
120 -}  
121 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/8.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 36,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [  
10 - {  
11 - "filename": "5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp",  
12 - "size": 43912,  
13 - "content_type": "image/webp",  
14 - "width": 512,  
15 - "placeholder_version": 1,  
16 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234381927348436992/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308741&is=662f35c1&hm=eb4abbb4ede30b588e02eba7c18203177dcea82612ee981bde696346f1d887ac&",  
17 - "placeholder": "WpcRLxZwanaXh4d4h6d2aIeG92d6hbAH",  
18 - "id": "1234381927348436992",  
19 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234381927348436992/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308741&is=662f35c1&hm=eb4abbb4ede30b588e02eba7c18203177dcea82612ee981bde696346f1d887ac&",  
20 - "height": 512  
21 - }  
22 - ],  
23 - "interaction_metadata": {  
24 - "user_id": "975372485971312700",  
25 - "name": "imagine",  
26 - "authorizing_integration_owners": {  
27 - "0": "1234355413420347402"  
28 - },  
29 - "id": "1234381513597128715",  
30 - "type": 2,  
31 - "user": {  
32 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
33 - "avatar_decoration_data": null,  
34 - "clan": null,  
35 - "public_flags": 0,  
36 - "id": "975372485971312700",  
37 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
38 - "username": "andrakosq9211",  
39 - "discriminator": "0"  
40 - }  
41 - },  
42 - "author": {  
43 - "global_name": null,  
44 - "bot": true,  
45 - "avatar_decoration_data": null,  
46 - "clan": null,  
47 - "public_flags": 589824,  
48 - "id": "936929561302675456",  
49 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
50 - "username": "Midjourney Bot",  
51 - "discriminator": "9282"  
52 - },  
53 - "flags": 0,  
54 - "type": 20,  
55 - "mention_roles": [],  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": "2024-04-29T05:53:05.164746+00:00",  
58 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (35%) (relaxed)",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [  
62 - {  
63 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
64 - "avatar_decoration_data": null,  
65 - "member": {  
66 - "premium_since": null,  
67 - "nick": null,  
68 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
69 - "communication_disabled_until": null,  
70 - "roles": [],  
71 - "pending": false,  
72 - "flags": 0,  
73 - "deaf": false,  
74 - "mute": false,  
75 - "avatar": null  
76 - },  
77 - "clan": null,  
78 - "public_flags": 0,  
79 - "id": "975372485971312700",  
80 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
81 - "username": "andrakosq9211",  
82 - "discriminator": "0"  
83 - }  
84 - ],  
85 - "member": {  
86 - "premium_since": null,  
87 - "nick": null,  
88 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
89 - "communication_disabled_until": null,  
90 - "roles": [  
91 - "1234355760184561747"  
92 - ],  
93 - "pending": false,  
94 - "flags": 0,  
95 - "deaf": false,  
96 - "mute": false,  
97 - "avatar": null  
98 - },  
99 - "interaction": {  
100 - "name": "imagine",  
101 - "member": {  
102 - "premium_since": null,  
103 - "nick": null,  
104 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
105 - "communication_disabled_until": null,  
106 - "roles": [],  
107 - "pending": false,  
108 - "flags": 0,  
109 - "deaf": false,  
110 - "mute": false,  
111 - "avatar": null  
112 - },  
113 - "id": "1234381513597128715",  
114 - "type": 2,  
115 - "user": {  
116 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
117 - "avatar_decoration_data": null,  
118 - "clan": null,  
119 - "public_flags": 0,  
120 - "id": "975372485971312700",  
121 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
122 - "username": "andrakosq9211",  
123 - "discriminator": "0"  
124 - }  
125 - },  
126 - "guild_id": "1234355413420347402",  
127 - "position": 0,  
128 - "id": "1234381516130357379",  
129 - "embeds": [],  
130 - "channel_id": "1234380679576424448",  
131 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
132 - }  
133 -}  
134 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/9.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 37,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [  
10 - {  
11 - "filename": "5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp",  
12 - "size": 27876,  
13 - "content_type": "image/webp",  
14 - "width": 512,  
15 - "placeholder_version": 1,  
16 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234381937288679506/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308743&is=662f35c3&hm=ccebcb830d6e76127164767721ebf18ec3bc1e9acf8d61481b5f755e89caf8b8&",  
17 - "placeholder": "G7cJFwqCeYiHeId5h/h2eHmU9xeHc7AG",  
18 - "id": "1234381937288679506",  
19 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234381937288679506/5d32f4e8-8d2f-4bef-82d8-bf517e3c3660_grid_0.webp?ex=66308743&is=662f35c3&hm=ccebcb830d6e76127164767721ebf18ec3bc1e9acf8d61481b5f755e89caf8b8&",  
20 - "height": 512  
21 - }  
22 - ],  
23 - "interaction_metadata": {  
24 - "user_id": "975372485971312700",  
25 - "name": "imagine",  
26 - "authorizing_integration_owners": {  
27 - "0": "1234355413420347402"  
28 - },  
29 - "id": "1234381513597128715",  
30 - "type": 2,  
31 - "user": {  
32 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
33 - "avatar_decoration_data": null,  
34 - "clan": null,  
35 - "public_flags": 0,  
36 - "id": "975372485971312700",  
37 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
38 - "username": "andrakosq9211",  
39 - "discriminator": "0"  
40 - }  
41 - },  
42 - "author": {  
43 - "global_name": null,  
44 - "bot": true,  
45 - "avatar_decoration_data": null,  
46 - "clan": null,  
47 - "public_flags": 589824,  
48 - "id": "936929561302675456",  
49 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
50 - "username": "Midjourney Bot",  
51 - "discriminator": "9282"  
52 - },  
53 - "flags": 0,  
54 - "type": 20,  
55 - "mention_roles": [],  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": "2024-04-29T05:53:07.496257+00:00",  
58 - "content": "**海贼王,在赶海! --v 6.0** - <@975372485971312700> (55%) (relaxed)",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [  
62 - {  
63 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
64 - "avatar_decoration_data": null,  
65 - "member": {  
66 - "premium_since": null,  
67 - "nick": null,  
68 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
69 - "communication_disabled_until": null,  
70 - "roles": [],  
71 - "pending": false,  
72 - "flags": 0,  
73 - "deaf": false,  
74 - "mute": false,  
75 - "avatar": null  
76 - },  
77 - "clan": null,  
78 - "public_flags": 0,  
79 - "id": "975372485971312700",  
80 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
81 - "username": "andrakosq9211",  
82 - "discriminator": "0"  
83 - }  
84 - ],  
85 - "member": {  
86 - "premium_since": null,  
87 - "nick": null,  
88 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
89 - "communication_disabled_until": null,  
90 - "roles": [  
91 - "1234355760184561747"  
92 - ],  
93 - "pending": false,  
94 - "flags": 0,  
95 - "deaf": false,  
96 - "mute": false,  
97 - "avatar": null  
98 - },  
99 - "interaction": {  
100 - "name": "imagine",  
101 - "member": {  
102 - "premium_since": null,  
103 - "nick": null,  
104 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
105 - "communication_disabled_until": null,  
106 - "roles": [],  
107 - "pending": false,  
108 - "flags": 0,  
109 - "deaf": false,  
110 - "mute": false,  
111 - "avatar": null  
112 - },  
113 - "id": "1234381513597128715",  
114 - "type": 2,  
115 - "user": {  
116 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
117 - "avatar_decoration_data": null,  
118 - "clan": null,  
119 - "public_flags": 0,  
120 - "id": "975372485971312700",  
121 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
122 - "username": "andrakosq9211",  
123 - "discriminator": "0"  
124 - }  
125 - },  
126 - "guild_id": "1234355413420347402",  
127 - "position": 0,  
128 - "id": "1234381516130357379",  
129 - "embeds": [],  
130 - "channel_id": "1234380679576424448",  
131 - "timestamp": "2024-04-29T05:51:27.145000+00:00"  
132 - }  
133 -}  
134 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/Cancel Job按钮的消息体.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 1112,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "custom_id": "MJ::CancelJob::ByJobid::a58fcee9-ec89-4471-aff3-088615fc78f2",  
13 - "style": 4,  
14 - "label": "Cancel Job",  
15 - "type": 2  
16 - }  
17 - ],  
18 - "type": 1  
19 - }  
20 - ],  
21 - "attachments": [],  
22 - "interaction_metadata": {  
23 - "user_id": "975372485971312700",  
24 - "interacted_message_id": "1234503859578081381",  
25 - "authorizing_integration_owners": {  
26 - "0": "1234355413420347402"  
27 - },  
28 - "id": "1234506142236020767",  
29 - "type": 3,  
30 - "user": {  
31 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 0,  
35 - "id": "975372485971312700",  
36 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
37 - "username": "andrakosq9211",  
38 - "discriminator": "0"  
39 - }  
40 - },  
41 - "author": {  
42 - "global_name": null,  
43 - "bot": true,  
44 - "avatar_decoration_data": null,  
45 - "clan": null,  
46 - "public_flags": 589824,  
47 - "id": "936929561302675456",  
48 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
49 - "username": "Midjourney Bot",  
50 - "discriminator": "9282"  
51 - },  
52 - "flags": 64,  
53 - "type": 19,  
54 - "mention_roles": [],  
55 - "application_id": "936929561302675456",  
56 - "edited_timestamp": "2024-04-29T14:06:46.866376+00:00",  
57 - "content": "**A girl from China, creator of ancient Chinese clothing, dances on the square --v 6.0 --ar 3:2** - Variations (Strong) by <@975372485971312700> (0%) (relaxed)",  
58 - "tts": false,  
59 - "webhook_id": "936929561302675456",  
60 - "mentions": [  
61 - {  
62 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
63 - "avatar_decoration_data": null,  
64 - "clan": null,  
65 - "public_flags": 0,  
66 - "id": "975372485971312700",  
67 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
68 - "username": "andrakosq9211",  
69 - "discriminator": "0"  
70 - }  
71 - ],  
72 - "position": 0,  
73 - "message_reference": {  
74 - "guild_id": "1234355413420347402",  
75 - "message_id": "1234503859578081381",  
76 - "type": 0,  
77 - "channel_id": "1234380679576424448"  
78 - },  
79 - "id": "1234506143943102605",  
80 - "embeds": [],  
81 - "channel_id": "1234380679576424448",  
82 - "timestamp": "2024-04-29T14:06:40.731000+00:00"  
83 - }  
84 -}  
85 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/MessageUpdate-1.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 47,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [  
10 - {  
11 - "filename": "97b1c75b-41c2-4dfe-bb7d-e61fbea8f1c7_grid_0.webp",  
12 - "size": 71390,  
13 - "content_type": "image/webp",  
14 - "width": 512,  
15 - "ephemeral": true,  
16 - "placeholder_version": 1,  
17 - "proxy_url": "https://media.discordapp.net/ephemeral-attachments/1234380679576424448/1234437493542359114/97b1c75b-41c2-4dfe-bb7d-e61fbea8f1c7_grid_0.webp?ex=6630bb01&is=662f6981&hm=60e610be44d3ae5fec8f1cbfb791997a627901d132a24e4364ac663362ab9a30&",  
18 - "placeholder": "XQgKBYJ8H3aDh3eHiAeIecB0Bsl2",  
19 - "id": "1234437493542359114",  
20 - "url": "https://cdn.discordapp.com/ephemeral-attachments/1234380679576424448/1234437493542359114/97b1c75b-41c2-4dfe-bb7d-e61fbea8f1c7_grid_0.webp?ex=6630bb01&is=662f6981&hm=60e610be44d3ae5fec8f1cbfb791997a627901d132a24e4364ac663362ab9a30&",  
21 - "height": 340  
22 - }  
23 - ],  
24 - "interaction_metadata": {  
25 - "user_id": "975372485971312700",  
26 - "interacted_message_id": "1234433732761620500",  
27 - "authorizing_integration_owners": {  
28 - "0": "1234355413420347402"  
29 - },  
30 - "id": "1234436261440126977",  
31 - "type": 3,  
32 - "user": {  
33 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
34 - "avatar_decoration_data": null,  
35 - "clan": null,  
36 - "public_flags": 0,  
37 - "id": "975372485971312700",  
38 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
39 - "username": "andrakosq9211",  
40 - "discriminator": "0"  
41 - }  
42 - },  
43 - "author": {  
44 - "global_name": null,  
45 - "bot": true,  
46 - "avatar_decoration_data": null,  
47 - "clan": null,  
48 - "public_flags": 589824,  
49 - "id": "936929561302675456",  
50 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
51 - "username": "Midjourney Bot",  
52 - "discriminator": "9282"  
53 - },  
54 - "flags": 64,  
55 - "type": 19,  
56 - "mention_roles": [],  
57 - "application_id": "936929561302675456",  
58 - "edited_timestamp": "2024-04-29T09:33:53.172018+00:00",  
59 - "content": "**A girl from China, creator of ancient Chinese clothing, dances on the square --ar 3:2** - Pan Right by <@975372485971312700> (35%) (relaxed)",  
60 - "tts": false,  
61 - "webhook_id": "936929561302675456",  
62 - "mentions": [  
63 - {  
64 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
65 - "avatar_decoration_data": null,  
66 - "clan": null,  
67 - "public_flags": 0,  
68 - "id": "975372485971312700",  
69 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
70 - "username": "andrakosq9211",  
71 - "discriminator": "0"  
72 - }  
73 - ],  
74 - "position": 0,  
75 - "message_reference": {  
76 - "guild_id": "1234355413420347402",  
77 - "message_id": "1234433732761620500",  
78 - "type": 0,  
79 - "channel_id": "1234380679576424448"  
80 - },  
81 - "id": "1234436266045608016",  
82 - "embeds": [],  
83 - "channel_id": "1234380679576424448",  
84 - "timestamp": "2024-04-29T09:29:00.542000+00:00"  
85 - }  
86 -}  
87 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/mj敏感词返回信息.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 5,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "custom_id": "MJ::Prompts::LLMComplaintSubmit::8d706b5c-36d9-4ef5-af2e-b778c876e39b",  
13 - "style": 2,  
14 - "label": "Notify developers",  
15 - "type": 2  
16 - }  
17 - ],  
18 - "type": 1  
19 - }  
20 - ],  
21 - "attachments": [],  
22 - "interaction_metadata": {  
23 - "user_id": "975372485971312700",  
24 - "name": "imagine",  
25 - "authorizing_integration_owners": {  
26 - "0": "1234355413420347402"  
27 - },  
28 - "id": "1234381275448479744",  
29 - "type": 2,  
30 - "user": {  
31 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 0,  
35 - "id": "975372485971312700",  
36 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
37 - "username": "andrakosq9211",  
38 - "discriminator": "0"  
39 - }  
40 - },  
41 - "author": {  
42 - "global_name": null,  
43 - "bot": true,  
44 - "avatar_decoration_data": null,  
45 - "clan": null,  
46 - "public_flags": 589824,  
47 - "id": "936929561302675456",  
48 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
49 - "username": "Midjourney Bot",  
50 - "discriminator": "9282"  
51 - },  
52 - "flags": 64,  
53 - "type": 20,  
54 - "mention_roles": [],  
55 - "nonce": "1784822542798630912",  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": null,  
58 - "content": "",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [],  
62 - "interaction": {  
63 - "name": "imagine",  
64 - "id": "1234381275448479744",  
65 - "type": 2,  
66 - "user": {  
67 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
68 - "avatar_decoration_data": null,  
69 - "clan": null,  
70 - "public_flags": 0,  
71 - "id": "975372485971312700",  
72 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
73 - "username": "andrakosq9211",  
74 - "discriminator": "0"  
75 - }  
76 - },  
77 - "position": 0,  
78 - "id": "1234381284084809749",  
79 - "embeds": [  
80 - {  
81 - "content_scan_version": 0,  
82 - "color": 16711680,  
83 - "footer": {  
84 - "text": "/imagine 性感车模,站在车上! --v 6"  
85 - },  
86 - "description": "Sorry! Our AI moderator thinks this prompt is probably against our community standards.\n\nPlease review our current community standards:\n\n**ALLOWED**\n- Any image up to PG-13 rating involving fiction, fantasy, mythology.\n- Real images that may be seen as respectful or light-hearted parodies, satire, caricatures\n- Imaginary or exaggerated real-life scenarios, including absurd or humorous situations.\n\n**NOT ALLOWED**\n- Disrespectful, harmful, misleading public figures/events portrayals or potential to mislead.\n- Hate speech, explicit or real-world violence.\n- Nudity or unconsented overtly sexualized public figures.\n- Imagery that might be considered culturally insensitive\n\nThis AI system isn't perfect. If you find it rejecting something innocent please press the **Notify Developers** button and we will review it and try to further improve our performance. Thank you for your help!",  
87 - "type": "rich",  
88 - "title": "Banned prompt detected"  
89 - }  
90 - ],  
91 - "channel_id": "1234380679576424448",  
92 - "timestamp": "2024-04-29T05:50:31.821000+00:00"  
93 - }  
94 -}  
95 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/mj服务器封号返回信息.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 5,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "972721304891453450",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1225608134878302329"  
15 - },  
16 - "id": "1234353096516173844",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "tiger",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "972721304891453450",  
24 - "avatar": "3646118d04fd12dfd301c4fd17afd801",  
25 - "username": "jverbalu4990",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 64,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "nonce": "1784794363249700864",  
44 - "application_id": "936929561302675456",  
45 - "edited_timestamp": null,  
46 - "content": "",  
47 - "tts": false,  
48 - "webhook_id": "936929561302675456",  
49 - "mentions": [],  
50 - "interaction": {  
51 - "name": "imagine",  
52 - "id": "1234353096516173844",  
53 - "type": 2,  
54 - "user": {  
55 - "global_name": "tiger",  
56 - "avatar_decoration_data": null,  
57 - "clan": null,  
58 - "public_flags": 0,  
59 - "id": "972721304891453450",  
60 - "avatar": "3646118d04fd12dfd301c4fd17afd801",  
61 - "username": "jverbalu4990",  
62 - "discriminator": "0"  
63 - }  
64 - },  
65 - "position": 0,  
66 - "id": "1234353097535393822",  
67 - "embeds": [  
68 - {  
69 - "content_scan_version": 0,  
70 - "color": 16711680,  
71 - "footer": {  
72 - "text": "/imagine 中国长城 --ar 1:1 --niji 6"  
73 - },  
74 - "description": "You have been blocked from accessing Midjourney. This happens on repeated or serious ToS violations.",  
75 - "type": "rich",  
76 - "title": "Blocked"  
77 - }  
78 - ],  
79 - "channel_id": "1225608134878302332",  
80 - "timestamp": "2024-04-29T03:58:31.624000+00:00"  
81 - }  
82 -}  
83 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/nonce错误信息.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 24,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "emoji": {  
13 - "name": "upscale_1",  
14 - "id": "940147353879478324"  
15 - },  
16 - "custom_id": "MJ::JOB::upsample_v6_2x_subtle::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
17 - "style": 2,  
18 - "label": "Upscale (Subtle)",  
19 - "type": 2  
20 - },  
21 - {  
22 - "emoji": {  
23 - "name": "upscale_1",  
24 - "id": "940147353879478324"  
25 - },  
26 - "custom_id": "MJ::JOB::upsample_v6_2x_creative::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
27 - "style": 2,  
28 - "label": "Upscale (Creative)",  
29 - "type": 2  
30 - },  
31 - {  
32 - "emoji": {  
33 - "name": "🪄"  
34 - },  
35 - "custom_id": "MJ::JOB::low_variation::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
36 - "style": 2,  
37 - "label": "Vary (Subtle)",  
38 - "type": 2  
39 - },  
40 - {  
41 - "emoji": {  
42 - "name": "🪄"  
43 - },  
44 - "custom_id": "MJ::JOB::high_variation::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
45 - "style": 2,  
46 - "label": "Vary (Strong)",  
47 - "type": 2  
48 - },  
49 - {  
50 - "emoji": {  
51 - "name": "🖌️"  
52 - },  
53 - "custom_id": "MJ::Inpaint::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
54 - "style": 2,  
55 - "label": "Vary (Region)",  
56 - "type": 2  
57 - }  
58 - ],  
59 - "type": 1  
60 - },  
61 - {  
62 - "components": [  
63 - {  
64 - "emoji": {  
65 - "name": "🔍"  
66 - },  
67 - "custom_id": "MJ::Outpaint::50::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
68 - "style": 4,  
69 - "label": "Zoom Out 2x",  
70 - "type": 2  
71 - },  
72 - {  
73 - "emoji": {  
74 - "name": "🔍"  
75 - },  
76 - "custom_id": "MJ::Outpaint::75::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
77 - "style": 2,  
78 - "label": "Zoom Out 1.5x",  
79 - "type": 2  
80 - },  
81 - {  
82 - "emoji": {  
83 - "name": "🔍"  
84 - },  
85 - "custom_id": "MJ::CustomZoom::519cd956-d02e-4ae2-b62d-17c499dbbe3f",  
86 - "style": 2,  
87 - "label": "Custom Zoom",  
88 - "type": 2  
89 - }  
90 - ],  
91 - "type": 1  
92 - },  
93 - {  
94 - "components": [  
95 - {  
96 - "emoji": {  
97 - "name": "⬅️"  
98 - },  
99 - "custom_id": "MJ::JOB::pan_left::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
100 - "style": 2,  
101 - "type": 2  
102 - },  
103 - {  
104 - "emoji": {  
105 - "name": "➡️"  
106 - },  
107 - "custom_id": "MJ::JOB::pan_right::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
108 - "style": 2,  
109 - "type": 2  
110 - },  
111 - {  
112 - "emoji": {  
113 - "name": "⬆️"  
114 - },  
115 - "custom_id": "MJ::JOB::pan_up::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
116 - "style": 2,  
117 - "type": 2  
118 - },  
119 - {  
120 - "emoji": {  
121 - "name": "⬇️"  
122 - },  
123 - "custom_id": "MJ::JOB::pan_down::1::519cd956-d02e-4ae2-b62d-17c499dbbe3f::SOLO",  
124 - "style": 2,  
125 - "type": 2  
126 - }  
127 - ],  
128 - "type": 1  
129 - },  
130 - {  
131 - "components": [  
132 - {  
133 - "emoji": {  
134 - "name": "❤️"  
135 - },  
136 - "custom_id": "MJ::BOOKMARK::519cd956-d02e-4ae2-b62d-17c499dbbe3f",  
137 - "style": 2,  
138 - "type": 2  
139 - },  
140 - {  
141 - "style": 5,  
142 - "label": "Web",  
143 - "type": 2,  
144 - "url": "https://www.midjourney.com/app/jobs/519cd956-d02e-4ae2-b62d-17c499dbbe3f/"  
145 - }  
146 - ],  
147 - "type": 1  
148 - }  
149 - ],  
150 - "attachments": [  
151 - {  
152 - "filename": "andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_519cd956-d02e-4ae2-b62d-17c499dbbe3f.png",  
153 - "size": 2014189,  
154 - "content_type": "image/png",  
155 - "width": 1024,  
156 - "placeholder_version": 1,  
157 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234433732341927976/andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_519cd956-d02e-4ae2-b62d-17c499dbbe3f.png?ex=6630b780&is=662f6600&hm=8f273f74c29274431ec9b02bc4778a37ee944aa5360d10875cbbe512847b71c2&",  
158 - "placeholder": "YwgKDwKIWGiAiYd4iGh4d4h4mKz5uZwP",  
159 - "id": "1234433732341927976",  
160 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234433732341927976/andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_519cd956-d02e-4ae2-b62d-17c499dbbe3f.png?ex=6630b780&is=662f6600&hm=8f273f74c29274431ec9b02bc4778a37ee944aa5360d10875cbbe512847b71c2&",  
161 - "height": 1024  
162 - }  
163 - ],  
164 - "author": {  
165 - "global_name": null,  
166 - "bot": true,  
167 - "avatar_decoration_data": null,  
168 - "clan": null,  
169 - "public_flags": 589824,  
170 - "id": "936929561302675456",  
171 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
172 - "username": "Midjourney Bot",  
173 - "discriminator": "9282"  
174 - },  
175 - "flags": 0,  
176 - "type": 19,  
177 - "mention_roles": [],  
178 - "edited_timestamp": "2024-04-29T09:19:12.812177+00:00",  
179 - "content": "**A girl from China, creator of ancient Chinese clothing, dances on the square** - Image #3 <@975372485971312700>",  
180 - "tts": false,  
181 - "mentions": [  
182 - {  
183 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
184 - "avatar_decoration_data": null,  
185 - "member": {  
186 - "premium_since": null,  
187 - "nick": null,  
188 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
189 - "communication_disabled_until": null,  
190 - "roles": [],  
191 - "pending": false,  
192 - "flags": 0,  
193 - "deaf": false,  
194 - "mute": false,  
195 - "avatar": null  
196 - },  
197 - "clan": null,  
198 - "public_flags": 0,  
199 - "id": "975372485971312700",  
200 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
201 - "username": "andrakosq9211",  
202 - "discriminator": "0"  
203 - }  
204 - ],  
205 - "member": {  
206 - "premium_since": null,  
207 - "nick": null,  
208 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
209 - "communication_disabled_until": null,  
210 - "roles": [  
211 - "1234355760184561747"  
212 - ],  
213 - "pending": false,  
214 - "flags": 0,  
215 - "deaf": false,  
216 - "mute": false,  
217 - "avatar": null  
218 - },  
219 - "guild_id": "1234355413420347402",  
220 - "position": 0,  
221 - "message_reference": {  
222 - "guild_id": "1234355413420347402",  
223 - "message_id": "1234433346940043294",  
224 - "type": 0,  
225 - "channel_id": "1234380679576424448"  
226 - },  
227 - "id": "1234433732761620500",  
228 - "embeds": [  
229 - {  
230 - "color": 16711680,  
231 - "description": "Hey <@975372485971312700>\nYour job queue is full. Please wait for a job to finish first, then resubmit this one.\n*[Please check the bottom of the channel for more information.](https://discord.com/channels/1234355413420347402/1234380679576424448/1234433798599606315)*",  
232 - "type": "rich",  
233 - "url": "https://discord.com/channels/1234355413420347402/1234380679576424448/1234433798599606315"  
234 - }  
235 - ],  
236 - "channel_id": "1234380679576424448",  
237 - "timestamp": "2024-04-29T09:18:56.560000+00:00"  
238 - }  
239 -}  
240 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/readme.md deleted
1 -  
2 -# Midjourney 消息体解析  
3 -  
4 -```text  
5 -  
6 -{  
7 - "op": 0,  
8 - "s": 346,  
9 - "t": "MESSAGE_CREATE", // 消息类型  
10 - "d": {  
11 - "id": "1234498661476601907", // 唯一id  
12 - "mention_everyone": false,  
13 - "pinned": false,  
14 - "channel_id": "1234380679576424448", // 频道id用来只区分自己频道  
15 - "flags": 64, // flags 未知  
16 - "type": 20, // 初步理解是用于区分消息类型  
17 - "mention_roles": [],  
18 - "nonce": "18", // 重点,我们传过去的唯一id,用于区分不同的绘画  
19 - "application_id": "936929561302675456",  
20 - "edited_timestamp": null,  
21 - "content": "", // 消息内容  
22 - "tts": false,  
23 - "webhook_id": "936929561302675456",  
24 - "mentions": [],  
25 - "components": [], // U1、U2等操作  
26 - "attachments": [], // 生成的图片附件  
27 - "embeds": [] // 重点异常、提示、错误 都是在这个里面,这个里面有信息这个任务就不正常  
28 - }  
29 -}  
30 -```  
31 -  
32 -说明:  
33 -- t: 是消息类型(处理 create、和update)  
34 - - MESSAGE_CREATE:会增加一条新的信息出来  
35 - - MESSAGE_UPDATE:不会增加新的信息,在原来的信息上更新展示,比如进度条 10% 30%...  
36 - - MESSAGE_DELETE 没啥用  
37 -- components:可以理解为可以操作的按钮  
38 - - 情况1:正常只有图片完成才有对于操作  
39 - - 情况2:异常情况可以 submit 当前任务  
40 -- attachments: 附件,在图片生成到50%左右就会开始有模糊的图片,这里面就会有照片的地址  
41 -- content:正常的消息内容在这里面,一般会是一串字符串,一般有 prompt、版本、进度、状态/生成类型  
42 - - 内容示例:**海贼王,在赶海! --v 6.0** - <@975372485971312700> (0%) (relaxed)  
43 - - 内容示例:**海贼王,在赶海! --v 6.0** - <@975372485971312700> (35%) (relaxed)  
44 -- embeds: <重点> 只有错误、警告、封号、异常里面才有信息,可以优先判断这里面有没有内容,就知道是否正常!  
45 -  
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/test2.json deleted
1 -{  
2 - "type": 2,  
3 - "application_id": "936929561302675456",  
4 - "guild_id": "1237948819677904956",  
5 - "channel_id": "1237948819677904960",  
6 - "session_id": "4bdb0c32158f625bbd7f0a54bfbb54aa",  
7 - "data": {  
8 - "version": "1237876415471554623",  
9 - "id": "938956540159881230",  
10 - "name": "imagine",  
11 - "type": 1,  
12 - "options": [  
13 - {  
14 - "type": 3,  
15 - "name": "prompt",  
16 - "value": "哈哈哈"  
17 - }  
18 - ],  
19 - "application_command": {  
20 - "id": "938956540159881230",  
21 - "type": 1,  
22 - "application_id": "936929561302675456",  
23 - "version": "1237876415471554623",  
24 - "name": "imagine",  
25 - "description": "Create images with Midjourney",  
26 - "options": [  
27 - {  
28 - "type": 3,  
29 - "name": "prompt",  
30 - "description": "The prompt to imagine",  
31 - "required": true,  
32 - "description_localized": "The prompt to imagine",  
33 - "name_localized": "prompt"  
34 - }  
35 - ],  
36 - "dm_permission": true,  
37 - "contexts": [  
38 - 0,  
39 - 1,  
40 - 2  
41 - ],  
42 - "integration_types": [  
43 - 0,  
44 - 1  
45 - ],  
46 - "global_popularity_rank": 1,  
47 - "description_localized": "Create images with Midjourney",  
48 - "name_localized": "imagine"  
49 - },  
50 - "attachments": []  
51 - },  
52 - "nonce": "1238062212925358080",  
53 - "analytics_location": "slash_ui"  
54 -}  
55 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/图片放大2倍.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 119,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "interacted_message_id": "1234430088515293194",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234430127618658305",  
17 - "type": 3,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 64,  
41 - "type": 19,  
42 - "mention_roles": [],  
43 - "application_id": "936929561302675456",  
44 - "edited_timestamp": "2024-04-29T09:06:37.616666+00:00",  
45 - "content": "**A girl from China, creator of ancient Chinese clothing, dances on the square** - Zoom Out by <@975372485971312700> (22%) (relaxed)",  
46 - "tts": false,  
47 - "webhook_id": "936929561302675456",  
48 - "mentions": [  
49 - {  
50 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
51 - "avatar_decoration_data": null,  
52 - "clan": null,  
53 - "public_flags": 0,  
54 - "id": "975372485971312700",  
55 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
56 - "username": "andrakosq9211",  
57 - "discriminator": "0"  
58 - }  
59 - ],  
60 - "position": 0,  
61 - "message_reference": {  
62 - "guild_id": "1234355413420347402",  
63 - "message_id": "1234430088515293194",  
64 - "type": 0,  
65 - "channel_id": "1234380679576424448"  
66 - },  
67 - "id": "1234430128721887272",  
68 - "embeds": [],  
69 - "channel_id": "1234380679576424448",  
70 - "timestamp": "2024-04-29T09:04:37.290000+00:00"  
71 - }  
72 -}  
73 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/并发队列满提示.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 5,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "975372485971312700",  
12 - "name": "imagine",  
13 - "authorizing_integration_owners": {  
14 - "0": "1234355413420347402"  
15 - },  
16 - "id": "1234425115912179745",  
17 - "type": 2,  
18 - "user": {  
19 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
20 - "avatar_decoration_data": null,  
21 - "clan": null,  
22 - "public_flags": 0,  
23 - "id": "975372485971312700",  
24 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
25 - "username": "andrakosq9211",  
26 - "discriminator": "0"  
27 - }  
28 - },  
29 - "author": {  
30 - "global_name": null,  
31 - "bot": true,  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 589824,  
35 - "id": "936929561302675456",  
36 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
37 - "username": "Midjourney Bot",  
38 - "discriminator": "9282"  
39 - },  
40 - "flags": 64,  
41 - "type": 20,  
42 - "mention_roles": [],  
43 - "nonce": "1234425114066419712",  
44 - "application_id": "936929561302675456",  
45 - "edited_timestamp": null,  
46 - "content": "",  
47 - "tts": false,  
48 - "webhook_id": "936929561302675456",  
49 - "mentions": [],  
50 - "interaction": {  
51 - "name": "imagine",  
52 - "id": "1234425115912179745",  
53 - "type": 2,  
54 - "user": {  
55 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
56 - "avatar_decoration_data": null,  
57 - "clan": null,  
58 - "public_flags": 0,  
59 - "id": "975372485971312700",  
60 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
61 - "username": "andrakosq9211",  
62 - "discriminator": "0"  
63 - }  
64 - },  
65 - "position": 0,  
66 - "id": "1234425117380182102",  
67 - "embeds": [  
68 - {  
69 - "content_scan_version": 0,  
70 - "color": 16239475,  
71 - "footer": {  
72 - "text": "/imagine Cartoon car"  
73 - },  
74 - "description": "You have reached the maximum allowed number of concurrent jobs. Don't worry, this job will start as soon as another one finishes!",  
75 - "type": "rich",  
76 - "title": "Job queued"  
77 - }  
78 - ],  
79 - "channel_id": "1234380679576424448",  
80 - "timestamp": "2024-04-29T08:44:42.493000+00:00"  
81 - }  
82 -}  
83 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/您的工作队列已满。请先等待作业完成,然后重新提交此作业。.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 1861,  
4 - "t": "MESSAGE_UPDATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "custom_id": "MJ::JOB::upsample::1::a58fcee9-ec89-4471-aff3-088615fc78f2",  
13 - "style": 2,  
14 - "label": "U1",  
15 - "type": 2  
16 - },  
17 - {  
18 - "custom_id": "MJ::JOB::upsample::2::a58fcee9-ec89-4471-aff3-088615fc78f2",  
19 - "style": 2,  
20 - "label": "U2",  
21 - "type": 2  
22 - },  
23 - {  
24 - "custom_id": "MJ::JOB::upsample::3::a58fcee9-ec89-4471-aff3-088615fc78f2",  
25 - "style": 2,  
26 - "label": "U3",  
27 - "type": 2  
28 - },  
29 - {  
30 - "custom_id": "MJ::JOB::upsample::4::a58fcee9-ec89-4471-aff3-088615fc78f2",  
31 - "style": 2,  
32 - "label": "U4",  
33 - "type": 2  
34 - },  
35 - {  
36 - "emoji": {  
37 - "name": "🔄"  
38 - },  
39 - "custom_id": "MJ::JOB::reroll::0::a58fcee9-ec89-4471-aff3-088615fc78f2::SOLO",  
40 - "style": 1,  
41 - "type": 2  
42 - }  
43 - ],  
44 - "type": 1  
45 - },  
46 - {  
47 - "components": [  
48 - {  
49 - "custom_id": "MJ::JOB::variation::1::a58fcee9-ec89-4471-aff3-088615fc78f2",  
50 - "style": 2,  
51 - "label": "V1",  
52 - "type": 2  
53 - },  
54 - {  
55 - "custom_id": "MJ::JOB::variation::2::a58fcee9-ec89-4471-aff3-088615fc78f2",  
56 - "style": 2,  
57 - "label": "V2",  
58 - "type": 2  
59 - },  
60 - {  
61 - "custom_id": "MJ::JOB::variation::3::a58fcee9-ec89-4471-aff3-088615fc78f2",  
62 - "style": 2,  
63 - "label": "V3",  
64 - "type": 2  
65 - },  
66 - {  
67 - "custom_id": "MJ::JOB::variation::4::a58fcee9-ec89-4471-aff3-088615fc78f2",  
68 - "style": 2,  
69 - "label": "V4",  
70 - "type": 2  
71 - }  
72 - ],  
73 - "type": 1  
74 - }  
75 - ],  
76 - "attachments": [  
77 - {  
78 - "filename": "andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_a58fcee9-ec89-4471-aff3-088615fc78f2.png",  
79 - "size": 8558317,  
80 - "content_type": "image/png",  
81 - "width": 2688,  
82 - "placeholder_version": 1,  
83 - "proxy_url": "https://media.discordapp.net/attachments/1234380679576424448/1234506591949291592/andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_a58fcee9-ec89-4471-aff3-088615fc78f2.png?ex=6630fb5b&is=662fa9db&hm=ce38fbb4da6acca7a545fadf53f1bfaa3096e04fe68d24750104a2e66719f84d&",  
84 - "placeholder": "YAgGBYBYFZeDa5eHegdnZ/3Erv7s",  
85 - "id": "1234506591949291592",  
86 - "url": "https://cdn.discordapp.com/attachments/1234380679576424448/1234506591949291592/andrakosq9211_A_girl_from_China_creator_of_ancient_Chinese_clot_a58fcee9-ec89-4471-aff3-088615fc78f2.png?ex=6630fb5b&is=662fa9db&hm=ce38fbb4da6acca7a545fadf53f1bfaa3096e04fe68d24750104a2e66719f84d&",  
87 - "height": 1792  
88 - }  
89 - ],  
90 - "author": {  
91 - "global_name": null,  
92 - "bot": true,  
93 - "avatar_decoration_data": null,  
94 - "clan": null,  
95 - "public_flags": 589824,  
96 - "id": "936929561302675456",  
97 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
98 - "username": "Midjourney Bot",  
99 - "discriminator": "9282"  
100 - },  
101 - "flags": 0,  
102 - "type": 19,  
103 - "mention_roles": [],  
104 - "edited_timestamp": "2024-04-29T14:16:39.564000+00:00",  
105 - "content": "**A girl from China, creator of ancient Chinese clothing, dances on the square --v 6.0 --ar 3:2** - Variations (Strong) by <@975372485971312700> (relaxed)",  
106 - "tts": false,  
107 - "mentions": [  
108 - {  
109 - "global_name": "禁止挂软件刷图,逮到删服务器,踢设备,永久拉黑!!!",  
110 - "avatar_decoration_data": null,  
111 - "member": {  
112 - "premium_since": null,  
113 - "nick": null,  
114 - "joined_at": "2024-04-29T04:07:43.807000+00:00",  
115 - "communication_disabled_until": null,  
116 - "roles": [],  
117 - "pending": false,  
118 - "flags": 0,  
119 - "deaf": false,  
120 - "mute": false,  
121 - "avatar": null  
122 - },  
123 - "clan": null,  
124 - "public_flags": 0,  
125 - "id": "975372485971312700",  
126 - "avatar": "90ab939feddeaea32e23d066ce66d0e6",  
127 - "username": "andrakosq9211",  
128 - "discriminator": "0"  
129 - }  
130 - ],  
131 - "member": {  
132 - "premium_since": null,  
133 - "nick": null,  
134 - "joined_at": "2024-04-29T04:09:06.489349+00:00",  
135 - "communication_disabled_until": null,  
136 - "roles": [  
137 - "1234355760184561747"  
138 - ],  
139 - "pending": false,  
140 - "flags": 0,  
141 - "deaf": false,  
142 - "mute": false,  
143 - "avatar": null  
144 - },  
145 - "guild_id": "1234355413420347402",  
146 - "position": 0,  
147 - "message_reference": {  
148 - "guild_id": "1234355413420347402",  
149 - "message_id": "1234503859578081381",  
150 - "type": 0,  
151 - "channel_id": "1234380679576424448"  
152 - },  
153 - "id": "1234506592565596251",  
154 - "embeds": [  
155 - {  
156 - "color": 16711680,  
157 - "description": "Hey <@975372485971312700>\nYour job queue is full. Please wait for a job to finish first, then resubmit this one.\n*[Please check the bottom of the channel for more information.](https://discord.com/channels/1234355413420347402/1234380679576424448/1234508653562826822)*",  
158 - "type": "rich",  
159 - "url": "https://discord.com/channels/1234355413420347402/1234380679576424448/1234508653562826822"  
160 - }  
161 - ],  
162 - "channel_id": "1234380679576424448",  
163 - "timestamp": "2024-04-29T14:08:27.691000+00:00"  
164 - }  
165 -}  
166 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/imageGenerationProcess/队列满.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 34,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [  
9 - {  
10 - "components": [  
11 - {  
12 - "custom_id": "MJ::Job::Retry::64a7ec94-9607-492e-99ac-8550a4e7faf2",  
13 - "style": 2,  
14 - "label": "Resubmit",  
15 - "type": 2  
16 - }  
17 - ],  
18 - "type": 1  
19 - }  
20 - ],  
21 - "attachments": [],  
22 - "interaction_metadata": {  
23 - "user_id": "976067621160108072",  
24 - "name": "imagine",  
25 - "authorizing_integration_owners": {  
26 - "0": "1234483730148626542"  
27 - },  
28 - "id": "1234491017005105172",  
29 - "type": 2,  
30 - "user": {  
31 - "global_name": "Sequoiab",  
32 - "avatar_decoration_data": null,  
33 - "clan": null,  
34 - "public_flags": 0,  
35 - "id": "976067621160108072",  
36 - "avatar": "2ef47ed59695ff8bcdc2254f5189b70c",  
37 - "username": "sequoiab2281",  
38 - "discriminator": "0"  
39 - }  
40 - },  
41 - "author": {  
42 - "global_name": null,  
43 - "bot": true,  
44 - "avatar_decoration_data": null,  
45 - "clan": null,  
46 - "public_flags": 589824,  
47 - "id": "936929561302675456",  
48 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
49 - "username": "Midjourney Bot",  
50 - "discriminator": "9282"  
51 - },  
52 - "flags": 64,  
53 - "type": 20,  
54 - "mention_roles": [],  
55 - "nonce": "1234491015356743680",  
56 - "application_id": "936929561302675456",  
57 - "edited_timestamp": null,  
58 - "content": "",  
59 - "tts": false,  
60 - "webhook_id": "936929561302675456",  
61 - "mentions": [],  
62 - "interaction": {  
63 - "name": "imagine",  
64 - "id": "1234491017005105172",  
65 - "type": 2,  
66 - "user": {  
67 - "global_name": "Sequoiab",  
68 - "avatar_decoration_data": null,  
69 - "clan": null,  
70 - "public_flags": 0,  
71 - "id": "976067621160108072",  
72 - "avatar": "2ef47ed59695ff8bcdc2254f5189b70c",  
73 - "username": "sequoiab2281",  
74 - "discriminator": "0"  
75 - }  
76 - },  
77 - "position": 0,  
78 - "id": "1234491019211575376",  
79 - "embeds": [  
80 - {  
81 - "content_scan_version": 0,  
82 - "color": 16711680,  
83 - "footer": {  
84 - "text": "/imagine Doctor Strange vs. Ultraman --v 6"  
85 - },  
86 - "description": "Your job queue is full. Please wait for a job to finish first, then resubmit this one.",  
87 - "type": "rich",  
88 - "title": "Queue full"  
89 - }  
90 - ],  
91 - "channel_id": "1234490728575533057",  
92 - "timestamp": "2024-04-29T13:06:34.714000+00:00"  
93 - }  
94 -}  
95 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/interactions_type2.json deleted
1 -{  
2 - "type": 2,  
3 - "application_id": "936929561302675456",  
4 - "guild_id": "1221445697157468200",  
5 - "channel_id": "1221445862962630706",  
6 - "session_id": "696318caed5180a2210e358e44801449",  
7 - "data": {  
8 - "version": "1166847114203123795",  
9 - "id": "938956540159881230",  
10 - "name": "imagine",  
11 - "type": 1,  
12 - "options": [  
13 - {  
14 - "type": 3,  
15 - "name": "prompt",  
16 - "value": "童话世界应该是什么样?"  
17 - }  
18 - ],  
19 - "application_command": {  
20 - "id": "938956540159881230",  
21 - "type": 1,  
22 - "application_id": "936929561302675456",  
23 - "version": "1166847114203123795",  
24 - "name": "imagine",  
25 - "description": "Create images with Midjourney",  
26 - "options": [  
27 - {  
28 - "type": 3,  
29 - "name": "prompt",  
30 - "description": "The prompt to imagine",  
31 - "required": true,  
32 - "description_localized": "The prompt to imagine",  
33 - "name_localized": "prompt"  
34 - }  
35 - ],  
36 - "dm_permission": true,  
37 - "integration_types": [  
38 - 0  
39 - ],  
40 - "global_popularity_rank": 1,  
41 - "description_localized": "Create images with Midjourney",  
42 - "name_localized": "imagine"  
43 - },  
44 - "attachments": []  
45 - },  
46 - "nonce": "1224342266261274624",  
47 - "analytics_location": "slash_ui"  
48 -}  
49 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/interactions_type3.json deleted
1 -{  
2 - "type": 3,  
3 - "nonce": "1224397626158350336",  
4 - "guild_id": "1224337694918971392",  
5 - "channel_id": "1224337694918971396",  
6 - "message_flags": 64,  
7 - "message_id": "1224397599197368330",  
8 - "application_id": "936929561302675456",  
9 - "session_id": "0d9ae3c799f2fb55ff435df5e6deb121",  
10 - "data": {  
11 - "component_type": 2,  
12 - "custom_id": "MJ::ModMsg::Ack::2744093999977583880"  
13 - }  
14 -}  
15 \ No newline at end of file 0 \ No newline at end of file
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/resources/requestTestJson/job-message.json deleted
1 -{  
2 - "op": 0,  
3 - "s": 10,  
4 - "t": "MESSAGE_CREATE",  
5 - "d": {  
6 - "mention_everyone": false,  
7 - "pinned": false,  
8 - "components": [],  
9 - "attachments": [],  
10 - "interaction_metadata": {  
11 - "user_id": "972721304891453450",  
12 - "name": "blend",  
13 - "authorizing_integration_owners": {  
14 - "0": "1225608134878302329"  
15 - },  
16 - "id": "1226901083708723310",  
17 - "type": 2  
18 - },  
19 - "author": {  
20 - "global_name": null,  
21 - "bot": true,  
22 - "avatar_decoration_data": null,  
23 - "public_flags": 589824,  
24 - "id": "936929561302675456",  
25 - "avatar": "f6ce562a6b4979c4b1cbc5b436d3be76",  
26 - "username": "Midjourney Bot",  
27 - "discriminator": "9282"  
28 - },  
29 - "flags": 64,  
30 - "type": 20,  
31 - "mention_roles": [],  
32 - "nonce": "1226901080604934144",  
33 - "application_id": "936929561302675456",  
34 - "edited_timestamp": null,  
35 - "content": "",  
36 - "tts": false,  
37 - "webhook_id": "936929561302675456",  
38 - "mentions": [],  
39 - "interaction": {  
40 - "name": "blend",  
41 - "id": "1226901083708723310",  
42 - "type": 2,  
43 - "user": {  
44 - "global_name": "tiger",  
45 - "avatar_decoration_data": null,  
46 - "public_flags": 0,  
47 - "id": "972721304891453450",  
48 - "avatar": "3646118d04fd12dfd301c4fd17afd801",  
49 - "username": "jverbalu4990",  
50 - "discriminator": "0"  
51 - }  
52 - },  
53 - "position": 0,  
54 - "id": "1226901087286591558",  
55 - "embeds": [  
56 - {  
57 - "content_scan_version": 0,  
58 - "color": 16239475,  
59 - "footer": {  
60 - "text": "/imagine https://cdn.discordapp.com/ephemeral-attachments/1062880104792997970/1226901079514419221/srchttp___c-ssl.duitang.com_uploads_item_202001_20_20200120152231_lncpq.thumb.1000_0.jpgreferhttp___c-ssl.duitang.webp?ex=662673ac&is=6613feac&hm=bf9a400940c747fa869b8e4bf2a38238639b67b4b5e799ce1ef2c1f42bab178f& https://cdn.discordapp.com/ephemeral-attachments/1062880104792997970/1226901080970100736/xiyangyang20151021171455974.png?ex=662673ac&is=6613feac&hm=9c8f42ad2dfb1963a9e424c1942c59568544faed4d38f94b678bfcaa60f47b04& --v 5.2 --s 250"  
61 - },  
62 - "description": "You have reached the maximum allowed number of concurrent jobs. Don't worry, this job will start as soon as another one finishes!",  
63 - "type": "rich",  
64 - "title": "Job queued"  
65 - }  
66 - ],  
67 - "channel_id": "1225608134878302332",  
68 - "timestamp": "2024-04-08T14:26:53.929000+00:00"  
69 - }  
70 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/midjourney/MidjourneyInteractionsTests.java deleted
1 -package cn.iocoder.yudao.framework.ai.midjourney;  
2 -  
3 -import cn.hutool.core.io.FileUtil;  
4 -import cn.hutool.core.util.IdUtil;  
5 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
6 -import org.springframework.ai.models.midjourney.api.MidjourneyInteractionsApi;  
7 -import org.springframework.ai.models.midjourney.api.req.AttachmentsReq;  
8 -import org.springframework.ai.models.midjourney.api.req.DescribeReq;  
9 -import org.springframework.ai.models.midjourney.api.req.ReRollReq;  
10 -import org.springframework.ai.models.midjourney.api.res.UploadAttachmentsRes;  
11 -import cn.iocoder.yudao.framework.common.util.json.JsonUtils;  
12 -import org.junit.Before;  
13 -import org.junit.Test;  
14 -import org.springframework.core.io.FileSystemResource;  
15 -  
16 -import java.io.File;  
17 -import java.util.HashMap;  
18 -import java.util.List;  
19 -import java.util.Map;  
20 -  
21 -/**  
22 - * mj  
23 - *  
24 - * author: fansili  
25 - * time: 2024/4/4 18:59  
26 - */  
27 -public class MidjourneyInteractionsTests {  
28 -  
29 - private MidjourneyConfig midjourneyConfig;  
30 - @Before  
31 - public void setup() {  
32 - String token = "OTcyNzIxMzA0ODkxNDUzNDUw.G_vMOz.BO_Q0sXAD80u5ZKIHPNYDTRX_FgeKL3cKFc53I";  
33 - Map<String, String> requestTemplates = new HashMap<>();  
34 - 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");  
35 - for (File file : files) {  
36 - requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file));  
37 - }  
38 - this.midjourneyConfig = new MidjourneyConfig(token, "1225608134878302329", "1225608134878302332", requestTemplates);  
39 - }  
40 -  
41 - @Test  
42 - public void mjImageTest() {  
43 - MidjourneyInteractionsApi mjImagineInteractions = new MidjourneyInteractionsApi(midjourneyConfig);  
44 - mjImagineInteractions.imagine(String.valueOf(IdUtil.getSnowflakeNextId()), "童话里应该是什么样子?");  
45 - }  
46 -  
47 -  
48 - @Test  
49 - public void reRollTest() {  
50 - MidjourneyInteractionsApi mjImagineInteractions = new MidjourneyInteractionsApi(midjourneyConfig);  
51 - mjImagineInteractions.reRoll(new ReRollReq()  
52 - .setMessageId("1226165117448753243")  
53 - .setCustomId("MJ::JOB::upsample::3::2aeefbef-43e2-4057-bcf1-43b5f39ab6f7"));  
54 - }  
55 -  
56 - @Test  
57 - public void uploadAttachmentsTest() {  
58 - MidjourneyInteractionsApi mjImagineInteractions = new MidjourneyInteractionsApi(midjourneyConfig);  
59 - UploadAttachmentsRes res = mjImagineInteractions.uploadAttachments(  
60 - new AttachmentsReq().setFileSystemResource(  
61 - new FileSystemResource(new File("/Users/fansili/Downloads/DSC01402.JPG")))  
62 - );  
63 - System.err.println(JsonUtils.toJsonString(res));  
64 - }  
65 -  
66 - @Test  
67 - public void describeTest() {  
68 - MidjourneyInteractionsApi mjImagineInteractions = new MidjourneyInteractionsApi(midjourneyConfig);  
69 - mjImagineInteractions.describe(new DescribeReq()  
70 - .setFileName("DSC01402.JPG")  
71 - .setFinalFileName("16826931-2873-45ec-8cfb-0ad81f1a075f/DSC01402.JPG")  
72 - );  
73 - }  
74 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/midjourney/MidjourneyUtilTests.java deleted
1 -package cn.iocoder.yudao.framework.ai.midjourney;  
2 -  
3 -import org.springframework.ai.models.midjourney.util.MidjourneyUtil;  
4 -import org.junit.Test;  
5 -  
6 -/**  
7 - * mj util  
8 - *  
9 - * author: fansili  
10 - * time: 2024/4/6 21:57  
11 - */  
12 -public class MidjourneyUtilTests {  
13 -  
14 - @Test  
15 - public void parseContentTest() {  
16 - String content1 = "**南极应该是什么样子? --v 6.0 --style raw** - <@972721304891453450> (32%) (fast, stealth)";  
17 - String content2 = "**南极应该是什么样子? --v 6.0 --style raw** - <@972721304891453450> (fast, stealth)";  
18 -  
19 - System.err.println(MidjourneyUtil.parseContent(content1));  
20 - System.err.println(MidjourneyUtil.parseContent(content2));  
21 - }  
22 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/midjourney/MidjourneyWebSocketTests.java deleted
1 -package cn.iocoder.yudao.framework.ai.midjourney;  
2 -  
3 -import cn.hutool.core.io.FileUtil;  
4 -import org.springframework.ai.models.midjourney.MidjourneyConfig;  
5 -import org.springframework.ai.models.midjourney.webSocket.WssNotify;  
6 -import org.springframework.ai.models.midjourney.webSocket.listener.MidjourneyMessageListener;  
7 -import org.springframework.ai.models.midjourney.webSocket.MidjourneyWebSocketStarter;  
8 -import org.junit.Before;  
9 -import org.junit.Test;  
10 -  
11 -import java.io.File;  
12 -import java.util.HashMap;  
13 -import java.util.List;  
14 -import java.util.Map;  
15 -import java.util.Scanner;  
16 -  
17 -/**  
18 - * author: fansili  
19 - * time: 2024/4/3 16:40  
20 - */  
21 -public class MidjourneyWebSocketTests {  
22 -  
23 - private MidjourneyConfig midjourneyConfig;  
24 -  
25 - @Before  
26 - public void setup() {  
27 - String token = "OTcyNzIxMzA0ODkxNDUzNDUw.G_vMOz.BO_Q0sXAD80u5ZKIHPNYDTRX_FgeKL3cKFc53I";  
28 - Map<String, String> requestTemplates = new HashMap<>();  
29 - 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");  
30 - for (File file : files) {  
31 - requestTemplates.put(file.getName().replace(".json", ""), FileUtil.readUtf8String(file));  
32 - }  
33 - this.midjourneyConfig = new MidjourneyConfig(token, "1225608134878302329", "1225608134878302332", requestTemplates);  
34 - }  
35 -  
36 - @Test  
37 - public void startSocketTest() {  
38 - String wssUrl = "wss://gateway.discord.gg";  
39 - var messageListener = new MidjourneyMessageListener(midjourneyConfig);  
40 - var webSocketStarter = new MidjourneyWebSocketStarter(wssUrl, null, midjourneyConfig, messageListener);  
41 -  
42 - try {  
43 - webSocketStarter.start(new WssNotify() {  
44 - @Override  
45 - public void notify(int code, String message) {  
46 -  
47 - }  
48 - });  
49 - } catch (Exception e) {  
50 - throw new RuntimeException(e);  
51 - }  
52 -  
53 -  
54 - Scanner scanner = new Scanner(System.in);  
55 - scanner.nextLine();  
56 - }  
57 -}  
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/openAiImage/OpenAiImageClientTests.java renamed to yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/openai/OpenAiImageClientTests.java
1 -package cn.iocoder.yudao.framework.ai.openAiImage; 1 +package cn.iocoder.yudao.framework.ai.openai;
2 2
3 import org.springframework.ai.image.ImagePrompt; 3 import org.springframework.ai.image.ImagePrompt;
4 import org.springframework.ai.image.ImageResponse; 4 import org.springframework.ai.image.ImageResponse;
5 import org.junit.Before; 5 import org.junit.Before;
6 import org.junit.Test; 6 import org.junit.Test;
7 -import org.springframework.ai.openai.OpenAiChatClient;  
8 import org.springframework.ai.openai.OpenAiImageClient; 7 import org.springframework.ai.openai.OpenAiImageClient;
9 -import org.springframework.ai.openai.OpenAiImageOptions;  
10 -import org.springframework.ai.openai.api.OpenAiApi;  
11 import org.springframework.ai.openai.api.OpenAiImageApi; 8 import org.springframework.ai.openai.api.OpenAiImageApi;
12 -import reactor.core.publisher.Flux;  
13 9
14 import javax.imageio.ImageIO; 10 import javax.imageio.ImageIO;
15 import javax.swing.*; 11 import javax.swing.*;
@@ -18,7 +14,6 @@ import java.io.ByteArrayInputStream; @@ -18,7 +14,6 @@ import java.io.ByteArrayInputStream;
18 import java.io.IOException; 14 import java.io.IOException;
19 import java.util.Base64; 15 import java.util.Base64;
20 import java.util.Scanner; 16 import java.util.Scanner;
21 -import java.util.function.Function;  
22 17
23 /** 18 /**
24 * author: fansili 19 * author: fansili
yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/package-info.java deleted
1 -/**  
2 - * author: fansili  
3 - * time: 2024/3/12 21:03  
4 - */  
5 -package cn.iocoder.yudao.framework.ai;  
6 \ No newline at end of file 0 \ No newline at end of file