Added a way for organizations to prohibit providers (#1105)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-22 18:57:12 +02:00
1 parent 052868b24e
commit 7ba5f01388
38 files changed
+1488 -629

No files matched your search

@@ -135,7 +135,16 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
/// The list of used instance names. We need this to check for uniqueness.
/// </summary>
private List<string> UsedInstanceNames { get; set; } = [];
/// <summary>
/// Whether the organization prohibited the selected provider.
/// </summary>
/// <remarks>
/// The provider stays selectable, so that nobody wonders where it went. The dialog then shows
/// the reason instead of the form, and nothing can be stored.
/// </remarks>
private bool IsProviderProhibited => this.SettingsManager.IsProviderProhibited(this.DataLLMProvider);
private bool dataIsValid;
private string[] dataIssues = [];
private string dataAPIKey = string.Empty;
@@ -284,6 +293,9 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
private async Task Store()
{
if (this.IsProviderProhibited)
return;
this.dataStoreWasAttempted = true;
await this.dataTokenizerValidationTask;
await this.form.Validate();
@@ -544,6 +556,10 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
private async Task ReloadModels()
{
// Loading the models would contact the provider:
if (this.IsProviderProhibited)
return;
this.dataLoadingModelsIssue = string.Empty;
this.dataServerWasAskedForItsModels = true;
var currentEmbeddingProviderSettings = this.CreateEmbeddingProviderSettings();