api json processing exception caused a crash
GeekWorkCode opened this issue · comments
Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.error | LineNumber: 0 | BytePositionInLine: 10.
---> System.InvalidOperationException: Cannot get the value of a token type 'StartArray' as a string.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan
1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan
1 json, JsonTypeInfo jsonTypeInfo)
at SocketIOClient.JsonSerializer.SystemTextJsonSerializer.Deserialize[T](String json, IList`1 bytes)
at SocketIOClient.SocketIOResponse.GetValue[T](Int32 index)
at ChatGPT.Net.Session.ChatGptClient.<>c__DisplayClass70_0.<b__1>d.MoveNext() in /home/ubuntu/Desktop/ChatGPT.Net/src/ChatGPT.Net/Session/ChatGptClient.cs:line 226
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.b__128_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[1] 4053955 abort (core dumped) dotnet ChatGPT.Net.Web.dll
Please provide more information with a reproducible example
Please provide more information with a reproducible example
GET /chat?q=I%20want%20you%20to%20act%20as%20an%20interviewer.%20I%20will%20be%20the%20candidate%20and%20you%20will%20ask%20me%20the%20interview%20questions%20for%20the%20position%20position.%20I%20want%20you%20to%20only%20reply%20as%20the%20interviewer.%20Do%20not%20write%20all%20the%20conservation%20at%20once.%20I%20want%20you%20to%20only%20do%20the%20interview%20with%20me.%20Ask%20me%20the%20questions%20and%20wait%20for%20my%20answers.%20Do%20not%20write%20explanations.%20Ask%20me%20the%20questions%20one%20by%20one%20like%20an%20interviewer%20does%20and%20wait%20for%20my%20answers.%20My%20first%20sentence%20is%20%22Hi%22
In the current version using double quotes and some other characters give you an error, make sure to replace double quotes with a single one, I will fix this bug in the next version
If you are using the new method, the issue has been resolved. However, if you are using BrowserMode, you will need to wait for the next library update to fix the issue
Fixed