mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-07-20 15:42:57 +00:00
Settings dialogs must be updated when settings are changed (#360)
This commit is contained in:
parent
a5863a176c
commit
f5a49ff077
app/MindWork AI Studio
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components;
|
|||||||
|
|
||||||
namespace AIStudio.Dialogs.Settings;
|
namespace AIStudio.Dialogs.Settings;
|
||||||
|
|
||||||
public abstract class SettingsDialogBase : ComponentBase
|
public abstract class SettingsDialogBase : ComponentBase, IMessageBusReceiver, IDisposable
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected IMudDialogInstance MudDialog { get; set; } = null!;
|
protected IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
@ -30,11 +30,15 @@ public abstract class SettingsDialogBase : ComponentBase
|
|||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void OnInitialized()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
// Register this component with the message bus:
|
||||||
|
this.MessageBus.RegisterComponent(this);
|
||||||
|
this.MessageBus.ApplyFilters(this, [], [ Event.CONFIGURATION_CHANGED ]);
|
||||||
|
|
||||||
this.UpdateProviders();
|
this.UpdateProviders();
|
||||||
this.UpdateEmbeddingProviders();
|
this.UpdateEmbeddingProviders();
|
||||||
base.OnInitialized();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -55,4 +59,36 @@ public abstract class SettingsDialogBase : ComponentBase
|
|||||||
foreach (var provider in this.SettingsManager.ConfigurationData.EmbeddingProviders)
|
foreach (var provider in this.SettingsManager.ConfigurationData.EmbeddingProviders)
|
||||||
this.availableEmbeddingProviders.Add(new (provider.Name, provider.Id));
|
this.availableEmbeddingProviders.Add(new (provider.Name, provider.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Implementation of IMessageBusReceiver
|
||||||
|
|
||||||
|
public string ComponentName => nameof(Settings);
|
||||||
|
|
||||||
|
public Task ProcessMessage<TMsg>(ComponentBase? sendingComponent, Event triggeredEvent, TMsg? data)
|
||||||
|
{
|
||||||
|
switch (triggeredEvent)
|
||||||
|
{
|
||||||
|
case Event.CONFIGURATION_CHANGED:
|
||||||
|
this.StateHasChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<TResult?> ProcessMessageWithResult<TPayload, TResult>(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data)
|
||||||
|
{
|
||||||
|
return Task.FromResult<TResult?>(default);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Implementation of IDisposable
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
this.MessageBus.Unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
@ -4,4 +4,5 @@
|
|||||||
- Moved the data source settings into the data selection component.
|
- Moved the data source settings into the data selection component.
|
||||||
- Fixed the "send to" menu position, which was offset due to the MudBlazor 8 upgrade.
|
- Fixed the "send to" menu position, which was offset due to the MudBlazor 8 upgrade.
|
||||||
- Fixed a rare issue with the enum selection component, where the `SelectionUpdated` function was not called for the special `other` enum values.
|
- Fixed a rare issue with the enum selection component, where the `SelectionUpdated` function was not called for the special `other` enum values.
|
||||||
|
- Fixed the new setting dialogs, which were not updated appropriately when settings were changed.
|
||||||
- Removed the link to the ERI server assistant from its settings page, as it is no longer necessary.
|
- Removed the link to the ERI server assistant from its settings page, as it is no longer necessary.
|
Loading…
Reference in New Issue
Block a user