Fixed handling of instance names while provider creation

This commit is contained in:
tsommer committed 2024-05-19 16:09:52 +02:00
1 parent 38b74a0795
commit 2a152880f4
3 files changed
+7 -11

No files matched your search

+4 -3
View File
@@ -28,15 +28,16 @@ public static class ExtensionsProvider
Providers.NONE => "No provider selected",
_ => "Unknown",
};
/// <summary>
/// Creates a new provider instance based on the provider value.
/// </summary>
/// <param name="provider">The provider value.</param>
/// <param name="instanceName">The used instance name.</param>
/// <returns>The provider instance.</returns>
public static IProvider CreateProvider(this Providers provider) => provider switch
public static IProvider CreateProvider(this Providers provider, string instanceName) => provider switch
{
Providers.OPEN_AI => new ProviderOpenAI(),
Providers.OPEN_AI => new ProviderOpenAI { InstanceName = instanceName },
_ => new NoProvider(),
};