Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(image-generator): add gpt-image-2 model support#4437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -39,6 +39,7 @@ | ||
| "servicenow", | ||
| "slack", | ||
| "stripe", | ||
| "table", | ||
| "telegram", | ||
| "twilio_voice", | ||
| "typeform", | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| title: Table | ||
| description: Available Table triggers for automating workflows | ||
| --- | ||
| import { BlockInfoCard } from "@/components/ui/block-info-card" | ||
| <BlockInfoCard | ||
| type="table" | ||
| color="#10B981" | ||
| /> | ||
| Table provides 1 trigger for automating workflows based on events. | ||
| ## Triggers | ||
| ### Table Trigger | ||
| Triggers when rows are inserted or updated in a table | ||
| #### Configuration | ||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `tableSelector` | table-selector | Yes | The table to monitor. | | ||
| | `manualTableId` | string | Yes | The table to monitor. | | ||
| | `eventType` | string | Yes | The type of event to trigger on. | | ||
| | `watchColumns` | string | No | Only fire when these columns change. Leave empty to fire on any update. | | ||
| | `includeHeaders` | boolean | No | When enabled, each row is returned as a key-value object mapped to column names. | | ||
| #### Output | ||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `row` | json | Row data mapped to column names \(when header mapping is enabled\) | | ||
| | `rawRow` | json | Raw row data object | | ||
| | `previousRow` | json | Previous row data before the update \(null for inserts\) | | ||
| | `changedColumns` | json | List of column names that changed \(empty for inserts\) | | ||
| | `rowId` | string | The unique row ID | | ||
| | `headers` | json | Column names from the table schema | | ||
| | `rowNumber` | number | The position of the row in the table | | ||
| | `tableId` | string | The table ID | | ||
| | `tableName` | string | The table name | | ||
| | `timestamp` | string | Event timestamp in ISO format | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,7 +8,7 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| description: 'Generate images', | ||
| authMode: AuthMode.ApiKey, | ||
| longDescription: | ||
| 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3or GPT Image.', | ||
| 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3, GPT Image 1, or GPT Image 2.', | ||
| docsLink: 'https://docs.sim.ai/tools/image_generator', | ||
| category: 'tools', | ||
| integrationType: IntegrationType.AI, | ||
| @@ -22,7 +22,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'DALL-E 3', id: 'dall-e-3' }, | ||
| { label: 'GPT Image', id: 'gpt-image-1' }, | ||
| { label: 'GPT Image 1', id: 'gpt-image-1' }, | ||
| { label: 'GPT Image 2', id: 'gpt-image-2' }, | ||
| ], | ||
| value: () => 'dall-e-3', | ||
| }, | ||
| @@ -60,6 +61,22 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| condition: { field: 'model', value: 'gpt-image-1' }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'size', | ||
| title: 'Size', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Auto', id: 'auto' }, | ||
| { label: 'Square (1024x1024)', id: '1024x1024' }, | ||
| { label: 'Portrait (1024x1536)', id: '1024x1536' }, | ||
| { label: 'Landscape (1536x1024)', id: '1536x1024' }, | ||
| { label: '2K (2560x1440)', id: '2560x1440' }, | ||
| { label: '4K (3840x2160)', id: '3840x2160' }, | ||
| ], | ||
| value: () => 'auto', | ||
| condition: { field: 'model', value: 'gpt-image-2' }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'quality', | ||
| title: 'Quality', | ||
| @@ -72,6 +89,20 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| condition: { field: 'model', value: 'dall-e-3' }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'quality', | ||
| title: 'Quality', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Auto', id: 'auto' }, | ||
| { label: 'Low', id: 'low' }, | ||
| { label: 'Medium', id: 'medium' }, | ||
| { label: 'High', id: 'high' }, | ||
| ], | ||
| value: () => 'auto', | ||
| condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] }, | ||
| dependsOn: ['model'], | ||
| }, | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| { | ||
| id: 'style', | ||
| title: 'Style', | ||
| @@ -97,6 +128,43 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| condition: { field: 'model', value: 'gpt-image-1' }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'background', | ||
| title: 'Background', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Auto', id: 'auto' }, | ||
| { label: 'Opaque', id: 'opaque' }, | ||
| ], | ||
| value: () => 'auto', | ||
| condition: { field: 'model', value: 'gpt-image-2' }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'outputFormat', | ||
| title: 'Output Format', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'PNG', id: 'png' }, | ||
| { label: 'JPEG', id: 'jpeg' }, | ||
| { label: 'WebP', id: 'webp' }, | ||
| ], | ||
| value: () => 'png', | ||
| condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'moderation', | ||
| title: 'Moderation', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Auto', id: 'auto' }, | ||
| { label: 'Low', id: 'low' }, | ||
| ], | ||
| value: () => 'auto', | ||
| condition: { field: 'model', value: ['gpt-image-1', 'gpt-image-2'] }, | ||
| dependsOn: ['model'], | ||
| }, | ||
| { | ||
| id: 'apiKey', | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| title: 'API Key', | ||
| @@ -120,7 +188,25 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| } | ||
| const model = params.model || 'dall-e-3' | ||
| const size = params.size || (model === 'gpt-image-1' ? 'auto' : '1024x1024') | ||
| const ALLOWED_SIZES: Record<string, string[]> = { | ||
| 'dall-e-3': ['1024x1024', '1024x1792', '1792x1024'], | ||
| 'gpt-image-1': ['auto', '1024x1024', '1536x1024', '1024x1536'], | ||
| 'gpt-image-2': ['auto', '1024x1024', '1536x1024', '1024x1536', '2560x1440', '3840x2160'], | ||
| } | ||
| const ALLOWED_QUALITIES: Record<string, string[]> = { | ||
| 'dall-e-3': ['standard', 'hd'], | ||
| 'gpt-image-1': ['auto', 'low', 'medium', 'high'], | ||
| 'gpt-image-2': ['auto', 'low', 'medium', 'high'], | ||
| } | ||
| const ALLOWED_BACKGROUNDS: Record<string, string[]> = { | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| 'gpt-image-1': ['auto', 'transparent', 'opaque'], | ||
| 'gpt-image-2': ['auto', 'opaque'], | ||
| } | ||
| const defaultSize = model === 'dall-e-3' ? '1024x1024' : 'auto' | ||
| const size = ALLOWED_SIZES[model]?.includes(params.size) ? params.size : defaultSize | ||
| const baseParams = { | ||
| prompt: params.prompt, | ||
| model, | ||
| @@ -129,16 +215,25 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| } | ||
| if (model === 'dall-e-3') { | ||
| return { | ||
| ...baseParams, | ||
| quality: params.quality || 'standard', | ||
| style: params.style || 'vivid', | ||
| } | ||
| const quality = ALLOWED_QUALITIES['dall-e-3'].includes(params.quality) | ||
| ? params.quality | ||
| : 'standard' | ||
| const style = ['vivid', 'natural'].includes(params.style) ? params.style : 'vivid' | ||
| return { ...baseParams, quality, style } | ||
| } | ||
| if (model === 'gpt-image-1') { | ||
| if (model === 'gpt-image-1' || model === 'gpt-image-2') { | ||
| const quality = ALLOWED_QUALITIES[model].includes(params.quality) | ||
| ? params.quality | ||
| : undefined | ||
| const background = ALLOWED_BACKGROUNDS[model].includes(params.background) | ||
| ? params.background | ||
| : undefined | ||
| return { | ||
| ...baseParams, | ||
| ...(params.background && { background: params.background }), | ||
| ...(quality && { quality }), | ||
| ...(background && { background }), | ||
| ...(params.outputFormat && { outputFormat: params.outputFormat }), | ||
| ...(params.moderation && { moderation: params.moderation }), | ||
| } | ||
| } | ||
| @@ -153,6 +248,8 @@ export const ImageGeneratorBlock: BlockConfig<DalleResponse> = { | ||
| quality: { type: 'string', description: 'Image quality level' }, | ||
| style: { type: 'string', description: 'Image style' }, | ||
| background: { type: 'string', description: 'Background type' }, | ||
| outputFormat: { type: 'string', description: 'Output image format (png, jpeg, webp)' }, | ||
| moderation: { type: 'string', description: 'Moderation level (auto or low)' }, | ||
| apiKey: { type: 'string', description: 'OpenAI API key' }, | ||
| }, | ||
| outputs: { | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.