AI-Studio/app/MindWork AI Studio/Provider/BaseProvider.cs

42 lines
1.1 KiB
C#
Raw Normal View History

2024-09-01 18:10:03 +00:00
using RustService = AIStudio.Tools.RustService;
namespace AIStudio.Provider;
/// <summary>
/// The base class for all providers.
/// </summary>
public abstract class BaseProvider
{
/// <summary>
/// The HTTP client to use for all requests.
/// </summary>
protected readonly HttpClient httpClient = new();
2024-09-01 18:10:03 +00:00
/// <summary>
/// The logger to use.
/// </summary>
protected readonly ILogger logger;
static BaseProvider()
{
RUST_SERVICE = Program.RUST_SERVICE;
ENCRYPTION = Program.ENCRYPTION;
}
protected static readonly RustService RUST_SERVICE;
protected static readonly Encryption ENCRYPTION;
/// <summary>
/// Constructor for the base provider.
/// </summary>
/// <param name="url">The base URL for the provider.</param>
2024-09-01 18:10:03 +00:00
/// <param name="loggerService">The logger service to use.</param>
protected BaseProvider(string url, ILogger loggerService)
{
2024-09-01 18:10:03 +00:00
this.logger = loggerService;
// Set the base URL:
this.httpClient.BaseAddress = new(url);
}
}