Skip to content
Snippets Groups Projects
Commit f3e1b7c4 authored by Paul Dale Smith's avatar Paul Dale Smith
Browse files

Switch if statement so fallback is always url. #3501326

parent 19c840e7
No related branches found
No related tags found
1 merge request!16Switch if statement so fallback is always url. #3501326
Pipeline #402605 passed
......@@ -397,11 +397,11 @@ class OpenAiProvider extends AiProviderClientBase implements
throw new AiResponseErrorException('No image data found in the response.');
}
foreach ($response['data'] as $data) {
if (isset($this->configuration['response_format']) && $this->configuration['response_format'] === 'url') {
$images[] = new ImageFile(file_get_contents($data['url']), 'image/png', 'dalle.png');
if (isset($this->configuration['response_format']) && $this->configuration['response_format'] === 'b64_json') {
$images[] = new ImageFile(base64_decode($data['b64_json']), 'image/png', 'dalle.png');
}
else {
$images[] = new ImageFile(base64_decode($data['b64_json']), 'image/png', 'dalle.png');
$images[] = new ImageFile(file_get_contents($data['url']), 'image/png', 'dalle.png');
}
}
return new TextToImageOutput($images, $response, []);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment