diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs index 83fa07e4..b1568427 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components; namespace AIStudio.Dialogs.Settings; -public abstract class SettingsDialogBase : ComponentBase +public abstract class SettingsDialogBase : ComponentBase, IMessageBusReceiver, IDisposable { [CascadingParameter] protected IMudDialogInstance MudDialog { get; set; } = null!; @@ -30,11 +30,15 @@ public abstract class SettingsDialogBase : ComponentBase #region Overrides of ComponentBase /// - 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.UpdateEmbeddingProviders(); - base.OnInitialized(); + await base.OnInitializedAsync(); } #endregion @@ -55,4 +59,36 @@ public abstract class SettingsDialogBase : ComponentBase foreach (var provider in this.SettingsManager.ConfigurationData.EmbeddingProviders) this.availableEmbeddingProviders.Add(new (provider.Name, provider.Id)); } + + #region Implementation of IMessageBusReceiver + + public string ComponentName => nameof(Settings); + + public Task ProcessMessage(ComponentBase? sendingComponent, Event triggeredEvent, TMsg? data) + { + switch (triggeredEvent) + { + case Event.CONFIGURATION_CHANGED: + this.StateHasChanged(); + break; + } + + return Task.CompletedTask; + } + + public Task ProcessMessageWithResult(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data) + { + return Task.FromResult(default); + } + + #endregion + + #region Implementation of IDisposable + + public void Dispose() + { + this.MessageBus.Unregister(this); + } + + #endregion } \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.37.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.37.md index b5234bf6..a04fe72a 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.37.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.37.md @@ -4,4 +4,5 @@ - 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 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. \ No newline at end of file