mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-14 05:33:47 +00:00
Added user-managed API keys for enterprise-configured providers (#919)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
a9a37b6bf5
commit
592c9c76e2
23 files changed
+479
-50
No files matched your search
@@ -45,12 +45,21 @@
|
||||
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
@if (context.IsEnterpriseConfiguration)
|
||||
@if (context.IsEnterpriseConfiguration && !context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This embedding provider is managed by your organization.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else if (context.IsEnterpriseConfiguration && context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This embedding provider is managed by your organization. You can set your own API key.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Key" OnClick="@(() => this.EditEmbeddingProvider(context))"/>
|
||||
</MudTooltip>
|
||||
<MudTooltip Text="@T("Test")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Api" OnClick="@(() => this.TestEmbeddingProvider(context))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTooltip Text="@T("Open Dashboard")">
|
||||
|
||||
@@ -73,6 +73,9 @@ public partial class SettingsPanelEmbeddings : SettingsPanelProviderBase
|
||||
|
||||
private async Task EditEmbeddingProvider(EmbeddingProvider embeddingProvider)
|
||||
{
|
||||
if (embeddingProvider.IsEnterpriseConfiguration && !embeddingProvider.AllowUserProvidedAPIKey)
|
||||
return;
|
||||
|
||||
var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
|
||||
{
|
||||
{ x => x.DataNum, embeddingProvider.Num },
|
||||
@@ -84,6 +87,7 @@ public partial class SettingsPanelEmbeddings : SettingsPanelProviderBase
|
||||
{ x => x.IsSelfHosted, embeddingProvider.IsSelfHosted },
|
||||
{ x => x.IsEditing, true },
|
||||
{ x => x.DataHost, embeddingProvider.Host },
|
||||
{ x => x.IsEnterpriseConfiguration, embeddingProvider.IsEnterpriseConfiguration },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<EmbeddingProviderDialog>(T("Edit Embedding Provider"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
@@ -91,6 +95,16 @@ public partial class SettingsPanelEmbeddings : SettingsPanelProviderBase
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
if (embeddingProvider.IsEnterpriseConfiguration)
|
||||
{
|
||||
// Only the API key changed, and the dialog already stored it directly. The provider
|
||||
// object itself is managed by the configuration plugin and must not be overwritten
|
||||
// with the dialog's copy -- doing so would let the locked-but-technically-editable
|
||||
// fields drift from what the organization configured.
|
||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
return;
|
||||
}
|
||||
|
||||
var editedEmbeddingProvider = (EmbeddingProvider)dialogResult.Data!;
|
||||
|
||||
// Set the provider number if it's not set. This is important for providers
|
||||
|
||||
@@ -36,12 +36,18 @@
|
||||
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
@if (context.IsEnterpriseConfiguration)
|
||||
@if (context.IsEnterpriseConfiguration && !context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This provider is managed by your organization.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else if (context.IsEnterpriseConfiguration && context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This provider is managed by your organization. You can set your own API key.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Key" OnClick="@(() => this.EditLLMProvider(context))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTooltip Text="@T("Open Dashboard")">
|
||||
|
||||
@@ -67,10 +67,10 @@ public partial class SettingsPanelProviders : SettingsPanelProviderBase
|
||||
{
|
||||
if(provider == AIStudio.Settings.Provider.NONE)
|
||||
return;
|
||||
|
||||
if (provider.IsEnterpriseConfiguration)
|
||||
|
||||
if (provider.IsEnterpriseConfiguration && !provider.AllowUserProvidedAPIKey)
|
||||
return;
|
||||
|
||||
|
||||
var dialogParameters = new DialogParameters<ProviderDialog>
|
||||
{
|
||||
{ x => x.DataNum, provider.Num },
|
||||
@@ -85,6 +85,7 @@ public partial class SettingsPanelProviders : SettingsPanelProviderBase
|
||||
{ x => x.HFInferenceProviderId, provider.HFInferenceProvider },
|
||||
{ x => x.AdditionalJsonApiParameters, provider.AdditionalJsonApiParameters },
|
||||
{ x => x.DataCapabilityOverrides, provider.CapabilityOverrides },
|
||||
{ x => x.IsEnterpriseConfiguration, provider.IsEnterpriseConfiguration },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<ProviderDialog>(T("Edit LLM Provider"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
@@ -92,16 +93,26 @@ public partial class SettingsPanelProviders : SettingsPanelProviderBase
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
if (provider.IsEnterpriseConfiguration)
|
||||
{
|
||||
// Only the API key changed, and the dialog already stored it directly. The provider
|
||||
// object itself is managed by the configuration plugin and must not be overwritten
|
||||
// with the dialog's copy -- doing so would let the locked-but-technically-editable
|
||||
// fields drift from what the organization configured.
|
||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
return;
|
||||
}
|
||||
|
||||
var editedProvider = (AIStudio.Settings.Provider)dialogResult.Data!;
|
||||
|
||||
|
||||
// Set the provider number if it's not set. This is important for providers
|
||||
// added before we started saving the provider number.
|
||||
if(editedProvider.Num == 0)
|
||||
editedProvider = editedProvider with { Num = this.SettingsManager.ConfigurationData.NextProviderNum++ };
|
||||
|
||||
|
||||
this.SettingsManager.ConfigurationData.Providers[this.SettingsManager.ConfigurationData.Providers.IndexOf(provider)] = editedProvider;
|
||||
await this.UpdateProviders();
|
||||
|
||||
|
||||
await this.SettingsManager.StoreSettings();
|
||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
}
|
||||
|
||||
@@ -41,12 +41,18 @@
|
||||
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
@if (context.IsEnterpriseConfiguration)
|
||||
@if (context.IsEnterpriseConfiguration && !context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This transcription provider is managed by your organization.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else if (context.IsEnterpriseConfiguration && context.AllowUserProvidedAPIKey)
|
||||
{
|
||||
<MudTooltip Text="@T("This transcription provider is managed by your organization. You can set your own API key.")">
|
||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Key" OnClick="@(() => this.EditTranscriptionProvider(context))"/>
|
||||
</MudTooltip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudTooltip Text="@T("Open Dashboard")">
|
||||
|
||||
@@ -72,6 +72,9 @@ public partial class SettingsPanelTranscription : SettingsPanelProviderBase
|
||||
|
||||
private async Task EditTranscriptionProvider(TranscriptionProvider transcriptionProvider)
|
||||
{
|
||||
if (transcriptionProvider.IsEnterpriseConfiguration && !transcriptionProvider.AllowUserProvidedAPIKey)
|
||||
return;
|
||||
|
||||
var dialogParameters = new DialogParameters<TranscriptionProviderDialog>
|
||||
{
|
||||
{ x => x.DataNum, transcriptionProvider.Num },
|
||||
@@ -83,13 +86,24 @@ public partial class SettingsPanelTranscription : SettingsPanelProviderBase
|
||||
{ x => x.IsSelfHosted, transcriptionProvider.IsSelfHosted },
|
||||
{ x => x.IsEditing, true },
|
||||
{ x => x.DataHost, transcriptionProvider.Host },
|
||||
{ x => x.IsEnterpriseConfiguration, transcriptionProvider.IsEnterpriseConfiguration },
|
||||
};
|
||||
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<TranscriptionProviderDialog>(T("Edit Transcription Provider"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
|
||||
if (transcriptionProvider.IsEnterpriseConfiguration)
|
||||
{
|
||||
// Only the API key changed, and the dialog already stored it directly. The provider
|
||||
// object itself is managed by the configuration plugin and must not be overwritten
|
||||
// with the dialog's copy -- doing so would let the locked-but-technically-editable
|
||||
// fields drift from what the organization configured.
|
||||
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||
return;
|
||||
}
|
||||
|
||||
var editedTranscriptionProvider = (TranscriptionProvider)dialogResult.Data!;
|
||||
|
||||
// Set the provider number if it's not set. This is important for providers
|
||||
|
||||
Reference in new issue
Block a user