mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-21 10:32:16 +00:00
skip dialog and audit automatically if this is what the settings demand
This commit is contained in:
parent
b6a174929a
commit
67d39557bb
@ -23,6 +23,9 @@ public partial class Plugins : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
private IDialogService DialogService { get; init; } = null!;
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private AssistantPluginAuditService AssistantPluginAuditService { get; init; } = null!;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
@ -72,6 +75,31 @@ public partial class Plugins : MSGComponentBase
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var securityState = PluginAssistantSecurityResolver.Resolve(this.SettingsManager, assistantPlugin);
|
var securityState = PluginAssistantSecurityResolver.Resolve(this.SettingsManager, assistantPlugin);
|
||||||
|
if (securityState.RequiresAudit)
|
||||||
|
{
|
||||||
|
if (this.AssistantPluginAuditSettings.AutomaticallyAuditAssistants)
|
||||||
|
{
|
||||||
|
var audit = await this.AssistantPluginAuditService.RunAuditAsync(assistantPlugin);
|
||||||
|
if (audit.Level is AssistantAuditLevel.UNKNOWN)
|
||||||
|
{
|
||||||
|
await MessageBus.INSTANCE.SendError(new (Icons.Material.Filled.SettingsSuggest, string.Format(T("The Audit returned an invalid result, please try again."))));
|
||||||
|
await this.OpenAssistantAuditDialogAsync(pluginMeta.Id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.UpsertAuditCard(audit);
|
||||||
|
await this.SettingsManager.StoreSettings();
|
||||||
|
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
|
||||||
|
securityState = PluginAssistantSecurityResolver.Resolve(this.SettingsManager, assistantPlugin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await this.OpenAssistantAuditDialogAsync(pluginMeta.Id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (securityState.RequiresAudit)
|
if (securityState.RequiresAudit)
|
||||||
{
|
{
|
||||||
await this.OpenAssistantAuditDialogAsync(pluginMeta.Id);
|
await this.OpenAssistantAuditDialogAsync(pluginMeta.Id);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using AIStudio.Settings;
|
|||||||
using AIStudio.Tools.Databases;
|
using AIStudio.Tools.Databases;
|
||||||
using AIStudio.Tools.Databases.Qdrant;
|
using AIStudio.Tools.Databases.Qdrant;
|
||||||
using AIStudio.Tools.PluginSystem;
|
using AIStudio.Tools.PluginSystem;
|
||||||
|
using AIStudio.Tools.PluginSystem.Assistants;
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
@ -178,6 +179,7 @@ internal sealed class Program
|
|||||||
builder.Services.AddTransient<AgentRetrievalContextValidation>();
|
builder.Services.AddTransient<AgentRetrievalContextValidation>();
|
||||||
builder.Services.AddTransient<AgentTextContentCleaner>();
|
builder.Services.AddTransient<AgentTextContentCleaner>();
|
||||||
builder.Services.AddTransient<AssistantAuditAgent>();
|
builder.Services.AddTransient<AssistantAuditAgent>();
|
||||||
|
builder.Services.AddTransient<AssistantPluginAuditService>();
|
||||||
builder.Services.AddHostedService<UpdateService>();
|
builder.Services.AddHostedService<UpdateService>();
|
||||||
builder.Services.AddHostedService<TemporaryChatService>();
|
builder.Services.AddHostedService<TemporaryChatService>();
|
||||||
builder.Services.AddHostedService<EnterpriseEnvironmentService>();
|
builder.Services.AddHostedService<EnterpriseEnvironmentService>();
|
||||||
|
|||||||
@ -254,7 +254,6 @@ public static partial class PluginFactory
|
|||||||
wasConfigurationChanged = true;
|
wasConfigurationChanged = true;
|
||||||
|
|
||||||
// Check if security audits are invoked automatically and transparent for the user
|
// Check if security audits are invoked automatically and transparent for the user
|
||||||
// TODO: USE THIS SETTING
|
|
||||||
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.AutomaticallyAuditAssistants, AVAILABLE_PLUGINS))
|
if(ManagedConfiguration.IsConfigurationLeftOver(x => x.AssistantPluginAudit, x => x.AutomaticallyAuditAssistants, AVAILABLE_PLUGINS))
|
||||||
wasConfigurationChanged = true;
|
wasConfigurationChanged = true;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user