mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 21:29:06 +00:00
43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using AIStudio.Provider;
|
|
|
|
using Host = AIStudio.Provider.SelfHosted.Host;
|
|
|
|
namespace AIStudio.Settings;
|
|
|
|
/// <summary>
|
|
/// Data model for configured providers.
|
|
/// </summary>
|
|
/// <param name="Num">The provider's number.</param>
|
|
/// <param name="Id">The provider's ID.</param>
|
|
/// <param name="InstanceName">The provider's instance name. Useful for multiple instances of the same provider, e.g., to distinguish between different OpenAI API keys.</param>
|
|
/// <param name="UsedProvider">The provider used.</param>
|
|
/// <param name="IsSelfHosted">Whether the provider is self-hosted.</param>
|
|
/// <param name="Hostname">The hostname of the provider. Useful for self-hosted providers.</param>
|
|
/// <param name="Model">The LLM model to use for chat.</param>
|
|
public readonly record struct Provider(
|
|
uint Num,
|
|
string Id,
|
|
string InstanceName,
|
|
Providers UsedProvider,
|
|
Model Model,
|
|
bool IsSelfHosted = false,
|
|
string Hostname = "http://localhost:1234",
|
|
Host Host = Host.NONE)
|
|
{
|
|
#region Overrides of ValueType
|
|
|
|
/// <summary>
|
|
/// Returns a string that represents the current provider in a human-readable format.
|
|
/// We use this to display the provider in the chat UI.
|
|
/// </summary>
|
|
/// <returns>A string that represents the current provider in a human-readable format.</returns>
|
|
public override string ToString()
|
|
{
|
|
if(this.IsSelfHosted)
|
|
return $"{this.InstanceName} ({this.UsedProvider.ToName()}, {this.Host}, {this.Hostname}, {this.Model})";
|
|
|
|
return $"{this.InstanceName} ({this.UsedProvider.ToName()}, {this.Model})";
|
|
}
|
|
|
|
#endregion
|
|
} |