diff --git a/agents-flex-core/src/main/java/com/agentsflex/core/image/BaseImageRequest.java b/agents-flex-core/src/main/java/com/agentsflex/core/image/BaseImageRequest.java new file mode 100644 index 0000000..7303dac --- /dev/null +++ b/agents-flex-core/src/main/java/com/agentsflex/core/image/BaseImageRequest.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com). + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.agentsflex.core.image; + +import java.util.HashMap; +import java.util.Map; + +public class BaseImageRequest { + private String model; + private Integer n; + private String responseFormat; + private String user; + private Integer width; + private Integer height; + private Map options; + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public Integer getN() { + return n; + } + + public void setN(Integer n) { + this.n = n; + } + + public String getResponseFormat() { + return responseFormat; + } + + public void setResponseFormat(String responseFormat) { + this.responseFormat = responseFormat; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public void setSize(Integer width, Integer height) { + this.width = width; + this.height = height; + } + + public String getSize() { + if (this.width == null || this.height == null) { + return null; + } + return this.width + "x" + this.height; + } + + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public Map getOptions() { + return options; + } + + public void setOptions(Map options) { + this.options = options; + } + + public void addOption(String key, Object value) { + if (this.options == null) { + this.options = new HashMap<>(); + } + this.options.put(key, value); + } + + public Object getOption(String key) { + return this.options == null ? null : this.options.get(key); + } + + public Object getOptionOrDefault(String key, Object defaultValue) { + return this.options == null ? defaultValue : this.options.getOrDefault(key, defaultValue); + } +}