I have no idea what this is. Can anyone help?
I didn't change anything in the code. Purely empty project, imported openAI package, added my API key etc., opened sample scene "ChatGPT", pressed "Play" and sent a message. And it happens every single time. So I couldn't get a single request through.
EDIT:
Ok, found out that the problem is with this method:
private async Task<T> DispatchRequest<T>(string path, string method, byte[] payload = null) where T: IResponse
{
T data;
using (var request = UnityWebRequest.Put(path, payload))
{
request.method = method;
request.SetHeaders(Configuration, ContentType.ApplicationJson);
var asyncOperation = request.SendWebRequest();
while (!asyncOperation.isDone) await Task.Yield();
data = JsonConvert.DeserializeObject<T>(request.downloadHandler.text, jsonSerializerSettings);
}
if (data?.Error != null)
{
ApiError error = data.Error;
Debug.LogError($"Error Message: {error.Message}\nError Type: {error.Type}\n");
}
if (data?.Warning != null)
{
Debug.LogWarning(data.Warning);
}
return data;
}
this variable: request.downloadHandler.text
returns a whole html page in a string and not a JSON file
EDIT 2
This is the html page I got:
Everything makes sense now since OpenAI doesn't work in Russia. You need a VPN to gain access. I guess, additional check of the response and dedicated error message wouldn't hurt this project.
I have no idea what this is. Can anyone help? I didn't change anything in the code. Purely empty project, imported openAI package, added my API key etc., opened sample scene "ChatGPT", pressed "Play" and sent a message. And it happens every single time. So I couldn't get a single request through. EDIT: Ok, found out that the problem is with this method:
this variable:
request.downloadHandler.text
returns a whole html page in a string and not a JSON fileEDIT 2 This is the html page I got: Everything makes sense now since OpenAI doesn't work in Russia. You need a VPN to gain access. I guess, additional check of the response and dedicated error message wouldn't hurt this project.