mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-04 17:49:40 +00:00
Finished provider settings
This commit is contained in:
8 files changed
+293
-51
No files matched your search
@@ -0,0 +1,15 @@
|
||||
using AIStudio.Settings;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace AIStudio.Provider;
|
||||
|
||||
public interface IProvider
|
||||
{
|
||||
public string Id { get; }
|
||||
|
||||
public string InstanceName { get; set; }
|
||||
|
||||
public IAsyncEnumerable<string> GetChatCompletion(IJSRuntime jsRuntime, SettingsManager settings, Model chatModel, Thread chatThread);
|
||||
|
||||
public Task<IList<Model>> GetModels(IJSRuntime jsRuntime, SettingsManager settings);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AIStudio.Settings;
|
||||
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace AIStudio.Provider;
|
||||
|
||||
public class NoProvider : IProvider
|
||||
{
|
||||
#region Implementation of IProvider
|
||||
|
||||
public string Id => "none";
|
||||
|
||||
public string InstanceName { get; set; } = "None";
|
||||
|
||||
public IAsyncEnumerable<string> GetChatCompletion(IJSRuntime jsRuntime, SettingsManager settings, Model chatModel, Thread chatThread) => throw new NotImplementedException();
|
||||
|
||||
public Task<IList<Model>> GetModels(IJSRuntime jsRuntime, SettingsManager settings) => throw new NotImplementedException();
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using AIStudio.Provider.OpenAI;
|
||||
|
||||
namespace AIStudio.Provider;
|
||||
|
||||
public enum Providers
|
||||
{
|
||||
NONE,
|
||||
OPEN_AI,
|
||||
}
|
||||
|
||||
public static class ExtensionsProvider
|
||||
{
|
||||
public static string ToName(this Providers provider) => provider switch
|
||||
{
|
||||
Providers.OPEN_AI => "OpenAI",
|
||||
|
||||
_ => "Unknown",
|
||||
};
|
||||
|
||||
public static IProvider CreateProvider(this Providers provider) => provider switch
|
||||
{
|
||||
Providers.OPEN_AI => new ProviderOpenAI(),
|
||||
|
||||
_ => new NoProvider(),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user