mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 13:01:37 +00:00
Fix provider filtering for assistants
This commit is contained in:
parent
85642368ae
commit
3aae3a98fa
@ -25,8 +25,10 @@
|
||||
@if (this.Body is not null)
|
||||
{
|
||||
<CascadingValue Value="@this">
|
||||
<CascadingValue Value="@this.Component">
|
||||
@this.Body
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
|
||||
<MudButton Disabled="@this.SubmitDisabled" Variant="Variant.Filled" OnClick="@(async () => await this.Start())" Style="@this.SubmitButtonStyle">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using AIStudio.Assistants;
|
||||
using AIStudio.Provider;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -10,7 +10,7 @@ namespace AIStudio.Components;
|
||||
public partial class ProviderSelection : MSGComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
public AssistantBase<NoComponent>? AssistantBase { get; set; }
|
||||
public Tools.Components? Component { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||
@ -21,6 +21,9 @@ public partial class ProviderSelection : MSGComponentBase
|
||||
[Parameter]
|
||||
public Func<AIStudio.Settings.Provider, string?> ValidateProvider { get; set; } = _ => null;
|
||||
|
||||
[Inject]
|
||||
private ILogger<ProviderSelection> Logger { get; init; } = null!;
|
||||
|
||||
private async Task SelectionChanged(AIStudio.Settings.Provider provider)
|
||||
{
|
||||
this.ProviderSettings = provider;
|
||||
@ -30,10 +33,23 @@ public partial class ProviderSelection : MSGComponentBase
|
||||
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||
private IEnumerable<AIStudio.Settings.Provider> GetAvailableProviders()
|
||||
{
|
||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.AssistantBase?.Component ?? Tools.Components.NONE);
|
||||
switch (this.Component)
|
||||
{
|
||||
case null:
|
||||
this.Logger.LogError("Component is null! Cannot filter providers based on component settings. Missed CascadingParameter?");
|
||||
yield break;
|
||||
|
||||
case Tools.Components.NONE:
|
||||
this.Logger.LogError("Component is NONE! Cannot filter providers based on component settings. Used wrong component?");
|
||||
yield break;
|
||||
|
||||
case { } component:
|
||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(component);
|
||||
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
||||
if (provider.UsedLLMProvider != LLMProviders.NONE)
|
||||
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||
yield return provider;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1 +1,2 @@
|
||||
# v26.2.1, build 233 (2026-02-xx xx:xx UTC)
|
||||
- Fixed a bug where the global minimum confidence level was not being applied to the assistants.
|
||||
Loading…
Reference in New Issue
Block a user