mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-08 21:29:39 +00:00
Merge
This commit is contained in:
commit
8f357c97ed
21 files changed
+632
-21
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Tools.ToolCallingSystem;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -84,7 +85,8 @@ public partial class ManagedToolsWarning : MSGComponentBase
|
||||
|
||||
return this.availableTools
|
||||
.Where(x => this.ToolIds.Contains(x.Definition.Id) && x.IsActive)
|
||||
.Where(x => !ToolSelectionRules.IsProviderConfidenceAllowed(providerConfidence, x.MinimumProviderConfidence))
|
||||
.Where(x => !ToolSelectionRules.IsProviderAllowedForTool(x.Definition.Id, providerConfidence, x.MinimumProviderConfidence,
|
||||
this.ProviderSettings.IsTrustedByConfiguration(this.SettingsManager)))
|
||||
.Select(x => x.Implementation.GetDisplayName())
|
||||
.ToList();
|
||||
}
|
||||
@@ -108,4 +110,4 @@ public partial class ManagedToolsWarning : MSGComponentBase
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
<MudText Typo="Typo.body2">@context.Implementation.GetDescription()</MudText>
|
||||
</MudTd>
|
||||
<MudTd>
|
||||
<MudMenu StartIcon="@Icons.Material.Filled.Security" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@this.GetCurrentConfidenceLevelName(context)" Variant="Variant.Filled" Style="@this.SetCurrentConfidenceLevelColorStyle(context)" Disabled="@this.IsToolConfidenceManaged()">
|
||||
<MudMenu StartIcon="@Icons.Material.Filled.Security" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@this.GetCurrentConfidenceLevelName(context)" Variant="Variant.Filled" Style="@this.SetCurrentConfidenceLevelColorStyle(context)" Disabled="@this.IsToolConfidenceManaged(context)">
|
||||
@foreach (var confidenceLevel in this.GetSelectableConfidenceLevels())
|
||||
{
|
||||
<MudMenuItem OnClick="@(async () => await this.ChangeMinimumProviderConfidence(context, confidenceLevel))">
|
||||
|
||||
@@ -66,7 +66,9 @@ public partial class SettingsPanelTools : SettingsPanelBase
|
||||
private IEnumerable<ConfidenceLevel> GetSelectableConfidenceLevels() =>
|
||||
Enum.GetValues<ConfidenceLevel>().OrderBy(x => x).Where(x => x is not ConfidenceLevel.UNKNOWN);
|
||||
|
||||
private string GetCurrentConfidenceLevelName(ToolCatalogItem item) => this.GetConfidenceLevelName(GetMinimumProviderConfidence(item));
|
||||
private string GetCurrentConfidenceLevelName(ToolCatalogItem item) => item.Definition.Id == ToolSelectionRules.OUTLOOK_MAIL_TOOL_ID
|
||||
? this.T("High or organization-trusted")
|
||||
: this.GetConfidenceLevelName(GetMinimumProviderConfidence(item));
|
||||
|
||||
private string GetConfidenceLevelName(ConfidenceLevel confidenceLevel) => confidenceLevel is ConfidenceLevel.NONE
|
||||
? this.T("No minimum confidence level chosen")
|
||||
@@ -75,7 +77,8 @@ public partial class SettingsPanelTools : SettingsPanelBase
|
||||
private string SetCurrentConfidenceLevelColorStyle(ToolCatalogItem item) =>
|
||||
$"background-color: {GetMinimumProviderConfidence(item).GetColor(this.SettingsManager)};";
|
||||
|
||||
private bool IsToolConfidenceManaged() =>
|
||||
private bool IsToolConfidenceManaged(ToolCatalogItem item) =>
|
||||
item.Definition.Id == ToolSelectionRules.OUTLOOK_MAIL_TOOL_ID ||
|
||||
ManagedConfiguration.TryGet(x => x.Tools, x => x.MinimumProviderConfidenceByToolId, out var meta) && meta.IsLocked;
|
||||
|
||||
// The catalog already carries the resolved level, so there is nothing to look up again:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using AIStudio.Dialogs.Settings;
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Tools.ToolCallingSystem;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -116,13 +117,17 @@ public partial class ToolSelection : MSGComponentBase
|
||||
// The catalog already carries the resolved level, so there is nothing to look up again:
|
||||
private static ConfidenceLevel GetMinimumProviderConfidence(ToolCatalogItem item) => item.MinimumProviderConfidence;
|
||||
|
||||
private bool IsBlockedByProviderConfidence(ToolCatalogItem item) => !ToolSelectionRules.IsProviderConfidenceAllowed(this.ProviderConfidence, GetMinimumProviderConfidence(item));
|
||||
private bool IsBlockedByProviderConfidence(ToolCatalogItem item) => !ToolSelectionRules.IsProviderAllowedForTool(
|
||||
item.Definition.Id, this.ProviderConfidence, GetMinimumProviderConfidence(item), this.LLMProvider.IsTrustedByConfiguration(this.SettingsManager));
|
||||
|
||||
private string? GetProviderConfidenceHint(ToolCatalogItem item)
|
||||
{
|
||||
if (!this.IsBlockedByProviderConfidence(item))
|
||||
return null;
|
||||
|
||||
if (item.Definition.Id == ToolSelectionRules.OUTLOOK_MAIL_TOOL_ID)
|
||||
return this.T("Outlook Mail requires a High-confidence provider or one trusted by your organization.");
|
||||
|
||||
return string.Format(
|
||||
this.T("This tool requires provider confidence {0}. The selected provider has {1}."),
|
||||
GetMinimumProviderConfidence(item).GetName(),
|
||||
|
||||
Reference in new issue
Block a user