@@ -8,7 +8,7 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
88 description : 'Generate images' ,
99 authMode : AuthMode . ApiKey ,
1010 longDescription :
11- 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.' ,
11+ 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3, GPT Image 1, or GPT Image 2 .' ,
1212 docsLink : 'https://docs.sim.ai/tools/image_generator' ,
1313 category : 'tools' ,
1414 integrationType : IntegrationType . AI ,
@@ -22,7 +22,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
2222 type : 'dropdown' ,
2323 options : [
2424 { label : 'DALL-E 3' , id : 'dall-e-3' } ,
25- { label : 'GPT Image' , id : 'gpt-image-1' } ,
25+ { label : 'GPT Image 1' , id : 'gpt-image-1' } ,
26+ { label : 'GPT Image 2' , id : 'gpt-image-2' } ,
2627 ] ,
2728 value : ( ) => 'dall-e-3' ,
2829 } ,
@@ -60,6 +61,22 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
6061 condition : { field : 'model' , value : 'gpt-image-1' } ,
6162 dependsOn : [ 'model' ] ,
6263 } ,
64+ {
65+ id : 'size' ,
66+ title : 'Size' ,
67+ type : 'dropdown' ,
68+ options : [
69+ { label : 'Auto' , id : 'auto' } ,
70+ { label : '1024x1024 (Square)' , id : '1024x1024' } ,
71+ { label : '1536x1024 (Landscape)' , id : '1536x1024' } ,
72+ { label : '1024x1536 (Portrait)' , id : '1024x1536' } ,
73+ { label : '2048x2048 (2K Square)' , id : '2048x2048' } ,
74+ { label : '3840x2160 (4K Landscape)' , id : '3840x2160' } ,
75+ ] ,
76+ value : ( ) => 'auto' ,
77+ condition : { field : 'model' , value : 'gpt-image-2' } ,
78+ dependsOn : [ 'model' ] ,
79+ } ,
6380 {
6481 id : 'quality' ,
6582 title : 'Quality' ,
@@ -72,6 +89,20 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
7289 condition : { field : 'model' , value : 'dall-e-3' } ,
7390 dependsOn : [ 'model' ] ,
7491 } ,
92+ {
93+ id : 'quality' ,
94+ title : 'Quality' ,
95+ type : 'dropdown' ,
96+ options : [
97+ { label : 'Auto' , id : 'auto' } ,
98+ { label : 'Low' , id : 'low' } ,
99+ { label : 'Medium' , id : 'medium' } ,
100+ { label : 'High' , id : 'high' } ,
101+ ] ,
102+ value : ( ) => 'auto' ,
103+ condition : { field : 'model' , value : [ 'gpt-image-1' , 'gpt-image-2' ] } ,
104+ dependsOn : [ 'model' ] ,
105+ } ,
75106 {
76107 id : 'style' ,
77108 title : 'Style' ,
@@ -97,6 +128,43 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
97128 condition : { field : 'model' , value : 'gpt-image-1' } ,
98129 dependsOn : [ 'model' ] ,
99130 } ,
131+ {
132+ id : 'background' ,
133+ title : 'Background' ,
134+ type : 'dropdown' ,
135+ options : [
136+ { label : 'Auto' , id : 'auto' } ,
137+ { label : 'Opaque' , id : 'opaque' } ,
138+ ] ,
139+ value : ( ) => 'auto' ,
140+ condition : { field : 'model' , value : 'gpt-image-2' } ,
141+ dependsOn : [ 'model' ] ,
142+ } ,
143+ {
144+ id : 'outputFormat' ,
145+ title : 'Output Format' ,
146+ type : 'dropdown' ,
147+ options : [
148+ { label : 'PNG' , id : 'png' } ,
149+ { label : 'JPEG' , id : 'jpeg' } ,
150+ { label : 'WebP' , id : 'webp' } ,
151+ ] ,
152+ value : ( ) => 'png' ,
153+ condition : { field : 'model' , value : [ 'gpt-image-1' , 'gpt-image-2' ] } ,
154+ dependsOn : [ 'model' ] ,
155+ } ,
156+ {
157+ id : 'moderation' ,
158+ title : 'Moderation' ,
159+ type : 'dropdown' ,
160+ options : [
161+ { label : 'Auto' , id : 'auto' } ,
162+ { label : 'Low' , id : 'low' } ,
163+ ] ,
164+ value : ( ) => 'auto' ,
165+ condition : { field : 'model' , value : 'gpt-image-2' } ,
166+ dependsOn : [ 'model' ] ,
167+ } ,
100168 {
101169 id : 'apiKey' ,
102170 title : 'API Key' ,
@@ -120,7 +188,7 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
120188 }
121189
122190 const model = params . model || 'dall-e-3'
123- const size = params . size || ( model === 'gpt-image-1 ' ? 'auto ' : '1024x1024 ' )
191+ const size = params . size || ( model === 'dall-e-3 ' ? '1024x1024 ' : 'auto ' )
124192 const baseParams = {
125193 prompt : params . prompt ,
126194 model,
@@ -138,7 +206,18 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
138206 if ( model === 'gpt-image-1' ) {
139207 return {
140208 ...baseParams ,
209+ ...( params . quality && { quality : params . quality } ) ,
210+ ...( params . background && { background : params . background } ) ,
211+ ...( params . outputFormat && { outputFormat : params . outputFormat } ) ,
212+ }
213+ }
214+ if ( model === 'gpt-image-2' ) {
215+ return {
216+ ...baseParams ,
217+ ...( params . quality && { quality : params . quality } ) ,
141218 ...( params . background && { background : params . background } ) ,
219+ ...( params . outputFormat && { outputFormat : params . outputFormat } ) ,
220+ ...( params . moderation && { moderation : params . moderation } ) ,
142221 }
143222 }
144223
@@ -153,6 +232,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = {
153232 quality : { type : 'string' , description : 'Image quality level' } ,
154233 style : { type : 'string' , description : 'Image style' } ,
155234 background : { type : 'string' , description : 'Background type' } ,
235+ outputFormat : { type : 'string' , description : 'Output image format (png, jpeg, webp)' } ,
236+ moderation : { type : 'string' , description : 'Moderation level (auto or low)' } ,
156237 apiKey : { type : 'string' , description : 'OpenAI API key' } ,
157238 } ,
158239 outputs : {
0 commit comments