Added async methods for changed configurations

This commit is contained in:
Thorsten Sommer 2026-01-27 19:41:13 +01:00
parent 1e4eb7c725
commit da4d3508b2
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,3 @@
@using AIStudio.Settings @using AIStudio.Settings
@inherits MSGComponentBase @inherits MSGComponentBase
<ConfigurationSelect IsLocked="this.IsLocked" Disabled="this.Disabled" OptionDescription="@T("Select a minimum confidence level")" SelectedValue="@this.FilteredSelectedValue" Data="@ConfigurationSelectDataFactory.GetConfidenceLevelsData(this.SettingsManager, this.RestrictToGlobalMinimumConfidence)" SelectionUpdate="@this.SelectionUpdate" OptionHelp="@T("Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level.")"/> <ConfigurationSelect IsLocked="this.IsLocked" Disabled="this.Disabled" OptionDescription="@T("Select a minimum confidence level")" SelectedValue="@this.FilteredSelectedValue" Data="@ConfigurationSelectDataFactory.GetConfidenceLevelsData(this.SettingsManager, this.RestrictToGlobalMinimumConfidence)" SelectionUpdate="@this.SelectionUpdate" SelectionUpdateAsync="@this.SelectionUpdateAsync" OptionHelp="@T("Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level.")"/>

View File

@ -17,6 +17,12 @@ public partial class ConfigurationMinConfidenceSelection : MSGComponentBase
/// </summary> /// </summary>
[Parameter] [Parameter]
public Action<ConfidenceLevel> SelectionUpdate { get; set; } = _ => { }; public Action<ConfidenceLevel> SelectionUpdate { get; set; } = _ => { };
/// <summary>
/// An asynchronous action that is called when the selection changes.
/// </summary>
[Parameter]
public Func<ConfidenceLevel, Task> SelectionUpdateAsync { get; set; } = _ => Task.CompletedTask;
/// <summary> /// <summary>
/// Boolean value indicating whether the selection is restricted to a global minimum confidence level. /// Boolean value indicating whether the selection is restricted to a global minimum confidence level.

View File

@ -27,6 +27,12 @@ public partial class ConfigurationSelect<TConfig> : ConfigurationBaseCore
/// </summary> /// </summary>
[Parameter] [Parameter]
public Action<TConfig> SelectionUpdate { get; set; } = _ => { }; public Action<TConfig> SelectionUpdate { get; set; } = _ => { };
/// <summary>
/// An asynchronous action that is called when the selection changes.
/// </summary>
[Parameter]
public Func<TConfig, Task> SelectionUpdateAsync { get; set; } = _ => Task.CompletedTask;
#region Overrides of ConfigurationBase #region Overrides of ConfigurationBase
@ -44,6 +50,7 @@ public partial class ConfigurationSelect<TConfig> : ConfigurationBaseCore
private async Task OptionChanged(TConfig updatedValue) private async Task OptionChanged(TConfig updatedValue)
{ {
this.SelectionUpdate(updatedValue); this.SelectionUpdate(updatedValue);
await this.SelectionUpdateAsync(updatedValue);
await this.SettingsManager.StoreSettings(); await this.SettingsManager.StoreSettings();
await this.InformAboutChange(); await this.InformAboutChange();
} }