Added allowed LLM provider setting (data protection)

This commit is contained in:
Thorsten Sommer 2024-12-18 21:42:03 +01:00
parent d06c913c52
commit 370de3a2ae
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
5 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,9 @@
namespace AIStudio.Assistants.ERI;
public enum AllowedLLMProviders
{
NONE,
ANY,
SELF_HOSTED,
}

View File

@ -0,0 +1,16 @@
namespace AIStudio.Assistants.ERI;
public static class AllowedLLMProvidersExtensions
{
public static string Name(this AllowedLLMProviders provider)
{
return provider switch
{
AllowedLLMProviders.NONE => "Please select what kind of LLM provider are allowed for this data source",
AllowedLLMProviders.ANY => "Any LLM provider is allowed: users might choose a cloud-based or a self-hosted provider",
AllowedLLMProviders.SELF_HOSTED => "Self-hosted LLM providers are allowed: users cannot choose any cloud-based provider",
_ => "Unknown option was selected"
};
}
}

View File

@ -123,6 +123,17 @@
</MudSelect> </MudSelect>
} }
<MudText Typo="Typo.h4" Class="mt-6 mb-3">
Data protection settings
</MudText>
<MudSelect T="AllowedLLMProviders" @bind-Value="@this.allowedLLMProviders" Label="Allowed LLM providers for this data source" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateAllowedLLMProviders" Class="mb-1">
@foreach (var option in Enum.GetValues<AllowedLLMProviders>())
{
<MudSelectItem Value="@option">@option.Name()</MudSelectItem>
}
</MudSelect>
<MudText Typo="Typo.h4" Class="mt-6 mb-1"> <MudText Typo="Typo.h4" Class="mt-6 mb-1">
Data retrieval settings Data retrieval settings
</MudText> </MudText>

View File

@ -55,6 +55,7 @@ public partial class AssistantERI : AssistantBaseCore
this.selectedAuthenticationMethods = []; this.selectedAuthenticationMethods = [];
this.authDescription = string.Empty; this.authDescription = string.Empty;
this.selectedOperatingSystem = OperatingSystem.NONE; this.selectedOperatingSystem = OperatingSystem.NONE;
this.allowedLLMProviders = AllowedLLMProviders.NONE;
this.retrievalDescription = string.Empty; this.retrievalDescription = string.Empty;
this.additionalLibraries = string.Empty; this.additionalLibraries = string.Empty;
} }
@ -80,6 +81,7 @@ public partial class AssistantERI : AssistantBaseCore
this.authDescription = this.SettingsManager.ConfigurationData.ERI.PreselectedAuthDescription; this.authDescription = this.SettingsManager.ConfigurationData.ERI.PreselectedAuthDescription;
this.selectedOperatingSystem = this.SettingsManager.ConfigurationData.ERI.PreselectedOperatingSystem; this.selectedOperatingSystem = this.SettingsManager.ConfigurationData.ERI.PreselectedOperatingSystem;
this.allowedLLMProviders = this.SettingsManager.ConfigurationData.ERI.PreselectedAllowedLLMProviders;
this.retrievalDescription = this.SettingsManager.ConfigurationData.ERI.PreselectedRetrievalDescription; this.retrievalDescription = this.SettingsManager.ConfigurationData.ERI.PreselectedRetrievalDescription;
this.additionalLibraries = this.SettingsManager.ConfigurationData.ERI.PreselectedAdditionalLibraries; this.additionalLibraries = this.SettingsManager.ConfigurationData.ERI.PreselectedAdditionalLibraries;
return true; return true;
@ -101,6 +103,7 @@ public partial class AssistantERI : AssistantBaseCore
private IEnumerable<Auth> selectedAuthenticationMethods = new HashSet<Auth>(); private IEnumerable<Auth> selectedAuthenticationMethods = new HashSet<Auth>();
private string authDescription = string.Empty; private string authDescription = string.Empty;
private OperatingSystem selectedOperatingSystem = OperatingSystem.NONE; private OperatingSystem selectedOperatingSystem = OperatingSystem.NONE;
private AllowedLLMProviders allowedLLMProviders = AllowedLLMProviders.NONE;
private string retrievalDescription = string.Empty; private string retrievalDescription = string.Empty;
private string additionalLibraries = string.Empty; private string additionalLibraries = string.Empty;
@ -284,6 +287,14 @@ public partial class AssistantERI : AssistantBaseCore
return null; return null;
} }
private string? ValidateAllowedLLMProviders(AllowedLLMProviders provider)
{
if(provider == AllowedLLMProviders.NONE)
return "Please select which types of LLMs users are allowed to use with the data from this ERI server.";
return null;
}
private string AuthDescriptionTitle() private string AuthDescriptionTitle()
{ {
const string TITLE = "Describe how you planned the authentication process"; const string TITLE = "Describe how you planned the authentication process";

View File

@ -77,6 +77,11 @@ public sealed class DataERI
/// </summary> /// </summary>
public OperatingSystem PreselectedOperatingSystem { get; set; } = OperatingSystem.NONE; public OperatingSystem PreselectedOperatingSystem { get; set; } = OperatingSystem.NONE;
/// <summary>
/// Do you want to preselect which LLM providers are allowed?
/// </summary>
public AllowedLLMProviders PreselectedAllowedLLMProviders { get; set; } = AllowedLLMProviders.NONE;
/// <summary> /// <summary>
/// Do you want to preselect a retrieval description? /// Do you want to preselect a retrieval description?
/// </summary> /// </summary>