mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-24 20:52:11 +00:00
Added user-managed API keys to the embedding and transcription settings
This commit is contained in:
parent
96f70fdf06
commit
15af56b090
@ -45,12 +45,21 @@
|
|||||||
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
@if (context.IsEnterpriseConfiguration)
|
@if (context.IsEnterpriseConfiguration && !context.AllowUserProvidedAPIKey)
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("This embedding provider is managed by your organization.")">
|
<MudTooltip Text="@T("This embedding provider is managed by your organization.")">
|
||||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
||||||
</MudTooltip>
|
</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
|
else
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("Open Dashboard")">
|
<MudTooltip Text="@T("Open Dashboard")">
|
||||||
|
|||||||
@ -73,6 +73,9 @@ public partial class SettingsPanelEmbeddings : SettingsPanelProviderBase
|
|||||||
|
|
||||||
private async Task EditEmbeddingProvider(EmbeddingProvider embeddingProvider)
|
private async Task EditEmbeddingProvider(EmbeddingProvider embeddingProvider)
|
||||||
{
|
{
|
||||||
|
if (embeddingProvider.IsEnterpriseConfiguration && !embeddingProvider.AllowUserProvidedAPIKey)
|
||||||
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
|
var dialogParameters = new DialogParameters<EmbeddingProviderDialog>
|
||||||
{
|
{
|
||||||
{ x => x.DataNum, embeddingProvider.Num },
|
{ x => x.DataNum, embeddingProvider.Num },
|
||||||
@ -84,6 +87,7 @@ public partial class SettingsPanelEmbeddings : SettingsPanelProviderBase
|
|||||||
{ x => x.IsSelfHosted, embeddingProvider.IsSelfHosted },
|
{ x => x.IsSelfHosted, embeddingProvider.IsSelfHosted },
|
||||||
{ x => x.IsEditing, true },
|
{ x => x.IsEditing, true },
|
||||||
{ x => x.DataHost, embeddingProvider.Host },
|
{ x => x.DataHost, embeddingProvider.Host },
|
||||||
|
{ x => x.IsEnterpriseConfiguration, embeddingProvider.IsEnterpriseConfiguration },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<EmbeddingProviderDialog>(T("Edit Embedding Provider"), dialogParameters, DialogOptions.FULLSCREEN);
|
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)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
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!;
|
var editedEmbeddingProvider = (EmbeddingProvider)dialogResult.Data!;
|
||||||
|
|
||||||
// Set the provider number if it's not set. This is important for providers
|
// Set the provider number if it's not set. This is important for providers
|
||||||
|
|||||||
@ -41,12 +41,18 @@
|
|||||||
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
<MudIconButton Color="Color.Success" Icon="@Icons.Material.Filled.VerifiedUser" Disabled="true"/>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
@if (context.IsEnterpriseConfiguration)
|
@if (context.IsEnterpriseConfiguration && !context.AllowUserProvidedAPIKey)
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("This transcription provider is managed by your organization.")">
|
<MudTooltip Text="@T("This transcription provider is managed by your organization.")">
|
||||||
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
<MudIconButton Color="Color.Info" Icon="@Icons.Material.Filled.Business" Disabled="true"/>
|
||||||
</MudTooltip>
|
</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
|
else
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("Open Dashboard")">
|
<MudTooltip Text="@T("Open Dashboard")">
|
||||||
|
|||||||
@ -72,6 +72,9 @@ public partial class SettingsPanelTranscription : SettingsPanelProviderBase
|
|||||||
|
|
||||||
private async Task EditTranscriptionProvider(TranscriptionProvider transcriptionProvider)
|
private async Task EditTranscriptionProvider(TranscriptionProvider transcriptionProvider)
|
||||||
{
|
{
|
||||||
|
if (transcriptionProvider.IsEnterpriseConfiguration && !transcriptionProvider.AllowUserProvidedAPIKey)
|
||||||
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters<TranscriptionProviderDialog>
|
var dialogParameters = new DialogParameters<TranscriptionProviderDialog>
|
||||||
{
|
{
|
||||||
{ x => x.DataNum, transcriptionProvider.Num },
|
{ x => x.DataNum, transcriptionProvider.Num },
|
||||||
@ -83,13 +86,24 @@ public partial class SettingsPanelTranscription : SettingsPanelProviderBase
|
|||||||
{ x => x.IsSelfHosted, transcriptionProvider.IsSelfHosted },
|
{ x => x.IsSelfHosted, transcriptionProvider.IsSelfHosted },
|
||||||
{ x => x.IsEditing, true },
|
{ x => x.IsEditing, true },
|
||||||
{ x => x.DataHost, transcriptionProvider.Host },
|
{ 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 dialogReference = await this.DialogService.ShowAsync<TranscriptionProviderDialog>(T("Edit Transcription Provider"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
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!;
|
var editedTranscriptionProvider = (TranscriptionProvider)dialogResult.Data!;
|
||||||
|
|
||||||
// Set the provider number if it's not set. This is important for providers
|
// Set the provider number if it's not set. This is important for providers
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user