mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-11-23 10:50:21 +00:00
Handle empty AdditionalJsonApiParameters in ParseAdditionalApiParameters method
This commit is contained in:
parent
c3ff4aa11a
commit
20d921f35e
@ -527,6 +527,9 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
protected IDictionary<string, object> ParseAdditionalApiParameters(
|
protected IDictionary<string, object> ParseAdditionalApiParameters(
|
||||||
params List<string> keysToRemove)
|
params List<string> keysToRemove)
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(this.AdditionalJsonApiParameters))
|
||||||
|
return new Dictionary<string, object>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Wrap the user-provided parameters in curly brackets to form a valid JSON object:
|
// Wrap the user-provided parameters in curly brackets to form a valid JSON object:
|
||||||
@ -548,7 +551,8 @@ public abstract class BaseProvider : IProvider, ISecretId
|
|||||||
}
|
}
|
||||||
catch (JsonException ex)
|
catch (JsonException ex)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid JSON in additionalUserProvidedParameters", ex);
|
this.logger.LogError("Failed to parse additional API parameters: {ExceptionMessage}", ex.Message);
|
||||||
|
return new Dictionary<string, object>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user