From 330696fb902725adabdf167b437c58234777efc9 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sun, 28 Apr 2024 16:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91autoconfig?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=85=8D=E7=BD=AE=20=E5=A2=9E=E5=8A=A0=20sty?= =?UTF-8?q?le=20=E9=80=82=E9=85=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/config/YudaoAiAutoConfiguration.java | 1 + .../ai/imageopenai/OpenAiImageStyleEnum.java | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/imageopenai/OpenAiImageStyleEnum.java diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java index 385de4cf0..b265f6814 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java @@ -100,6 +100,7 @@ public class YudaoAiAutoConfiguration { new OpenAiImageOptions() .setModel(openAiImageProperties.getModel()) .setResponseFormat(OpenAiImageOptions.ResponseFormatEnum.URL.getValue()) + .setStyle(openAiImageProperties.getStyle()) ); } } \ No newline at end of file diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/imageopenai/OpenAiImageStyleEnum.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/imageopenai/OpenAiImageStyleEnum.java new file mode 100644 index 000000000..e586420a5 --- /dev/null +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/imageopenai/OpenAiImageStyleEnum.java @@ -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); + } +}