Closed jalemanyf closed 1 year ago
Hi @jalemanyf,
The line mentioned in the error message is textArea.text = completionResponse.Choices[0].Text;
In this case, either the textArea
field is not set in the ChatGPT
component, or the Choices
array is empty. In the latter case, OpenAI did not send an empty response, which I never faced. So I suppose it's that the UI reference is missing.
Hi, @srcnalt ,
Thanks for your quick response ;)
I also supposed the same thing ( the UI reference is missing ) but, as I told you, I have checked all the references in the editor and all are correct, including the textArea.text.
I have debbuged the line and i attach an image. As you can see the textArea as value ( in green ) but the problem is on the completionResponse. It is null! :(
On the debug I have checked also thar my api_key and organization key are correct on the auth.json and they are correct and readed before the call to the API...
Any suggestion?
Best Regards,
Josep Alemany
I have come in on the openAI page to read more abaout the API ( my first idea was to make a simple, simple test with an API REST client ) but I have a surprise... it seems the service is disabled at the moment.
For these reason I'm not receiving any response...
I will try it again when it is working, it seems is a backend problem.
Thanks!
Hi @jalemanyf,
I do not have error messaging covered in the requests just yet, all the fields of the response null means it could not cast the JSON correctly, which most probably was the error message. I'll create a task for that so I get that covered, in any case, a response error comes from OpenAI I can give this info to the user.
You can debug the DispatchRequest method to see the actual JSON you receive.
Hello, @jalemanyf I think is not a server side issue I have the same problem on Windows when I try to make an API Call from ChatGPT Scene.Please see the attachment.
Hi @COSMYIN90, @jalemanyf,
I just released v0.1.1 #5 which has error handling. This should at least help you see what the problem is.
@COSMYIN90 @srcnalt I'm having the same error as COSMYIN90, do you know how to fix that?
Hi @brunno0204 @COSMYIN90 I just realized the issue is happening during JSON parsing in the Configuration.cs
script. Which means something with the auth.json
might be wrong. Could you check your /.openai/auth.json
file to if it is a valid JSON?
It looks ok for me...
did this and its working, and i think i'll stick with that as ill be using webgl
@brunno0204 It has to be called api_key
instead of private_api_key
or any other word. You might as well keep the API key in your source code, but this poses danger.
@srcnalt Hi! I was able to compile on WebGL, problem is, it's giving me errors when i try to interact with the API(the libc error on console), i suspect it has to do with threading not supported on webgl, do you know a workaround for this?
Hi @brunno0204, WebGL app cannot read your local files such auth.json This project is not intended for production use, it might pose issues if your API key is compromised.
@srcnalt on my last pic before this one ,i told ya i put the api key on the configurator.cs code, so thats not the problem really. And i really dont Care about the security of the key. I saw that on the openaiapi.cs theres multithread lib included. Do you think that is the culprit or might be something else?
Probably since Tasks and async code are still a problem in Unity WebGL builds.
I'll try to replace them with unitask tomorrow and see what happens
auth.json file check, json to data object field name mapping, and api_key as a required field brought in #6, closing the issue.
I followed all the steps but when I push the button to send the text I always receive this error message:
NullReferenceException: Object reference not set to an instance of an object OpenAI.ChatGPT.SendReply () (at Assets/Samples/OpenAI Unity/0.1.0/ChatGPT/ChatGPT.cs:41)
I have checked all the rederences in the editor ( the ChatGPT publics ) and all are correct.
I'm using Unity 2021.3.0f1 on a Mac.
Any help is welcome. Thanks!