nextcloud / integration_openai

OpenAI integration in Nextcloud
GNU Affero General Public License v3.0
51 stars 11 forks source link

rpic failed reading parameters from request with LocalAi & stablediffusion #114

Closed a6datta closed 4 weeks ago

a6datta commented 3 months ago

Which version of integration_openai are you using?

2.0.3

Which version of Nextcloud are you using?

29.0.4

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Chrome on windows

Describe the Bug

When I try to generate an image through next cloud assistant and by selecting "Generate Image" on the popup, it returns 400. I have correctly setup my local host as text chat is working fine using local ai.

On the server side the log shows: ERR Server error error="rpc error: code = Unavailable desc = error reading from server: EOF" ip=172.17.0.1 latency=2.72452591s method=POST status=500 url=/v1/images/generations.

To test local ai setup I tested with curl http://localhost:8082/v1/images/generations -H "Content-Type: application/json" -H "Authorization: Bearer api_key" -d '{ "prompt": "A cute puppy", "size": "256x256" }' With this command, the image was generated.

Expected Behavior

Http status code 200

To Reproduce

Launch next cloud assistant by clicking on the icon on top bar. Select "Generate Image" on the popup. Monitor response on the console.

XueSheng-GIT commented 2 months ago

Issue seems to be the size which defaults to 1024x1024 but localai only supports up to 512x512. https://github.com/nextcloud/integration_openai/blob/bb75ff88c9aafc6868c07af8e9b7b72670144788/lib/AppInfo/Application.php#L39

It seems there's currently no setting to overwrite this default. Thus, you'll have to modify it directly in the code.

a6datta commented 2 months ago

It worked. Thanks.

kyteinsky commented 1 month ago

@XueSheng-GIT

Issue seems to be the size which defaults to 1024x1024 but localai only supports up to 512x512.

That depends on the model use you, see an example from local ai using 1024x1024: https://localai.io/features/image-generation/#text-to-image

The image size can be changed from "Assistant modal -> Generate image -> triple dot menu (near the send button) -> Show advanced options"

XueSheng-GIT commented 1 month ago

@kyteinsky Thanks for your response. I'm on latest (stable) NC29.0.6 and can't find those advanced options (see screenshot). Are you using a beta version? Bildschirmfoto vom 2024-09-05 16-53-58

Anyways, I still would appreciate if the defaults would work in most of the cases. The LocalAI-AIO docker does suffer that 512x512 limit.

kyteinsky commented 1 month ago

Ah sorry, yes I'm using NC 30. This option is not available in NC 29 and the supported assistant version. I agree 1024 is a rather high value. Let's trickle it down to 512.