mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 08:33:49 +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
@@ -0,0 +1,50 @@
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
|
||||
namespace AIStudio.AIOperations.PluginAudit;
|
||||
|
||||
public static class PluginAuditLevelExtensions
|
||||
{
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(PluginAuditLevelExtensions).Namespace, nameof(PluginAuditLevelExtensions));
|
||||
|
||||
extension(PluginAuditLevel level)
|
||||
{
|
||||
public string Name => level switch
|
||||
{
|
||||
PluginAuditLevel.DANGEROUS => TB("Dangerous"),
|
||||
PluginAuditLevel.CAUTION => TB("Concerning"),
|
||||
PluginAuditLevel.SAFE => TB("Safe"),
|
||||
_ => TB("Unknown"),
|
||||
};
|
||||
|
||||
public Severity Severity => level switch
|
||||
{
|
||||
PluginAuditLevel.DANGEROUS => Severity.Error,
|
||||
PluginAuditLevel.CAUTION => Severity.Warning,
|
||||
PluginAuditLevel.SAFE => Severity.Success,
|
||||
_ => Severity.Info,
|
||||
};
|
||||
|
||||
public Color Color => level switch
|
||||
{
|
||||
PluginAuditLevel.DANGEROUS => Color.Error,
|
||||
PluginAuditLevel.CAUTION => Color.Warning,
|
||||
PluginAuditLevel.SAFE => Color.Success,
|
||||
_ => Color.Default,
|
||||
};
|
||||
|
||||
public string Icon => level switch
|
||||
{
|
||||
PluginAuditLevel.DANGEROUS => AppIcons.SECURITY_DANGEROUS,
|
||||
PluginAuditLevel.CAUTION => AppIcons.WARNING,
|
||||
PluginAuditLevel.SAFE => AppIcons.AUDIT_SAFE,
|
||||
_ => AppIcons.UNKNOWN,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Parses an audit level string and falls back to <see cref="PluginAuditLevel.UNKNOWN"/> when parsing fails.
|
||||
/// </summary>
|
||||
/// <param name="value">The audit level text to parse.</param>
|
||||
/// <returns>The parsed audit level, or <see cref="PluginAuditLevel.UNKNOWN"/> for null, empty, or invalid values.</returns>
|
||||
public static PluginAuditLevel ParseOrUnknown(string? value) => Enum.TryParse<PluginAuditLevel>(value, true, out var parsedLevel) ? parsedLevel : PluginAuditLevel.UNKNOWN;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user