diff --git a/app/MindWork AI Studio/Components/ConfigurationBase.razor b/app/MindWork AI Studio/Components/ConfigurationBase.razor
index 2233093a..e69d8059 100644
--- a/app/MindWork AI Studio/Components/ConfigurationBase.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationBase.razor
@@ -1 +1,15 @@
-@inherits MSGComponentBase
\ No newline at end of file
+@inherits MSGComponentBase
+
+@if (this.Body is not null)
+{
+ @if (!this.Disabled() && this.IsLocked())
+ {
+
+ @this.Body
+
+ }
+ else
+ {
+ @this.Body
+ }
+}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs b/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs
index 46299c09..1f3bc28c 100644
--- a/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs
@@ -27,10 +27,14 @@ public partial class ConfigurationBase : MSGComponentBase
public Func Disabled { get; set; } = () => false;
///
- /// Is the option disabled by a plugin?
+ /// Is the option locked by a configuration plugin?
///
[Parameter]
- public Func LockedByPlugin { get; set; } = () => false;
+ public Func IsLocked { get; set; } = () => false;
+
+ protected bool IsDisabled => this.Disabled() || this.IsLocked();
+
+ private protected virtual RenderFragment? Body => null;
protected const string MARGIN_CLASS = "mb-6";
protected static readonly Dictionary SPELLCHECK_ATTRIBUTES = new();
@@ -45,7 +49,9 @@ public partial class ConfigurationBase : MSGComponentBase
}
#endregion
-
+
+ private string TB(string fallbackEN) => this.T(fallbackEN, typeof(ConfigurationBase).Namespace, nameof(ConfigurationBase));
+
protected async Task InformAboutChange() => await this.MessageBus.SendMessage(this, Event.CONFIGURATION_CHANGED);
#region Overrides of MSGComponentBase
diff --git a/app/MindWork AI Studio/Components/ConfigurationBaseCore.cs b/app/MindWork AI Studio/Components/ConfigurationBaseCore.cs
new file mode 100644
index 00000000..8fe80f6c
--- /dev/null
+++ b/app/MindWork AI Studio/Components/ConfigurationBaseCore.cs
@@ -0,0 +1,15 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Rendering;
+
+namespace AIStudio.Components;
+
+public abstract class ConfigurationBaseCore : ConfigurationBase
+{
+ private protected sealed override RenderFragment Body => this.BuildRenderTree;
+
+ // Allow content to be provided by a .razor file but without
+ // overriding the content of the base class
+ protected new virtual void BuildRenderTree(RenderTreeBuilder builder)
+ {
+ }
+}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor b/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor
index c3f21593..b3eacda2 100644
--- a/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor
@@ -1,3 +1,3 @@
@using AIStudio.Settings
-@inherits MSGComponentBase
-
\ No newline at end of file
+@inherits ConfigurationBaseCore
+
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor.cs b/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor.cs
index 858bbc01..0cff7228 100644
--- a/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
-public partial class ConfigurationMinConfidenceSelection : MSGComponentBase
+public partial class ConfigurationMinConfidenceSelection : ConfigurationBaseCore
{
///
/// The selected value.
@@ -18,12 +18,6 @@ public partial class ConfigurationMinConfidenceSelection : MSGComponentBase
[Parameter]
public Action SelectionUpdate { get; set; } = _ => { };
- ///
- /// Is the selection component disabled?
- ///
- [Parameter]
- public Func Disabled { get; set; } = () => false;
-
///
/// Boolean value indicating whether the selection is restricted to a global minimum confidence level.
///
diff --git a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor
index 9c974e02..1c4c3e0c 100644
--- a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor
@@ -1,4 +1,4 @@
-@inherits ConfigurationBase
+@inherits ConfigurationBaseCore
@typeparam TData
/// The type of the value to select.
-public partial class ConfigurationMultiSelect : ConfigurationBase
+public partial class ConfigurationMultiSelect : ConfigurationBaseCore
{
///
/// The data to select from.
diff --git a/app/MindWork AI Studio/Components/ConfigurationOption.razor b/app/MindWork AI Studio/Components/ConfigurationOption.razor
index 73ffe235..ea5bfafd 100644
--- a/app/MindWork AI Studio/Components/ConfigurationOption.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationOption.razor
@@ -1,6 +1,6 @@
-@inherits ConfigurationBase
+@inherits ConfigurationBaseCore
-
+
@(this.State() ? this.LabelOn : this.LabelOff)
diff --git a/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs b/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs
index b3bed551..081d72db 100644
--- a/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs
@@ -5,7 +5,7 @@ namespace AIStudio.Components;
///
/// Configuration component for any boolean option.
///
-public partial class ConfigurationOption : ConfigurationBase
+public partial class ConfigurationOption : ConfigurationBaseCore
{
///
/// Text to display when the option is true.
diff --git a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor
index 4653822f..6118201f 100644
--- a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor
@@ -1,2 +1,2 @@
-@inherits MSGComponentBase
-
\ No newline at end of file
+@inherits ConfigurationBaseCore
+
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor.cs b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor.cs
index 28298f75..8c392b18 100644
--- a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
-public partial class ConfigurationProviderSelection : MSGComponentBase
+public partial class ConfigurationProviderSelection : ConfigurationBaseCore
{
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ConfigurationProviderSelection).Namespace, nameof(ConfigurationProviderSelection));
@@ -20,27 +20,11 @@ public partial class ConfigurationProviderSelection : MSGComponentBase
[Parameter]
public IEnumerable> Data { get; set; } = new List>();
- ///
- /// Is the selection component disabled?
- ///
- [Parameter]
- public Func Disabled { get; set; } = () => false;
-
[Parameter]
public Func HelpText { get; set; } = () => TB("Select a provider that is preselected.");
[Parameter]
public Tools.Components Component { get; set; } = Tools.Components.NONE;
-
- #region Overrides of ComponentBase
-
- protected override async Task OnParametersSetAsync()
- {
- this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]);
- await base.OnParametersSetAsync();
- }
-
- #endregion
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
private IEnumerable> FilteredData()
diff --git a/app/MindWork AI Studio/Components/ConfigurationSelect.razor b/app/MindWork AI Studio/Components/ConfigurationSelect.razor
index 3cca9700..a679752d 100644
--- a/app/MindWork AI Studio/Components/ConfigurationSelect.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationSelect.razor
@@ -1,13 +1,11 @@
-@inherits ConfigurationBase
-@typeparam T
+@inherits ConfigurationBaseCore
+@typeparam TConfig
-
-
- @foreach (var data in this.Data)
- {
-
- @data.Name
-
- }
-
-
+
+ @foreach (var data in this.Data)
+ {
+
+ @data.Name
+
+ }
+
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs b/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs
index 8fb876c4..47ab55bc 100644
--- a/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs
@@ -7,28 +7,28 @@ namespace AIStudio.Components;
///
/// Configuration component for selecting a value from a list.
///
-/// The type of the value to select.
-public partial class ConfigurationSelect : ConfigurationBase
+/// The type of the value to select.
+public partial class ConfigurationSelect : ConfigurationBaseCore
{
///
/// The data to select from.
///
[Parameter]
- public IEnumerable> Data { get; set; } = [];
+ public IEnumerable> Data { get; set; } = [];
///
/// The selected value.
///
[Parameter]
- public Func SelectedValue { get; set; } = () => default!;
+ public Func SelectedValue { get; set; } = () => default!;
///
/// An action that is called when the selection changes.
///
[Parameter]
- public Action SelectionUpdate { get; set; } = _ => { };
+ public Action SelectionUpdate { get; set; } = _ => { };
- private async Task OptionChanged(T updatedValue)
+ private async Task OptionChanged(TConfig updatedValue)
{
this.SelectionUpdate(updatedValue);
await this.SettingsManager.StoreSettings();
diff --git a/app/MindWork AI Studio/Components/ConfigurationSlider.razor b/app/MindWork AI Studio/Components/ConfigurationSlider.razor
index b42f4a4d..eded0922 100644
--- a/app/MindWork AI Studio/Components/ConfigurationSlider.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationSlider.razor
@@ -1,8 +1,8 @@
@typeparam T
-@inherits ConfigurationBase
+@inherits ConfigurationBaseCore
-
-
+
+
@this.Value() @this.Unit
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs b/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs
index 7d91cb8b..750182fe 100644
--- a/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs
+++ b/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
-public partial class ConfigurationSlider : ConfigurationBase where T : struct, INumber
+public partial class ConfigurationSlider : ConfigurationBaseCore where T : struct, INumber
{
///
/// The minimum value for the slider.
diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor b/app/MindWork AI Studio/Components/ConfigurationText.razor
index a3cc3233..b835cd77 100644
--- a/app/MindWork AI Studio/Components/ConfigurationText.razor
+++ b/app/MindWork AI Studio/Components/ConfigurationText.razor
@@ -1,11 +1,11 @@
-@inherits ConfigurationBase
+@inherits ConfigurationBaseCore
/// The text used for the textfield.
diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
index 42f2d12e..e220d41d 100644
--- a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
+++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor
@@ -13,7 +13,7 @@
-
+