diff --git a/OpenAI.sln b/OpenAI.sln index 54a0a233..530ab1dc 100755 --- a/OpenAI.sln +++ b/OpenAI.sln @@ -39,6 +39,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helpers", "helpers", "{1A00 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAI.Generators.Core", "src\libs\OpenAI.Generators.Core\OpenAI.Generators.Core.csproj", "{FCBE699C-CCD3-4809-8128-78956BC3F2C3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrimmingHelper", "src\helpers\TrimmingHelper\TrimmingHelper.csproj", "{9F7DC3A1-B113-4577-875D-73B2DDD6647A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +75,10 @@ Global {FCBE699C-CCD3-4809-8128-78956BC3F2C3}.Debug|Any CPU.Build.0 = Debug|Any CPU {FCBE699C-CCD3-4809-8128-78956BC3F2C3}.Release|Any CPU.ActiveCfg = Release|Any CPU {FCBE699C-CCD3-4809-8128-78956BC3F2C3}.Release|Any CPU.Build.0 = Release|Any CPU + {9F7DC3A1-B113-4577-875D-73B2DDD6647A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F7DC3A1-B113-4577-875D-73B2DDD6647A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F7DC3A1-B113-4577-875D-73B2DDD6647A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F7DC3A1-B113-4577-875D-73B2DDD6647A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -85,6 +91,7 @@ Global {4F534836-40A3-4E75-8B71-C46CD4FBE137} = {AAA11B78-2764-4520-A97E-46AA7089A588} {594DCFD8-E707-4232-B878-90FA3D880474} = {1A008ECD-2300-4BE4-A302-49DDF8BE0D54} {FCBE699C-CCD3-4809-8128-78956BC3F2C3} = {61E7E11E-4558-434C-ACE8-06316A3097B3} + {9F7DC3A1-B113-4577-875D-73B2DDD6647A} = {1A008ECD-2300-4BE4-A302-49DDF8BE0D54} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CED9A020-DBA5-4BE6-8096-75E528648EC1} diff --git a/src/helpers/TrimmingHelper/Program.cs b/src/helpers/TrimmingHelper/Program.cs new file mode 100644 index 00000000..3b94c995 --- /dev/null +++ b/src/helpers/TrimmingHelper/Program.cs @@ -0,0 +1 @@ +Console.WriteLine("Build, rebuild or publish this app to see trimming warnings."); \ No newline at end of file diff --git a/src/helpers/TrimmingHelper/TrimmingHelper.csproj b/src/helpers/TrimmingHelper/TrimmingHelper.csproj new file mode 100644 index 00000000..3a4544fd --- /dev/null +++ b/src/helpers/TrimmingHelper/TrimmingHelper.csproj @@ -0,0 +1,30 @@ + + + + Exe + net8.0 + enable + + true + + + + + + + + + + + + win-x64 + osx-arm64 + + true + + + + + + + diff --git a/src/libs/OpenAI/ChatClient.AsStream.cs b/src/libs/OpenAI/ChatClient.AsStream.cs index f9773285..c449d2ed 100644 --- a/src/libs/OpenAI/ChatClient.AsStream.cs +++ b/src/libs/OpenAI/ChatClient.AsStream.cs @@ -59,8 +59,12 @@ public partial class ChatClient using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new StreamReader(stream); - + +#if NET8_0_OR_GREATER + while (await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false) is { } streamData) +#else while (await reader.ReadLineAsync().ConfigureAwait(false) is { } streamData) +#endif { cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/libs/OpenAI/OpenAI.csproj b/src/libs/OpenAI/OpenAI.csproj index 7e6b207e..9e66c230 100644 --- a/src/libs/OpenAI/OpenAI.csproj +++ b/src/libs/OpenAI/OpenAI.csproj @@ -21,24 +21,23 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - + - + -