mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 08:53:48 +00:00
Moved the background agents to AI operations (#1215)
This commit is contained in:
1 parent
8a4a26503b
commit
c50a93cd17
139 files changed
+4069
-2340
No files matched your search
+36
-25
@@ -1,37 +1,48 @@
|
||||
using AIStudio.Dialogs;
|
||||
using AIStudio.Tools.PluginSystem.Assistants;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||
|
||||
namespace AIStudio.Components.Settings;
|
||||
|
||||
public partial class SettingsPanelAgentAssistantAudit : SettingsPanelBase
|
||||
{
|
||||
private async Task RequireAuditBeforeActivationChanged(bool updatedState)
|
||||
[Inject]
|
||||
private AssistantPluginAuditService AssistantPluginAuditService { get; init; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether automatic audits are switched on, although no provider is left for them.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Without a provider, the automatic audit skips every plugin. The least any audit requires decides here:
|
||||
/// should no provider meet it, none meets what a particular plugin requires either.
|
||||
/// </remarks>
|
||||
private bool IsAutomaticAuditWithoutProvider => this.SettingsManager.ConfigurationData.AssistantPluginAudit.AutomaticallyAuditAssistants && !this.AssistantPluginAuditService.PreviewProvider().HasProvider;
|
||||
/// <summary>
|
||||
/// Asks the user before they turn off the audit before activation; turning it on needs no confirmation.
|
||||
/// </summary>
|
||||
/// <param name="updatedState">The state the user chose.</param>
|
||||
/// <returns>True when the option may take the state.</returns>
|
||||
private async Task<bool> ConfirmRequireAuditBeforeActivationChange(bool updatedState)
|
||||
{
|
||||
if (!updatedState)
|
||||
if (updatedState)
|
||||
return true;
|
||||
|
||||
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||
{
|
||||
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||
{
|
||||
{
|
||||
x => x.Message,
|
||||
this.TA("Disabling this setting turns off assistant plugin security audits. External assistants may then be activated and used even without a valid audit or after plugin changes. Do you really want to disable this protection?")
|
||||
},
|
||||
};
|
||||
x => x.Message,
|
||||
TA("Disabling this setting turns off assistant plugin security audits. External assistants may then be activated and used even without a valid audit or after plugin changes. Do you really want to disable this protection?")
|
||||
},
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(
|
||||
this.T("Disable Assistant Audit Protection"),
|
||||
dialogParameters,
|
||||
DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
{
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.SettingsManager.ConfigurationData.AssistantPluginAudit.RequireAuditBeforeActivation = updatedState;
|
||||
await this.SettingsManager.StoreSettings();
|
||||
await this.SendMessage<bool>(Event.CONFIGURATION_CHANGED);
|
||||
await this.InvokeAsync(this.StateHasChanged);
|
||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(
|
||||
T("Disable Assistant Audit Protection"),
|
||||
dialogParameters,
|
||||
DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
return dialogResult is { Canceled: false };
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user