diff --git a/src/libs/Directory.Build.props b/src/libs/Directory.Build.props index fd150007..29e622cb 100755 --- a/src/libs/Directory.Build.props +++ b/src/libs/Directory.Build.props @@ -16,7 +16,7 @@ - 2.0.6 + 2.0.7 true true tryAGI and contributors diff --git a/src/libs/OpenAI/Client/Extensions/StringExtensions.cs b/src/libs/OpenAI/Client/Extensions/StringExtensions.cs index 4308767a..efac902a 100644 --- a/src/libs/OpenAI/Client/Extensions/StringExtensions.cs +++ b/src/libs/OpenAI/Client/Extensions/StringExtensions.cs @@ -39,7 +39,7 @@ public static StringContent ToJsonStringContent(this string json, bool debug) Console.WriteLine(json); } - return new StringContent(json, Encoding.UTF8, jsonContent); + return new StringContent(json, OpenAIClient.DefaultEncoding, jsonContent); } public static string ToSnakeCase(string @string) diff --git a/src/libs/OpenAI/Client/OpenAIClient.cs b/src/libs/OpenAI/Client/OpenAIClient.cs index 48ea4f44..c03431f0 100644 --- a/src/libs/OpenAI/Client/OpenAIClient.cs +++ b/src/libs/OpenAI/Client/OpenAIClient.cs @@ -17,6 +17,7 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Security.Authentication; +using System.Text; using System.Text.Json; using System.Text.Json.Serialization; @@ -27,6 +28,11 @@ namespace OpenAI /// public sealed class OpenAIClient : IDisposable { + /// + /// + /// + public static Encoding? DefaultEncoding { get; set; } = Encoding.UTF8; + /// /// Creates a new entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints ///