diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor b/app/MindWork AI Studio/Assistants/AssistantBase.razor index e35c6440..5fee5f0a 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor @@ -25,7 +25,9 @@ @if (this.Body is not null) { - @this.Body + + @this.Body + diff --git a/app/MindWork AI Studio/Components/ProviderSelection.razor.cs b/app/MindWork AI Studio/Components/ProviderSelection.razor.cs index ded13ebd..bdc76ddc 100644 --- a/app/MindWork AI Studio/Components/ProviderSelection.razor.cs +++ b/app/MindWork AI Studio/Components/ProviderSelection.razor.cs @@ -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? 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 ValidateProvider { get; set; } = _ => null; + [Inject] + private ILogger 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 GetAvailableProviders() { - var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.AssistantBase?.Component ?? Tools.Components.NONE); - foreach (var provider in this.SettingsManager.ConfigurationData.Providers) - if (provider.UsedLLMProvider != LLMProviders.NONE) - if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel) - yield return provider; + 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; + } } } \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.2.1.md b/app/MindWork AI Studio/wwwroot/changelog/v26.2.1.md index da549883..13dde977 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.2.1.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.2.1.md @@ -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. \ No newline at end of file