mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 13:21:37 +00:00
Allow settings explicit minimum confidence level
This commit is contained in:
parent
3aae3a98fa
commit
7db68ea6d5
@ -20,6 +20,9 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<AIStudio.Settings.Provider, string?> ValidateProvider { get; set; } = _ => null;
|
public Func<AIStudio.Settings.Provider, string?> ValidateProvider { get; set; } = _ => null;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public ConfidenceLevel ExplicitMinimumConfidence { get; set; } = ConfidenceLevel.UNKNOWN;
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private ILogger<ProviderSelection> Logger { get; init; } = null!;
|
private ILogger<ProviderSelection> Logger { get; init; } = null!;
|
||||||
@ -44,7 +47,15 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
case { } component:
|
case { } component:
|
||||||
|
|
||||||
|
// Get the minimum confidence level for this component, and/or the global minimum if enforced:
|
||||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(component);
|
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(component);
|
||||||
|
|
||||||
|
// Override with the explicit minimum level if set and higher:
|
||||||
|
if (this.ExplicitMinimumConfidence is not ConfidenceLevel.UNKNOWN && this.ExplicitMinimumConfidence > minimumLevel)
|
||||||
|
minimumLevel = this.ExplicitMinimumConfidence;
|
||||||
|
|
||||||
|
// Filter providers based on the minimum confidence level:
|
||||||
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
||||||
if (provider.UsedLLMProvider != LLMProviders.NONE)
|
if (provider.UsedLLMProvider != LLMProviders.NONE)
|
||||||
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||||
@ -52,4 +63,4 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user