chand1012 / openai-cf-workers-ai

Replacing OpenAI's API with Cloudflare AI.
MIT License
224 stars 45 forks source link

[BUG] Image generation dose not work #9

Closed boixu closed 4 months ago

boixu commented 4 months ago

Hi

What ever I try I am unable to get the image generation to work.

Always receive the following error {"error":"Provided readable stream must have a known length (request/response body or readable half of FixedLengthStream)"} R2 bucket has been created. I am using curl to make the request and took the OpenAI image generation as an example. Example used with redacted info curl -L https://openai-cf.example.workers.dev/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer xxxxxxxxxxxxxxxx" \ -d '{ "model": "@cf/stabilityai/stable-diffusion-xl-base-1.0", "prompt": "A cute baby sea otter", "n": 1, "size": "1024x1024" }'

Any and all help is appreciated! Thanks!

boixu commented 4 months ago

Was able to fix it by editing the routes/image.js file

boixu commented 4 months ago

Created pull request with fixes that solved the issue for me :) Fix #10