openblocks-dev / openblocks

🔥 🔥 🔥 The Open Source Retool Alternative
https://cloud.openblocks.dev
GNU Affero General Public License v3.0
5.88k stars 360 forks source link

[Bug] Little bug with the OpenAI API #286

Closed LibertyPrimer closed 1 year ago

LibertyPrimer commented 1 year ago

Hello, congratulations for the hard work developing this, I'm using it for my Non-Profit and is helping us a lot!

I was testing the OpenAI integration you have, and the generation of images work so fine, but the modification of images give me error due to the image I send via API to OpenAI don't achieve the requeriments.

{
  "error": {
    "code": null,
    "message": "Uploaded image must be a PNG and less than 4 MB.",
    "param": null,
    "type": "invalid_request_error"
  }
}

I check and is a 40KB square png image, i found in some forums that this is because the API have a problem with the type of the png file generated by Typescript when is casted.

As i found, it suppose to can be solved adding "as Any" in the casting.

I don't really know if this is the solution because I'm not experimented enough to text directly, but hope this little investigation helps.

References: OpenAI Forum

sarike commented 1 year ago

@LibertyPrimer

Could you toke a screenshot of your query settings to me?

Try config the file field in this way:

image
LibertyPrimer commented 1 year ago

I had this one before:

image

I tried the field field you send me but still give me the same problem

image
sarike commented 1 year ago

@LibertyPrimer

I just checked the source code, the cause of this issue is the empty value of the mask field. For empty file field, we mistakenly passed an illegal file to OpenAI.

The workaround now is setting a mask image too.

We'll fix this issue asap.