Skip to content

Commit

Permalink
Merge branch '11.5-11.0.4' into '11.5'
Browse files Browse the repository at this point in the history
Release 11.0.4

See merge request typo3-commons/mkcontentai!16
  • Loading branch information
hannesbochmann committed Nov 24, 2023
2 parents 05a319e + 0622b02 commit f929c05
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Classes/Backend/Hooks/ButtonBarHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public function getButtons(array $params, ButtonBar $buttonBar)

return $buttons;
}

return $buttons;
}

public function buildUriToControllerAction(): string
Expand Down
23 changes: 14 additions & 9 deletions Classes/Http/Client/OpenAiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,20 @@ public function image(string $text): array
{
$openAi = new OpenAi($this->getApiKey());

$array = [
'prompt' => $text,
'n' => 2,
'size' => '256x256',
];

$response = $this->validateResponse($openAi->image($array));

$images = $this->responseToImages($response);
$images = [];
for ($i = 0; $i < 3; ++$i) {
$array = [
'model' => 'dall-e-3',
'prompt' => $text,
'n' => 1,
'size' => '1024x1024',
];

$response = $this->validateResponse($openAi->image($array));

$tempImages = $this->responseToImages($response);
$images = array_merge($images, $tempImages);
}

return $images;
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/Http/Client/StabilityAiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public function image(string $text): array
],
'cfg_scale' => 7,
'clip_guidance_preset' => 'FAST_BLUE',
'height' => 512,
'width' => 512,
'samples' => 2,
'height' => 1024,
'width' => 1024,
'samples' => 3,
'steps' => 30,
];

$response = $this->client->request(
'POST',
$this->getEndpointLink('v1/generation/stable-diffusion-512-v2-1/text-to-image'),
$this->getEndpointLink('v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image'),
[
'headers' => $headers,
'body' => json_encode($params),
Expand Down Expand Up @@ -130,7 +130,7 @@ public function createImageVariation(File $file): array
'text_prompts[0][text]' => 'variant of original image',
'cfg_scale' => '7',
'clip_guidance_preset' => 'FAST_BLUE',
'samples' => '1',
'samples' => '3',
'steps' => '30',
]);

Expand All @@ -139,7 +139,7 @@ public function createImageVariation(File $file): array

$response = $this->client->request(
'POST',
$this->getEndpointLink('v1/generation/stable-diffusion-512-v2-1/image-to-image'),
$this->getEndpointLink('v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image'),
[
'headers' => $headers,
'body' => $formData->bodyToIterable(),
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ These settings can be adjusted according to your preferences and needs. It's imp

## Changelog

- 11.0.4: use dall-e-3 model from OpenAI, use stable-diffusion-xl-1024-v1-0 from StabilityAI, fix for TCA buttons
- 11.0.3: upscale and outpaint via context menu in filelist, generate image from filelist module, generate image from image content
- 11.0.0: initial release for TYPO3 10.4

0 comments on commit f929c05

Please sign in to comment.