Switching to settings works now. Scrolling doesnt

This commit is contained in:
Peer Schütt 2025-03-10 13:29:55 +01:00
parent 5537c53d4f
commit 7137e58249
3 changed files with 48 additions and 46 deletions

View File

@ -8,11 +8,11 @@ namespace AIStudio.Components.Settings;
public abstract class SettingsPanelBase : ComponentBase
{
[Parameter]
public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableLLMProvidersFunc { get; set; } = () => [];
[CascadingParameter]
public Pages.Settings Settings { get; set; } = null!;
[Parameter]
public SettingsPanel ChosenPanel { get; set; }
public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableLLMProvidersFunc { get; set; } = () => [];
protected abstract SettingsPanel Type { get; }
@ -28,5 +28,5 @@ public abstract class SettingsPanelBase : ComponentBase
[Inject]
protected RustService RustService { get; init; } = null!;
protected bool IsExtended() => this.Type == this.ChosenPanel;
protected bool IsExtended() => this.Type == this.Settings.ChosenSettingsPanel;
}

View File

@ -6,6 +6,7 @@
<MudText Typo="Typo.h3" Class="mb-12">Settings</MudText>
<InnerScrolling>
<CascadingValue Value="@this">
<MudExpansionPanels Class="mb-3" MultiExpansion="@false">
<SettingsPanelProviders @bind-AvailableLLMProviders="@this.availableLLMProviders"/>
@ -46,5 +47,6 @@
<SettingsPanelAgentContentCleaner AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
</MudExpansionPanels>
</CascadingValue>
</InnerScrolling>
</div>

View File

@ -16,7 +16,7 @@ public partial class Settings : ComponentBase, IMessageBusReceiver, IDisposable
private List<ConfigurationSelectData<string>> availableLLMProviders = new();
private List<ConfigurationSelectData<string>> availableEmbeddingProviders = new();
private List<ConfigurationSelectData<string>> availableDataSources = new();
private SettingsPanel chosenSettingsPanel { get; set; }
public SettingsPanel ChosenSettingsPanel { get; private set; }
#region Overrides of ComponentBase
@ -26,7 +26,7 @@ public partial class Settings : ComponentBase, IMessageBusReceiver, IDisposable
this.MessageBus.RegisterComponent(this);
this.MessageBus.ApplyFilters(this, [], [ Event.CONFIGURATION_CHANGED ]);
this.chosenSettingsPanel = MessageBus.INSTANCE.CheckDeferredMessages<SettingsPanel>(Event.SWITCH_TO_SETTINGS_PANEL).FirstOrDefault();
this.ChosenSettingsPanel = MessageBus.INSTANCE.CheckDeferredMessages<SettingsPanel>(Event.SWITCH_TO_SETTINGS_PANEL).FirstOrDefault();
// var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<SettingsPanel>(Event.SWITCH_TO_SETTINGS_PANEL).FirstOrDefault();
//if (deferredContent != default)
//{