001/* 002 * Copyright (c) 2023-2026, Agents-Flex (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.agentsflex.core.model.image; 017 018import java.util.HashMap; 019import java.util.Map; 020 021public class BaseImageRequest { 022 private String model; 023 private Integer n; 024 private String responseFormat; 025 private String user; 026 private Integer width; 027 private Integer height; 028 private Map<String, Object> options; 029 030 public String getModel() { 031 return model; 032 } 033 034 public void setModel(String model) { 035 this.model = model; 036 } 037 038 public Integer getN() { 039 return n; 040 } 041 042 public void setN(Integer n) { 043 this.n = n; 044 } 045 046 public String getResponseFormat() { 047 return responseFormat; 048 } 049 050 public void setResponseFormat(String responseFormat) { 051 this.responseFormat = responseFormat; 052 } 053 054 public Integer getWidth() { 055 return width; 056 } 057 058 public void setWidth(Integer width) { 059 this.width = width; 060 } 061 062 public Integer getHeight() { 063 return height; 064 } 065 066 public void setHeight(Integer height) { 067 this.height = height; 068 } 069 070 public void setSize(Integer width, Integer height) { 071 this.width = width; 072 this.height = height; 073 } 074 075 public String getSize() { 076 if (this.width == null || this.height == null) { 077 return null; 078 } 079 return this.width + "x" + this.height; 080 } 081 082 083 public String getUser() { 084 return user; 085 } 086 087 public void setUser(String user) { 088 this.user = user; 089 } 090 091 public Map<String, Object> getOptions() { 092 return options; 093 } 094 095 public void setOptions(Map<String, Object> options) { 096 this.options = options; 097 } 098 099 public void addOption(String key, Object value) { 100 if (this.options == null) { 101 this.options = new HashMap<>(); 102 } 103 this.options.put(key, value); 104 } 105 106 public Object getOption(String key) { 107 return this.options == null ? null : this.options.get(key); 108 } 109 110 public Object getOptionOrDefault(String key, Object defaultValue) { 111 return this.options == null ? defaultValue : this.options.getOrDefault(key, defaultValue); 112 } 113}