This commit is contained in:
ct
2025-06-20 13:03:52 +08:00
parent eef45fdc9d
commit b502120091
22 changed files with 426 additions and 164 deletions

View File

@@ -14,22 +14,22 @@ public static function generateSchnellImage($uuid, $prompt, $width = 1024, $heig
$response = Http::timeout(60)
->withHeaders([
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $api_key,
'Authorization' => 'Bearer '.$api_key,
])
->post('https://api.runware.ai/v1', [
[
"taskUUID" => $uuid,
"taskType" => "imageInference",
"width" => $width,
"height" => $height,
"numberResults" => 1,
"outputFormat" => "WEBP",
"outputType" => ["URL"],
"includeCost" => true,
"inputImages" => [],
"positivePrompt" => $prompt,
"model" => "runware:100@1"
]
'taskUUID' => $uuid,
'taskType' => 'imageInference',
'width' => $width,
'height' => $height,
'numberResults' => 1,
'outputFormat' => 'WEBP',
'outputType' => ['URL'],
'includeCost' => true,
'inputImages' => [],
'positivePrompt' => $prompt,
'model' => 'runware:100@1',
],
]);
// Check if the request was successful
@@ -50,10 +50,10 @@ public static function generateSchnellImage($uuid, $prompt, $width = 1024, $heig
throw new \Exception('Image URL not found in response');
}
throw new \Exception('API request failed: ' . $response->status() . ' - ' . $response->body());
throw new \Exception('API request failed: '.$response->status().' - '.$response->body());
} catch (\Exception $e) {
// Log the error or handle as needed
\Log::error('RunwareAI API Error: ' . $e->getMessage());
\Log::error('RunwareAI API Error: '.$e->getMessage());
throw $e;
}
}