Commit bd8e6c2b406fb00b2a88c2d89d34e29a1287d769
1 parent
e91e7355
增加mj 执行器(先提交一下)
Showing
1 changed file
with
24 additions
and
0 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/Midjourney/MjHttpExecute.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.ai.Midjourney; | |
| 2 | + | |
| 3 | +import org.springframework.http.HttpHeaders; | |
| 4 | +import org.springframework.http.MediaType; | |
| 5 | +import org.springframework.web.client.RestTemplate; | |
| 6 | + | |
| 7 | +public class MjHttpExecute implements MjExecute { | |
| 8 | + | |
| 9 | + private static final String URL = "https://discord.com/"; | |
| 10 | + | |
| 11 | + private RestTemplate restTemplate = new RestTemplate(); | |
| 12 | + | |
| 13 | + | |
| 14 | + @Override | |
| 15 | + public boolean execute(MjCommandEnum mjCommand, String prompt) { | |
| 16 | + // 发送的 uri | |
| 17 | + String uri = "api/v9/interactions"; | |
| 18 | + // restTemplate 发送post请求 | |
| 19 | + String result = restTemplate.postForObject(URL + uri, prompt, String.class); | |
| 20 | + // 加载当前目录下文件 | |
| 21 | + | |
| 22 | + return false; | |
| 23 | + } | |
| 24 | +} | ... | ... |