【优化】重命名 midjourney properties

This commit is contained in:
cherishsince 2024-06-12 13:42:29 +08:00
parent 9ae25aa0b8
commit 7358084198
2 changed files with 16 additions and 7 deletions

View File

@ -10,9 +10,18 @@ import lombok.Data;
* @since 1.0 * @since 1.0
*/ */
@Data @Data
public class MidjourneyProperties { public class MidjourneyConfig {
/**
* keys
*/
private String key; private String key;
/**
* 请求地址
*/
private String url; private String url;
/**
* 通知回调地址
*/
private String notifyUrl; private String notifyUrl;
} }

View File

@ -1,6 +1,6 @@
package cn.iocoder.yudao.framework.ai.core.model.midjourney.api; package cn.iocoder.yudao.framework.ai.core.model.midjourney.api;
import cn.iocoder.yudao.framework.ai.core.model.midjourney.MidjourneyProperties; import cn.iocoder.yudao.framework.ai.core.model.midjourney.MidjourneyConfig;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -29,13 +29,13 @@ public class MidjourneyApi {
private static final String URI_ACTON = "/submit/action"; private static final String URI_ACTON = "/submit/action";
private static final String URI_LIST_BY_CONDITION = "/task/list-by-condition"; private static final String URI_LIST_BY_CONDITION = "/task/list-by-condition";
private final WebClient webClient; private final WebClient webClient;
private final MidjourneyProperties midjourneyProperties; private final MidjourneyConfig midjourneyConfig;
public MidjourneyApi(MidjourneyProperties midjourneyProperties) { public MidjourneyApi(MidjourneyConfig midjourneyConfig) {
this.midjourneyProperties = midjourneyProperties; this.midjourneyConfig = midjourneyConfig;
this.webClient = WebClient.builder() this.webClient = WebClient.builder()
.baseUrl(midjourneyProperties.getUrl()) .baseUrl(midjourneyConfig.getUrl())
.defaultHeaders(ApiUtils.getJsonContentHeaders(midjourneyProperties.getKey())) .defaultHeaders(ApiUtils.getJsonContentHeaders(midjourneyConfig.getKey()))
.build(); .build();
} }