SettingsPanel Enum removed, because it is no longer needed

This commit is contained in:
Peer Schütt committed 2025-03-12 10:58:52 +01:00
1 parent b0c6292fbe
commit 9f52c2ae67
24 files changed
+33 -100

No files matched your search

@@ -1,20 +0,0 @@
namespace AIStudio.Components.Settings;
public enum SettingsPanel
{
NONE,
// Pages
PROVIDER_PANEL,
EMBEDDINGS_PANEL,
DATA_SOURCES_PANEL,
PROFILES_PANEL,
APP_PANEL,
CHAT_PANEL,
WORKSPACE_PANEL,
// Agents
AGENT_DATA_SOURCE_SELECTION_PANEL,
AGENT_RETRIEVAL_CONTEXT_VALIDATION_PANEL,
AGENT_CONTENT_CLEANER_PANEL,
}
@@ -1,6 +1,6 @@
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="Agent: Text Content Cleaner Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="Agent: Text Content Cleaner Options">
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
<MudText Typo="Typo.body1" Class="mb-3">
Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things,
@@ -1,6 +1,3 @@
namespace AIStudio.Components.Settings;
public partial class SettingsPanelAgentContentCleaner : SettingsPanelBase
{
protected override SettingsPanel Type => SettingsPanel.AGENT_CONTENT_CLEANER_PANEL;
}
public partial class SettingsPanelAgentContentCleaner : SettingsPanelBase;
@@ -1,6 +1,6 @@
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.SelectAll" HeaderText="Agent: Data Source Selection Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.SelectAll" HeaderText="Agent: Data Source Selection Options">
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
<MudText Typo="Typo.body1" Class="mb-3">
Use Case: this agent is used to select the appropriate data sources for the current prompt.
@@ -1,6 +1,3 @@
namespace AIStudio.Components.Settings;
public partial class SettingsPanelAgentDataSourceSelection : SettingsPanelBase
{
protected override SettingsPanel Type => SettingsPanel.AGENT_DATA_SOURCE_SELECTION_PANEL;
}
public partial class SettingsPanelAgentDataSourceSelection : SettingsPanelBase;
@@ -1,6 +1,6 @@
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="Agent: Retrieval Context Validation Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="Agent: Retrieval Context Validation Options">
<MudText Typo="Typo.body1" Class="mb-3">
Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these
retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this
@@ -1,6 +1,3 @@
namespace AIStudio.Components.Settings;
public partial class SettingsPanelAgentRetrievalContextValidation : SettingsPanelBase
{
protected override SettingsPanel Type => SettingsPanel.AGENT_RETRIEVAL_CONTEXT_VALIDATION_PANEL;
}
public partial class SettingsPanelAgentRetrievalContextValidation : SettingsPanelBase;
@@ -2,7 +2,7 @@
@using AIStudio.Settings.DataModel
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Apps" HeaderText="App Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Apps" HeaderText="App Options">
<ConfigurationSelect OptionDescription="Color theme" SelectedValue="@(() => this.SettingsManager.ConfigurationData.App.PreferredTheme)" Data="@ConfigurationSelectDataFactory.GetThemesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.App.PreferredTheme = selectedValue)" OptionHelp="Choose the color theme that best suits for you."/>
<ConfigurationOption OptionDescription="Save energy?" LabelOn="Energy saving is enabled" LabelOff="Energy saving is disabled" State="@(() => this.SettingsManager.ConfigurationData.App.IsSavingEnergy)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.App.IsSavingEnergy = updatedState)" OptionHelp="When enabled, streamed content from the AI is updated once every third second. When disabled, streamed content will be updated as soon as it is available."/>
<ConfigurationOption OptionDescription="Enable spellchecking?" LabelOn="Spellchecking is enabled" LabelOff="Spellchecking is disabled" State="@(() => this.SettingsManager.ConfigurationData.App.EnableSpellchecking)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.App.EnableSpellchecking = updatedState)" OptionHelp="When enabled, spellchecking will be active in all input fields. Depending on your operating system, errors may not be visually highlighted, but right-clicking may still offer possible corrections." />
@@ -9,6 +9,4 @@ public partial class SettingsPanelApp : SettingsPanelBase
this.SettingsManager.ConfigurationData.App.PreviewVisibility = previewVisibility;
this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures = previewVisibility.FilterPreviewFeatures(this.SettingsManager.ConfigurationData.App.EnabledPreviewFeatures);
}
protected override SettingsPanel Type => SettingsPanel.APP_PANEL;
}
@@ -8,14 +8,9 @@ namespace AIStudio.Components.Settings;
public abstract class SettingsPanelBase : ComponentBase
{
[CascadingParameter]
public Pages.Settings Settings { get; set; } = null!;
[Parameter]
public Func<IReadOnlyList<ConfigurationSelectData<string>>> AvailableLLMProvidersFunc { get; set; } = () => [];
protected abstract SettingsPanel Type { get; }
[Inject]
protected SettingsManager SettingsManager { get; init; } = null!;
@@ -27,6 +22,4 @@ public abstract class SettingsPanelBase : ComponentBase
[Inject]
protected RustService RustService { get; init; } = null!;
protected bool IsExtended() => this.Type == this.Settings.ChosenSettingsPanel;
}
@@ -2,7 +2,7 @@
@using AIStudio.Settings.DataModel
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Chat" HeaderText="Chat Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Chat" HeaderText="Chat Options">
<ConfigurationSelect OptionDescription="Shortcut to send input" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.ShortcutSendBehavior)" Data="@ConfigurationSelectDataFactory.GetSendBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.ShortcutSendBehavior = selectedValue)" OptionHelp="Do you want to use any shortcut to send your input?"/>
<ConfigurationOption OptionDescription="Show the latest message after loading?" LabelOn="Latest message is shown, after loading a chat" LabelOff="First (oldest) message is shown, after loading a chat" State="@(() => this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading = updatedState)" OptionHelp="When enabled, the latest message is shown after loading a chat. When disabled, the first (oldest) message is shown."/>
<ConfigurationSelect OptionDescription="Provider selection when creating new chats" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Chat.AddChatProviderBehavior)" Data="@ConfigurationSelectDataFactory.GetAddChatProviderBehavior()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Chat.AddChatProviderBehavior = selectedValue)" OptionHelp="Control how the LLM provider for added chats is selected."/>
@@ -1,6 +1,3 @@
namespace AIStudio.Components.Settings;
public partial class SettingsPanelChat : SettingsPanelBase
{
protected override SettingsPanel Type => SettingsPanel.CHAT_PANEL;
}
public partial class SettingsPanelChat : SettingsPanelBase;
@@ -3,7 +3,7 @@
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.IntegrationInstructions" HeaderText="Configure Data Sources" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.IntegrationInstructions" HeaderText="Configure Data Sources">
<PreviewPrototype/>
<MudText Typo="Typo.h4" Class="mb-3">
Configured Data Sources
@@ -256,6 +256,4 @@ public partial class SettingsPanelDataSources : SettingsPanelBase
await this.AvailableDataSourcesChanged.InvokeAsync(this.AvailableDataSources);
}
protected override SettingsPanel Type => SettingsPanel.DATA_SOURCES_PANEL;
}
@@ -4,7 +4,7 @@
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.IntegrationInstructions" HeaderText="Configure Embeddings" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.IntegrationInstructions" HeaderText="Configure Embeddings">
<PreviewPrototype/>
<MudText Typo="Typo.h4" Class="mb-3">
Configured Embeddings
@@ -119,6 +119,4 @@ public partial class SettingsPanelEmbeddings : SettingsPanelBase
await this.AvailableEmbeddingProvidersChanged.InvokeAsync(this.AvailableEmbeddingProviders);
}
protected override SettingsPanel Type => SettingsPanel.EMBEDDINGS_PANEL;
}
@@ -1,6 +1,6 @@
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Person4" HeaderText="Configure Profiles" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Person4" HeaderText="Configure Profiles">
<MudText Typo="Typo.h4" Class="mb-3">Your Profiles</MudText>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
Store personal data about yourself in various profiles so that the AIs know your personal context.
@@ -69,6 +69,4 @@ public partial class SettingsPanelProfiles : SettingsPanelBase
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
}
protected override SettingsPanel Type => SettingsPanel.PROFILES_PANEL;
}
@@ -3,7 +3,7 @@
@using AIStudio.Provider.SelfHosted
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Layers" HeaderText="Configure Providers" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Layers" HeaderText="Configure Providers">
<MudText Typo="Typo.h4" Class="mb-3">Configured Providers</MudText>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
What we call a provider is the combination of an LLM provider such as OpenAI and a model like GPT-4o.
@@ -148,6 +148,4 @@ public partial class SettingsPanelProviders : SettingsPanelBase
this.SettingsManager.ConfigurationData.LLMProviders.CustomConfidenceScheme[llmProvider] = level;
await this.SettingsManager.StoreSettings();
}
protected override SettingsPanel Type => SettingsPanel.PROVIDER_PANEL;
}
@@ -2,7 +2,7 @@
@using AIStudio.Settings.DataModel
@inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Work" HeaderText="Workspace Options" IsExpanded="@this.IsExtended()">
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Work" HeaderText="Workspace Options">
<ConfigurationSelect OptionDescription="Workspace behavior" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Workspace.StorageBehavior)" Data="@ConfigurationSelectDataFactory.GetWorkspaceStorageBehaviorData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Workspace.StorageBehavior = selectedValue)" OptionHelp="Should we store your chats?"/>
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
@@ -1,6 +1,3 @@
namespace AIStudio.Components.Settings;
public partial class SettingsPanelWorkspaces : SettingsPanelBase
{
protected override SettingsPanel Type => SettingsPanel.WORKSPACE_PANEL;
}
public partial class SettingsPanelWorkspaces : SettingsPanelBase;
+18 -20
View File
@@ -6,28 +6,26 @@
<MudText Typo="Typo.h3" Class="mb-12">Settings</MudText>
<InnerScrolling>
<CascadingValue Value="@this">
<MudExpansionPanels Class="mb-3" MultiExpansion="@false">
<SettingsPanelProviders @bind-AvailableLLMProviders="@this.availableLLMProviders"/>
<MudExpansionPanels Class="mb-3" MultiExpansion="@false">
<SettingsPanelProviders @bind-AvailableLLMProviders="@this.availableLLMProviders"/>
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<SettingsPanelEmbeddings AvailableLLMProvidersFunc="() => this.availableLLMProviders" @bind-AvailableEmbeddingProviders="@this.availableEmbeddingProviders"/>
<SettingsPanelDataSources AvailableLLMProvidersFunc="() => this.availableLLMProviders" AvailableEmbeddingsFunc="() => this.availableEmbeddingProviders" @bind-AvailableDataSources="@this.availableDataSources"/>
}
<SettingsPanelProfiles AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelApp AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelChat AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelWorkspaces AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<SettingsPanelEmbeddings AvailableLLMProvidersFunc="() => this.availableLLMProviders" @bind-AvailableEmbeddingProviders="@this.availableEmbeddingProviders"/>
<SettingsPanelDataSources AvailableLLMProvidersFunc="() => this.availableLLMProviders" AvailableEmbeddingsFunc="() => this.availableEmbeddingProviders" @bind-AvailableDataSources="@this.availableDataSources"/>
}
<SettingsPanelProfiles AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelApp AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelChat AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelWorkspaces AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<SettingsPanelAgentDataSourceSelection AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelAgentRetrievalContextValidation AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
}
@if (PreviewFeatures.PRE_RAG_2024.IsEnabled(this.SettingsManager))
{
<SettingsPanelAgentDataSourceSelection AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
<SettingsPanelAgentRetrievalContextValidation AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
}
<SettingsPanelAgentContentCleaner AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
</MudExpansionPanels>
</CascadingValue>
<SettingsPanelAgentContentCleaner AvailableLLMProvidersFunc="() => this.availableLLMProviders"/>
</MudExpansionPanels>
</InnerScrolling>
</div>
@@ -16,7 +16,6 @@ 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();
public SettingsPanel ChosenSettingsPanel { get; private set; }
#region Overrides of ComponentBase
@@ -26,18 +25,6 @@ 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();
// var deferredContent = MessageBus.INSTANCE.CheckDeferredMessages<SettingsPanel>(Event.SWITCH_TO_SETTINGS_PANEL).FirstOrDefault();
//if (deferredContent != default)
//{
//switch (deferredContent)
//{
// case SettingsPanel -am besten nicht alle individuell
//}
//}
//chosenSettingsPanel = deferredContent;
await base.OnInitializedAsync();
}