【增加】autoconfig自动配置 增加 style 适配。

This commit is contained in:
cherishsince 2024-04-28 16:34:55 +08:00
parent 7467c241f3
commit 330696fb90
2 changed files with 37 additions and 0 deletions

View File

@ -100,6 +100,7 @@ public class YudaoAiAutoConfiguration {
new OpenAiImageOptions()
.setModel(openAiImageProperties.getModel())
.setResponseFormat(OpenAiImageOptions.ResponseFormatEnum.URL.getValue())
.setStyle(openAiImageProperties.getStyle())
);
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.framework.ai.imageopenai;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* open ai image style
*
* @author fansili
* @time 2024/4/28 16:15
* @since 1.0
*/
@AllArgsConstructor
@Getter
public enum OpenAiImageStyleEnum {
// 图像生成的风格可为vivid生动 natural自然vivid会使模型偏向生成超现实和戏剧性的图像而natural则会让模型产出更自然不那么超现实的图像该参数仅对dall-e-3模型有效
VIVID("vivid", "生动"),
NATURAL("natural", "自然"),
;
private String style;
private String name;
public static OpenAiImageStyleEnum valueOfStyle(String style) {
for (OpenAiImageStyleEnum itemEnum : OpenAiImageStyleEnum.values()) {
if (itemEnum.getStyle().equals(style)) {
return itemEnum;
}
}
throw new IllegalArgumentException("Invalid MessageType value: " + style);
}
}