Commit 6adb8d657c840917396c5bba99e7ca38659543db
1 parent
e6bc5cf0
处理异常结果,日志输出
Showing
1 changed file
with
6 additions
and
4 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/midjourney/interactions/MjImagineInteractions.java
| @@ -47,10 +47,12 @@ public class MjImagineInteractions implements MjInteractions { | @@ -47,10 +47,12 @@ public class MjImagineInteractions implements MjInteractions { | ||
| 47 | String requestBody = MjClient.setParams(requestTemplate, requestParams); | 47 | String requestBody = MjClient.setParams(requestTemplate, requestParams); |
| 48 | // 发送请求 | 48 | // 发送请求 |
| 49 | String res = MjClient.post(url, midjourneyConfig.getToken(), requestBody); | 49 | String res = MjClient.post(url, midjourneyConfig.getToken(), requestBody); |
| 50 | - // | ||
| 51 | - System.err.println(res); | ||
| 52 | - log.info(res); | ||
| 53 | // 这个 res 只要不返回值,就是成功! | 50 | // 这个 res 只要不返回值,就是成功! |
| 54 | - return StrUtil.isBlank(res); | 51 | + boolean isSuccess = StrUtil.isBlank(res); |
| 52 | + if (isSuccess) { | ||
| 53 | + return true; | ||
| 54 | + } | ||
| 55 | + log.error("请求失败! 请求参数:{} 返回结果! {}", requestBody, res); | ||
| 56 | + return isSuccess; | ||
| 55 | } | 57 | } |
| 56 | } | 58 | } |