HemulGM / ChatGPT

ChatGPT Native Application (Windows, Mac, Android, iOS, and Linux)
https://hemulgm.github.io/ChatGPT/
MIT License
417 stars 51 forks source link

windows error Failed to get image in procedure 'TBitmapHelper.Get' module ChatGPT.FrameImage.pas #13

Closed GlobalKeeperWorld closed 1 year ago

GlobalKeeperWorld commented 1 year ago

Thank you very much for a great example of working with OpenAI !!!

When trying to get an image on request 'cherry' in ChatGPT - the image itself is not returned at the correct URL. But returns the error text:

<?xml version="1.0" encoding="utf-8"?>TlsVersionNotPermittedThe TLS version of the connection is not permitted on this storage account.'#$A'RequestId:c9350513-601e-0024-3954-7bdf6c000000'#$A'Time:2023-04-30T11:10:38.5776669Z

At the same time, the image itself opens correctly according to the available URL in the browser. URL: https://oaidalleapiprodscus.blob.core.windows.net/private/org-rm4lg7cTaHoMmq7bdtyzy5zr/user-Sarq7NCrpeycdwZhQZQxjgMo/img-2Qk4sg6EFVHtYAK0WahLSocZ.png?st=2023-04-30T10%3A09%3A50Z&se=2023-04-30T12%3A09%3A50Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-04-30T00%3A15%3A37Z&ske=2023-05-01T00%3A15%3A37Z&sks=b&skv=2021-08-06&sig=NGLAh80YCjf6viz5qQ6Vy9tCgM1AUvnxtbSxj8CRReU%3D

As a result, an error occurs during the subsequent attempt to display the image, since the TMemoryStream contains not the image, but the error text.

Project ChatGPT.exe raised exception class EBitmapLoadingFailed with message 'Loading bitmap failed.'.

Probably, it is necessary to check in the procedure TBitmapHelper.Get the returned result not only for code 200 and size, but also to make sure that it is the image that has returned from the server, and not some kind of error message:

if (HTTP.Get(URL, Result).Status Code = 200) and (Result.Size > 0) and ImageIs then ?

PS. And how to defeat this error, by the way? Is there some library missing to put next to the executable file? Thank you in advance for your help!!!

HemulGM commented 1 year ago

What OS? Win7?

GlobalKeeperWorld commented 1 year ago

Yes. Windows 7 Maximum, Service Pack 1

HemulGM commented 1 year ago

In Win7 there is a problem with regular WinHTTP with HTTPS connection. My software uses regular WinHTTP.

https://support.microsoft.com/en-au/topic/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-winhttp-in-windows-c4bd73d2-31d7-761e-0178-11268bb10392

GlobalKeeperWorld commented 1 year ago

Oh, thank you! Yes, I have now checked the work on Windows 10 - and everything started fine. It's time to switch to a new operating system on Delphi 11 too, because under Rio 10.3, alas, SVGIconImageList is not compiled and therefore I had to install Delphi 11 on windows 7 ... :))))

PS. On your link, I installed the update package for Windows 7. Overloaded the computer. But the mistake - the same one - remained. I will try to completely update Windows 7. I will report the result.

GlobalKeeperWorld commented 1 year ago

In general, I suffered for 3 days. It didn't work out to make friends with Windows 7 with WinHTTP & HTTPS... Are we closing the topic?

HemulGM commented 1 year ago

Have you tried fixing it through the registry? There, in the same article, a small instruction is written

GlobalKeeperWorld commented 1 year ago

Oh, yes! I didn't even notice the elephant! Thanks!!! Everything worked!!! :)

image_2023-05-04_14-09-52