Skip to content

Make image generation work with base64 responses (e.g. IONOS)#177

Merged
julien-nc merged 3 commits intomainfrom
enh/noid/ionos
Jan 17, 2025
Merged

Make image generation work with base64 responses (e.g. IONOS)#177
julien-nc merged 3 commits intomainfrom
enh/noid/ionos

Conversation

@janepie
Copy link
Copy Markdown
Member

@janepie janepie commented Jan 15, 2025

No description provided.

…e64 responses

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
$output['images'][] = $imageResponse->getBody();
}
foreach ($b64s as $b64) {
if ($b64 !== null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null is already filtered above, this list should be all strings

@kyteinsky
Copy link
Copy Markdown
Contributor

Let's add an option for choosing the response type in the admin settings in image gen section for api endpoints other than official openai. Or even wtih official openai.

@janepie
Copy link
Copy Markdown
Member Author

janepie commented Jan 17, 2025

Let's add an option for choosing the response type in the admin settings in image gen section for api endpoints other than official openai. Or even wtih official openai.

For what should we add this? The image you get in the frontend should not differ depending on response type, so I think there is no difference for the user. And that would be one more chance to disconfigure the integration so it doesn't work, if we always just check for both it's failproof, wdyt?

@marcelklehr
Copy link
Copy Markdown
Member

I agree with @janepie, making it work automagically is superior to adding an option, I think.

@kyteinsky
Copy link
Copy Markdown
Contributor

Yeah that part is perfect. Issues might be with the API and it might return empty responses for 'response_format' => 'url', (

'response_format' => 'url',
). Maybe some local instances do not implement fallbacks like returning b64 images when asked for urls like IONOS.
If there is proof of the contrary for popular local providers, this is good as is.

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@janepie
Copy link
Copy Markdown
Member Author

janepie commented Jan 17, 2025

We could delete it and just always use the default?

@julien-nc
Copy link
Copy Markdown
Member

Yeah we can probably assume (and hope) that the response_format param is optional in every service implementing an OpenAI-compatible API because it is optional in the OpenAI one.

So I would be in favour of removing this param from the request.

@kyteinsky
Copy link
Copy Markdown
Contributor

yeah let's do that 🚀

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@julien-nc julien-nc merged commit 1429a0a into main Jan 17, 2025
@kyteinsky kyteinsky mentioned this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants