mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 08:27:21 +00:00
Adopted further C# 14 and .NET 10 features (#1158)
This commit is contained in:
1 parent
f649febf88
commit
f0fa1411c8
40 files changed
+545
-56
No files matched your search
@@ -13,6 +13,19 @@ namespace AIStudio.Provider;
|
||||
/// </remarks>
|
||||
public static class AdditionalApiParametersParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Every name only once per object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The dialog for providers refuses a name written twice, but a configuration plugin brings its
|
||||
/// providers past the dialog. With both values read, it would be open which of them reaches the
|
||||
/// provider, and the dictionary below would refuse the second one with an exception.
|
||||
/// </remarks>
|
||||
private static readonly JsonDocumentOptions DOCUMENT_OPTIONS = new()
|
||||
{
|
||||
AllowDuplicateProperties = false,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Try to parse an additional-API-parameters JSON fragment into a dictionary.
|
||||
/// </summary>
|
||||
@@ -30,7 +43,7 @@ public static class AdditionalApiParametersParser
|
||||
try
|
||||
{
|
||||
// The UI stores only the object body, so wrap it before parsing.
|
||||
using var jsonDoc = JsonDocument.Parse($"{{{additionalJsonApiParameters}}}");
|
||||
using var jsonDoc = JsonDocument.Parse($"{{{additionalJsonApiParameters}}}", DOCUMENT_OPTIONS);
|
||||
parameters = ConvertToDictionary(jsonDoc.RootElement);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user