lh 1 hour ago
parent
commit
1703da7cc7
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/Services/AIGeneration/AIImageGenerationService.php

+ 8 - 0
app/Services/AIGeneration/AIImageGenerationService.php

@@ -351,12 +351,20 @@ class AIImageGenerationService
                 $apiParams = [
                     'model' => 'gpt-image-2',
                     'prompt' => $task->prompt,
+                    'n' => (int)$task->image_num,
                 ];
                 
                 // 尺寸参数
                 if ($task->width && $task->height) {
                     $apiParams['size'] = $task->width . 'x' . $task->height;
                 }
+
+                if ($task->ref_img_url) {
+                    $imageUrl = is_array($task->ref_img_url) ? $task->ref_img_url[0] : $task->ref_img_url;
+                    if ($imageUrl) {
+                        $apiParams['image'] = $imageUrl;
+                    }
+                }                
                 
                 dLog('generate')->info('GPT-Image2 API参数', $apiParams);
                 logDB('generate', 'info', 'GPT-Image2任务提交', ['task_id' => $task->task_id, 'api_url' => $api_url, 'params' => $apiParams]);