You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -57,9 +59,16 @@ function openai_dalle_form($form, &$form_state) {
57
59
$form['model'] = [
58
60
'#type' => 'select',
59
61
'#title' => t('Model'),
60
-
'#options' => $models,
62
+
'#options' => [
63
+
'dall-e-2' => 'dall-e-2',
64
+
'dall-e-3' => 'dall-e-3',
65
+
],
61
66
'#default_value' => 'dall-e-3',
62
-
'#description' => t('The model to use to generate an image. See the <a href=":link">link</a> for more information.', ['@link' => 'https://platform.openai.com/docs/models/dall-e']),
67
+
'#description' => t('The model to use to generate an image.'),
'#description' => t('The size of the generated images.'),
93
102
];
94
103
@@ -116,7 +125,7 @@ function openai_dalle_form($form, &$form_state) {
116
125
'b64_json' => 'b64_json',
117
126
],
118
127
'#default_value' => 'url',
119
-
'#description' => t('The image format of the result. See the <a href=":link">link</a> for more information.', ['@link' => 'https://platform.openai.com/docs/api-reference/images/create#images-create-response_format']),
128
+
'#description' => t('The image format of the result. See the <a href="@link">link</a> for more information.', ['@link' => 'https://platform.openai.com/docs/api-reference/images/create#images-create-response_format']),
120
129
];
121
130
122
131
$form['filename'] = [
@@ -160,6 +169,29 @@ function openai_dalle_form($form, &$form_state) {
160
169
return $form;
161
170
}
162
171
172
+
function openai_dalle_model_select_callback($form, &$form_state) {
173
+
$selected_model = $form_state['values']['model'];
174
+
175
+
if ($selected_model === 'dall-e-2') {
176
+
$form['size']['#options'] = [
177
+
'256x256' => '256x256',
178
+
'512x512' => '512x512',
179
+
'1024x1024' => '1024x1024',
180
+
];
181
+
} elseif ($selected_model === 'dall-e-3') {
182
+
$form['size']['#options'] = [
183
+
'1024x1024' => '1024x1024',
184
+
'1792x1024' => '1792x1024',
185
+
'1024x1792' => '1024x1792',
186
+
];
187
+
}
188
+
189
+
// Ensure the default value is set to the first option in the updated list.
0 commit comments