mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-03-29 13:51:37 +00:00
Add a warning to the dynamic assistant
This commit is contained in:
parent
69ae243903
commit
ff6392885e
@ -1,4 +1,5 @@
|
|||||||
@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
|
@attribute [Route(Routes.ASSISTANT_DYNAMIC)]
|
||||||
|
@using AIStudio.Agents.AssistantAudit
|
||||||
@using AIStudio.Settings
|
@using AIStudio.Settings
|
||||||
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
|
@using AIStudio.Tools.PluginSystem.Assistants.DataModel
|
||||||
@using AIStudio.Tools.PluginSystem.Assistants.DataModel.Layout
|
@using AIStudio.Tools.PluginSystem.Assistants.DataModel.Layout
|
||||||
@ -12,6 +13,15 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@if (this.audit is not null && this.audit.Level is not AssistantAuditLevel.SAFE)
|
||||||
|
{
|
||||||
|
<MudPaper Class="pa-4 ma-4" Elevation="0">
|
||||||
|
<MudAlert Severity="@this.audit.Level.GetSeverity()" Variant="Variant.Filled" Square="false" Elevation="6" Class="pa-4">
|
||||||
|
<strong>@this.audit.Level.GetName().ToUpperInvariant(): </strong>@this.audit.Summary
|
||||||
|
</MudAlert>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
|
||||||
@foreach (var component in this.RootComponent.Children)
|
@foreach (var component in this.RootComponent.Children)
|
||||||
{
|
{
|
||||||
@this.RenderComponent(component)
|
@this.RenderComponent(component)
|
||||||
|
|||||||
@ -39,6 +39,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
|
|||||||
private readonly HashSet<string> executingButtonActions = [];
|
private readonly HashSet<string> executingButtonActions = [];
|
||||||
private readonly HashSet<string> executingSwitchActions = [];
|
private readonly HashSet<string> executingSwitchActions = [];
|
||||||
private string pluginPath = string.Empty;
|
private string pluginPath = string.Empty;
|
||||||
|
private PluginAssistantAudit? audit;
|
||||||
private const string ASSISTANT_QUERY_KEY = "assistantId";
|
private const string ASSISTANT_QUERY_KEY = "assistantId";
|
||||||
|
|
||||||
#region Implementation of AssistantBase
|
#region Implementation of AssistantBase
|
||||||
@ -62,6 +63,8 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
|
|||||||
this.allowProfiles = pluginAssistant.AllowProfiles;
|
this.allowProfiles = pluginAssistant.AllowProfiles;
|
||||||
this.showFooterProfileSelection = !pluginAssistant.HasEmbeddedProfileSelection;
|
this.showFooterProfileSelection = !pluginAssistant.HasEmbeddedProfileSelection;
|
||||||
this.pluginPath = pluginAssistant.PluginPath;
|
this.pluginPath = pluginAssistant.PluginPath;
|
||||||
|
var pluginHash = pluginAssistant.ComputeAuditHash();
|
||||||
|
this.audit = this.SettingsManager.ConfigurationData.AssistantPluginAudits.FirstOrDefault(x => x.PluginId == pluginAssistant.Id && x.PluginHash == pluginHash);
|
||||||
|
|
||||||
var rootComponent = this.RootComponent;
|
var rootComponent = this.RootComponent;
|
||||||
if (rootComponent is not null)
|
if (rootComponent is not null)
|
||||||
@ -403,7 +406,7 @@ public partial class AssistantDynamic : AssistantBaseCore<SettingsDialogDynamic>
|
|||||||
prompt.Append(this.CollectUserPromptFallback(component.Children));
|
prompt.Append(this.CollectUserPromptFallback(component.Children));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return prompt.ToString();
|
return prompt.Append(Environment.NewLine).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user