srcnalt / OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
MIT License
672 stars 150 forks source link

today update 0.1.11 error #34

Closed julin171012 closed 1 year ago

julin171012 commented 1 year ago

JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

Newtonsoft.Json.JsonTextReader.ParseValue () (at /root/repo/Src/Newtonsoft.Json/JsonTextReader.cs:1817) Newtonsoft.Json.JsonTextReader.Read () (at /root/repo/Src/Newtonsoft.Json/JsonTextReader.cs:429) Newtonsoft.Json.JsonReader.ReadAndMoveToContent () (at /root/repo/Src/Newtonsoft.Json/JsonReader.cs:1240) Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) (at /root/repo/Src/Newtonsoft.Json/JsonReader.cs:1197) Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) (at /root/repo/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:202) Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at /root/repo/Src/Newtonsoft.Json/JsonSerializer.cs:904) Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) (at /root/repo/Src/Newtonsoft.Json/JsonSerializer.cs:883) Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at /root/repo/Src/Newtonsoft.Json/JsonConvert.cs:831) Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) (at /root/repo/Src/Newtonsoft.Json/JsonConvert.cs:787) OpenAI.OpenAIApi.DispatchRequest[T] (System.String path, System.String method, System.Byte[] payload) (at Library/PackageCache/com.srcnalt.openai-unity@5924018f2c/Runtime/OpenAIApi.cs:79) OpenAI.OpenAIApi.CreateChatCompletion (OpenAI.CreateChatCompletionRequest request) (at Library/PackageCache/com.srcnalt.openai-unity@5924018f2c/Runtime/OpenAIApi.cs:179) OpenAI.ChatGPT.SendReply () (at Assets/Samples/OpenAI Unity/0.1.11/ChatGPT/ChatGPT.cs:59) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at :0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :0) UnityEngine.UnitySynchronizationContext.Exec () (at :0) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at :0)

srcnalt commented 1 year ago

Hi @julin171012, the issue might be related to using the IL2CPP scripting backend. It was discussed here, can you check if switching it to mono solves the issue for you?

https://github.com/srcnalt/OpenAI-Unity/discussions/21

julin171012 commented 1 year ago

I have identified the problem - perhaps there is an issue with the network connection, preventing the retrieval of the JSON data. Thanks.

srcnalt commented 1 year ago

Great to hear that it worked! Closing the issue.