mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 11:41:38 +00:00
Allow settings explicit minimum confidence level
This commit is contained in:
parent
06a9554e67
commit
71169c76cf
@ -26,6 +26,9 @@ public partial class ConfigurationProviderSelection : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Tools.Components Component { get; set; } = Tools.Components.NONE;
|
public Tools.Components Component { get; set; } = Tools.Components.NONE;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public ConfidenceLevel ExplicitMinimumConfidence { get; set; } = ConfidenceLevel.UNKNOWN;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<bool> Disabled { get; set; } = () => false;
|
public Func<bool> Disabled { get; set; } = () => false;
|
||||||
|
|
||||||
@ -38,7 +41,14 @@ public partial class ConfigurationProviderSelection : MSGComponentBase
|
|||||||
if(this.Component is not Tools.Components.NONE and not Tools.Components.APP_SETTINGS)
|
if(this.Component is not Tools.Components.NONE and not Tools.Components.APP_SETTINGS)
|
||||||
yield return new(T("Use app default"), string.Empty);
|
yield return new(T("Use app default"), string.Empty);
|
||||||
|
|
||||||
|
// Get the minimum confidence level for this component, and/or the enforced global minimum confidence level:
|
||||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.Component);
|
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.Component);
|
||||||
|
|
||||||
|
// Apply the explicit minimum confidence level if set and higher than the current minimum level:
|
||||||
|
if (this.ExplicitMinimumConfidence is not ConfidenceLevel.UNKNOWN && this.ExplicitMinimumConfidence > minimumLevel)
|
||||||
|
minimumLevel = this.ExplicitMinimumConfidence;
|
||||||
|
|
||||||
|
// Filter the providers based on the minimum confidence level:
|
||||||
foreach (var providerId in this.Data)
|
foreach (var providerId in this.Data)
|
||||||
{
|
{
|
||||||
var provider = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == providerId.Value);
|
var provider = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == providerId.Value);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user