mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 03:41:38 +00:00
Fixed provider filtering for assistants (#646)
Some checks failed
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Some checks failed
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
This commit is contained in:
parent
9fc5c809b0
commit
0f6a8c3247
@ -22,7 +22,9 @@
|
|||||||
@if (this.Body is not null)
|
@if (this.Body is not null)
|
||||||
{
|
{
|
||||||
<CascadingValue Value="@this">
|
<CascadingValue Value="@this">
|
||||||
@this.Body
|
<CascadingValue Value="@this.Component">
|
||||||
|
@this.Body
|
||||||
|
</CascadingValue>
|
||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
|
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using AIStudio.Assistants;
|
|
||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
@ -10,7 +10,7 @@ namespace AIStudio.Components;
|
|||||||
public partial class ProviderSelection : MSGComponentBase
|
public partial class ProviderSelection : MSGComponentBase
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
public AssistantBase<NoComponent>? AssistantBase { get; set; }
|
public Tools.Components? Component { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
public AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||||
@ -21,6 +21,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;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private ILogger<ProviderSelection> Logger { get; init; } = null!;
|
||||||
|
|
||||||
private async Task SelectionChanged(AIStudio.Settings.Provider provider)
|
private async Task SelectionChanged(AIStudio.Settings.Provider provider)
|
||||||
{
|
{
|
||||||
this.ProviderSettings = provider;
|
this.ProviderSettings = provider;
|
||||||
@ -30,10 +33,23 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
private IEnumerable<AIStudio.Settings.Provider> GetAvailableProviders()
|
private IEnumerable<AIStudio.Settings.Provider> GetAvailableProviders()
|
||||||
{
|
{
|
||||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.AssistantBase?.Component ?? Tools.Components.NONE);
|
switch (this.Component)
|
||||||
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
{
|
||||||
if (provider.UsedLLMProvider != LLMProviders.NONE)
|
case null:
|
||||||
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
this.Logger.LogError("Component is null! Cannot filter providers based on component settings. Missed CascadingParameter?");
|
||||||
yield return provider;
|
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)
|
# 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