mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 18:41:36 +00:00
Added async methods for changed configurations
This commit is contained in:
parent
1e4eb7c725
commit
da4d3508b2
@ -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.")"/>
|
||||||
@ -18,6 +18,12 @@ public partial class ConfigurationMinConfidenceSelection : MSGComponentBase
|
|||||||
[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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -28,6 +28,12 @@ public partial class ConfigurationSelect<TConfig> : ConfigurationBaseCore
|
|||||||
[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
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user