From 9c32595d72cd305ce5ff220ea97a4fb913bf992f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peer=20Sch=C3=BCtt?= <20603780+peerschuett@users.noreply.github.com> Date: Fri, 11 Jul 2025 16:05:03 +0200 Subject: [PATCH 01/10] Adding Providers can now be disabled in the plugin --- .../Components/Settings/SettingsPanelProviders.razor | 2 +- app/MindWork AI Studio/Plugins/configuration/plugin.lua | 6 +++++- app/MindWork AI Studio/Settings/DataModel/DataApp.cs | 6 +++++- .../Tools/PluginSystem/PluginConfiguration.cs | 6 ++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor index 1389425a..608f72c0 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor @@ -75,7 +75,7 @@ } - + @T("Add Provider") diff --git a/app/MindWork AI Studio/Plugins/configuration/plugin.lua b/app/MindWork AI Studio/Plugins/configuration/plugin.lua index d80fc0d9..f6c670c0 100644 --- a/app/MindWork AI Studio/Plugins/configuration/plugin.lua +++ b/app/MindWork AI Studio/Plugins/configuration/plugin.lua @@ -64,4 +64,8 @@ CONFIG["SETTINGS"] = {} -- Configure the update behavior: -- Allowed values are: NO_CHECK, ONCE_STARTUP, HOURLY, DAILY, WEEKLY --- CONFIG["SETTINGS"]["DataApp.UpdateBehavior"] = "NO_CHECK" \ No newline at end of file +-- CONFIG["SETTINGS"]["DataApp.UpdateBehavior"] = "NO_CHECK" + +-- Configure the user permission to add providers: +-- Allowed values are: true, false +-- CONFIG["SETTINGS"]["DataApp.DontAllowUserToAddProvider"] = false \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs index e189cbbd..8570c3c4 100644 --- a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs +++ b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs @@ -58,9 +58,13 @@ public sealed class DataApp /// public string PreselectedProfile { get; set; } = string.Empty; - /// /// Should we preselect a chat template for the entire app? /// public string PreselectedChatTemplate { get; set; } = string.Empty; + + /// + /// Should the user be allowed to add providers? + /// + public bool DontAllowUserToAddProvider { get; set; } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs index 6355fad1..f5dbf542 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs @@ -53,6 +53,12 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT SETTINGS_LOCKER.Register(x => x.UpdateBehavior, this.Id); SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior; } + + if (settingsTable.TryGetValue(SettingsManager.ToSettingName(x => x.DontAllowUserToAddProvider), out var dontAllowUserToAddProviderValue) && dontAllowUserToAddProviderValue.TryRead(out var dontAllowUserToAddProviderEntry)) + { + SETTINGS_LOCKER.Register(x => x.DontAllowUserToAddProvider, this.Id); + SETTINGS_MANAGER.ConfigurationData.App.DontAllowUserToAddProvider = dontAllowUserToAddProviderEntry; + } // // Configured providers From a1c931d46a5c9de0181164ffee175cd22173ddb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peer=20Sch=C3=BCtt?= <20603780+peerschuett@users.noreply.github.com> Date: Fri, 11 Jul 2025 16:40:11 +0200 Subject: [PATCH 02/10] It works, but the formatting is wrong in the app settings window --- .../Components/ConfigurationBase.razor.cs | 6 ++++++ .../Components/ConfigurationSelect.razor | 18 ++++++++++-------- .../Components/Settings/SettingsPanelApp.razor | 2 +- .../Settings/SettingsPanelProviders.razor | 10 ++++++---- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs b/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs index 10f4ae3f..46299c09 100644 --- a/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs @@ -26,6 +26,12 @@ public partial class ConfigurationBase : MSGComponentBase [Parameter] public Func Disabled { get; set; } = () => false; + /// + /// Is the option disabled by a plugin? + /// + [Parameter] + public Func LockedByPlugin { get; set; } = () => false; + protected const string MARGIN_CLASS = "mb-6"; protected static readonly Dictionary SPELLCHECK_ATTRIBUTES = new(); diff --git a/app/MindWork AI Studio/Components/ConfigurationSelect.razor b/app/MindWork AI Studio/Components/ConfigurationSelect.razor index 99120aa9..3cca9700 100644 --- a/app/MindWork AI Studio/Components/ConfigurationSelect.razor +++ b/app/MindWork AI Studio/Components/ConfigurationSelect.razor @@ -1,11 +1,13 @@ @inherits ConfigurationBase @typeparam T - - @foreach (var data in this.Data) - { - - @data.Name - - } - \ No newline at end of file + + + @foreach (var data in this.Data) + { + + @data.Name + + } + + diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor index 1ad60ba2..42f2d12e 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelApp.razor @@ -13,7 +13,7 @@ - + diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor index 608f72c0..fe10c74e 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor @@ -74,10 +74,12 @@ @T("No providers configured yet.") } - - - @T("Add Provider") - + + + + @T("Add Provider") + + @T("LLM Provider Confidence") From 0147515c986c1af353e58a753c1012667dbfa631 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:25:56 +0200 Subject: [PATCH 03/10] Renamed `DontAllowUserToAddProvider` to `AllowUserToAddProvider` --- app/MindWork AI Studio/Plugins/configuration/plugin.lua | 2 +- app/MindWork AI Studio/Settings/DataModel/DataApp.cs | 2 +- .../Tools/PluginSystem/PluginConfiguration.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/MindWork AI Studio/Plugins/configuration/plugin.lua b/app/MindWork AI Studio/Plugins/configuration/plugin.lua index f6c670c0..b81e8686 100644 --- a/app/MindWork AI Studio/Plugins/configuration/plugin.lua +++ b/app/MindWork AI Studio/Plugins/configuration/plugin.lua @@ -68,4 +68,4 @@ CONFIG["SETTINGS"] = {} -- Configure the user permission to add providers: -- Allowed values are: true, false --- CONFIG["SETTINGS"]["DataApp.DontAllowUserToAddProvider"] = false \ No newline at end of file +-- CONFIG["SETTINGS"]["DataApp.AllowUserToAddProvider"] = false \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs index 8570c3c4..022cd8c8 100644 --- a/app/MindWork AI Studio/Settings/DataModel/DataApp.cs +++ b/app/MindWork AI Studio/Settings/DataModel/DataApp.cs @@ -66,5 +66,5 @@ public sealed class DataApp /// /// Should the user be allowed to add providers? /// - public bool DontAllowUserToAddProvider { get; set; } + public bool AllowUserToAddProvider { get; set; } = true; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs index f5dbf542..1988e8de 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginConfiguration.cs @@ -54,10 +54,10 @@ public sealed class PluginConfiguration(bool isInternal, LuaState state, PluginT SETTINGS_MANAGER.ConfigurationData.App.UpdateBehavior = updateBehavior; } - if (settingsTable.TryGetValue(SettingsManager.ToSettingName(x => x.DontAllowUserToAddProvider), out var dontAllowUserToAddProviderValue) && dontAllowUserToAddProviderValue.TryRead(out var dontAllowUserToAddProviderEntry)) + if (settingsTable.TryGetValue(SettingsManager.ToSettingName(x => x.AllowUserToAddProvider), out var dontAllowUserToAddProviderValue) && dontAllowUserToAddProviderValue.TryRead(out var dontAllowUserToAddProviderEntry)) { - SETTINGS_LOCKER.Register(x => x.DontAllowUserToAddProvider, this.Id); - SETTINGS_MANAGER.ConfigurationData.App.DontAllowUserToAddProvider = dontAllowUserToAddProviderEntry; + SETTINGS_LOCKER.Register(x => x.AllowUserToAddProvider, this.Id); + SETTINGS_MANAGER.ConfigurationData.App.AllowUserToAddProvider = dontAllowUserToAddProviderEntry; } // From 20f3a90449fecdf46e517197c25c692178986ff4 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:29:59 +0200 Subject: [PATCH 04/10] Refactor configuration components to use ConfigurationBaseCore for improved locking functionality --- .../Components/ConfigurationBase.razor | 16 +++++++++++++- .../Components/ConfigurationBase.razor.cs | 12 +++++++--- .../Components/ConfigurationBaseCore.cs | 15 +++++++++++++ .../ConfigurationMinConfidenceSelection.razor | 4 ++-- ...nfigurationMinConfidenceSelection.razor.cs | 8 +------ .../Components/ConfigurationMultiSelect.razor | 4 ++-- .../ConfigurationMultiSelect.razor.cs | 2 +- .../Components/ConfigurationOption.razor | 4 ++-- .../Components/ConfigurationOption.razor.cs | 2 +- .../ConfigurationProviderSelection.razor | 4 ++-- .../ConfigurationProviderSelection.razor.cs | 18 +-------------- .../Components/ConfigurationSelect.razor | 22 +++++++++---------- .../Components/ConfigurationSelect.razor.cs | 12 +++++----- .../Components/ConfigurationSlider.razor | 6 ++--- .../Components/ConfigurationSlider.razor.cs | 2 +- .../Components/ConfigurationText.razor | 4 ++-- .../Components/ConfigurationText.razor.cs | 2 +- .../Settings/SettingsPanelApp.razor | 2 +- 18 files changed, 75 insertions(+), 64 deletions(-) create mode 100644 app/MindWork AI Studio/Components/ConfigurationBaseCore.cs 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 @@ - + From 9408ac4a366639a71f02baed413fbaaaadc59844 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:30:44 +0200 Subject: [PATCH 05/10] Applied optimizations --- app/MindWork AI Studio/Assistants/AssistantBase.razor | 2 +- .../Components/ConfigurationText.razor.cs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor b/app/MindWork AI Studio/Assistants/AssistantBase.razor index bc4d01df..e9b3c033 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor @@ -6,7 +6,7 @@ - @(this.Title) + @this.Title diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs index 03ffe897..686ea782 100644 --- a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs @@ -43,7 +43,7 @@ public partial class ConfigurationText : ConfigurationBaseCore public int MaxLines { get; set; } = 12; private string internalText = string.Empty; - private Timer timer = new(TimeSpan.FromMilliseconds(500)) + private readonly Timer timer = new(TimeSpan.FromMilliseconds(500)) { AutoReset = false }; @@ -56,8 +56,6 @@ public partial class ConfigurationText : ConfigurationBaseCore await base.OnInitializedAsync(); } - #region Overrides of ComponentBase - protected override async Task OnParametersSetAsync() { this.internalText = this.Text(); @@ -66,8 +64,6 @@ public partial class ConfigurationText : ConfigurationBaseCore #endregion - #endregion - private bool AutoGrow => this.NumLines > 1; private int GetMaxLines => this.AutoGrow ? this.MaxLines : 1; From 3c8cef25013f9d475f29c2dd8b00225bf9440e6b Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:31:01 +0200 Subject: [PATCH 06/10] Made `OnClick` handlers asynchronous in `AssistantBase.razor` --- .../Assistants/AssistantBase.razor | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor b/app/MindWork AI Studio/Assistants/AssistantBase.razor index e9b3c033..92ae6bff 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor @@ -9,7 +9,7 @@ @this.Title - + @@ -26,13 +26,13 @@ - + @this.SubmitText @if (this.isProcessing && this.cancellationTokenSource is not null) { - + } @@ -80,7 +80,7 @@ @foreach (var assistant in Enum.GetValues().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length)) { - + @assistant.Name() } @@ -94,14 +94,14 @@ { case ButtonData buttonData when !string.IsNullOrWhiteSpace(buttonData.Tooltip): - + @buttonData.Text break; case ButtonData buttonData: - + @buttonData.Text break; @@ -110,7 +110,7 @@ @foreach (var assistant in Enum.GetValues().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length)) { - + @assistant.Name() } @@ -121,14 +121,14 @@ @if (this.ShowCopyResult) { - + @TB("Copy result") } @if (this.ShowReset) { - + @TB("Reset") } From 5d197024b5197b2cacbe4a5d7f26427ff4ccf42f Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:31:41 +0200 Subject: [PATCH 07/10] Added a lockable button component --- .../Components/LockableButton.razor | 5 ++++ .../Components/LockableButton.razor.cs | 27 +++++++++++++++++++ .../Settings/SettingsPanelProviders.razor | 6 +---- 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 app/MindWork AI Studio/Components/LockableButton.razor create mode 100644 app/MindWork AI Studio/Components/LockableButton.razor.cs diff --git a/app/MindWork AI Studio/Components/LockableButton.razor b/app/MindWork AI Studio/Components/LockableButton.razor new file mode 100644 index 00000000..81f964cc --- /dev/null +++ b/app/MindWork AI Studio/Components/LockableButton.razor @@ -0,0 +1,5 @@ +@inherits ConfigurationBaseCore + + + @this.Text + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/LockableButton.razor.cs b/app/MindWork AI Studio/Components/LockableButton.razor.cs new file mode 100644 index 00000000..fe3c0f45 --- /dev/null +++ b/app/MindWork AI Studio/Components/LockableButton.razor.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Components; + +public partial class LockableButton : ConfigurationBaseCore +{ + [Parameter] + public string Icon { get; set; } = Icons.Material.Filled.Info; + + [Parameter] + public Func OnClickAsync { get; set; } = () => Task.CompletedTask; + + [Parameter] + public Action OnClick { get; set; } = () => { }; + + [Parameter] + public string Text { get; set; } = string.Empty; + + private async Task ClickAsync() + { + if (this.IsLocked() || this.Disabled()) + return; + + await this.OnClickAsync(); + this.OnClick(); + } +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor index fe10c74e..8a8c1de9 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor @@ -75,11 +75,7 @@ } - - - @T("Add Provider") - - + @T("LLM Provider Confidence") From 8a71d2f1547f7808bbfea1b020a46118478870cd Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:32:08 +0200 Subject: [PATCH 08/10] Added I18N --- app/MindWork AI Studio/Assistants/I18N/allTexts.lua | 3 +++ .../de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua | 3 +++ .../en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 83ed2620..942a744f 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -1450,6 +1450,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T3243388657"] = "Confiden -- Shows and hides the confidence card with information about the selected LLM provider. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T847071819"] = "Shows and hides the confidence card with information about the selected LLM provider." +-- This feature is managed by your organization and has therefore been disabled. +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONBASE::T1416426626"] = "This feature is managed by your organization and has therefore been disabled." + -- Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONMINCONFIDENCESELECTION::T2526727283"] = "Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level." diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index 13dc2f12..042978b0 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -1452,6 +1452,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T3243388657"] = "Vertraue -- Shows and hides the confidence card with information about the selected LLM provider. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T847071819"] = "Zeigt oder verbirgt die Vertrauenskarte mit Informationen über den ausgewählten LLM-Anbieter." +-- This feature is managed by your organization and has therefore been disabled. +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONBASE::T1416426626"] = "Diese Funktion wird von Ihrer Organisation verwaltet und wurde daher deaktiviert." + -- Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONMINCONFIDENCESELECTION::T2526727283"] = "Wählen Sie das minimale Vertrauensniveau, das alle LLM-Anbieter erfüllen müssen. So stellen Sie sicher, dass nur vertrauenswürdige Anbieter verwendet werden. Anbieter, die dieses Niveau unterschreiten, können nicht verwendet werden." diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 99371d03..45aa0caa 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -1452,6 +1452,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T3243388657"] = "Confiden -- Shows and hides the confidence card with information about the selected LLM provider. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIDENCEINFO::T847071819"] = "Shows and hides the confidence card with information about the selected LLM provider." +-- This feature is managed by your organization and has therefore been disabled. +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONBASE::T1416426626"] = "This feature is managed by your organization and has therefore been disabled." + -- Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CONFIGURATIONMINCONFIDENCESELECTION::T2526727283"] = "Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level." From 74449e40dd6b4a65d60acd643af263d37bb34d97 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 11 Jul 2025 22:35:52 +0200 Subject: [PATCH 09/10] Updated changelog --- app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md index cf1aee39..61964810 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md @@ -1,3 +1,4 @@ # v0.9.50, build 225 (2025-07-xx xx:xx UTC) - Added an option for chat templates to predefine a user input. -- Added the ability to create chat templates from existing chats. \ No newline at end of file +- Added the ability to create chat templates from existing chats. +- Added an enterprise IT configuration option to prevent manual addition of LLM providers in managed environments. \ No newline at end of file From e82d1e473f0afe09da12fbbb01351a38128b0311 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 22 Jul 2025 07:55:15 +0200 Subject: [PATCH 10/10] Refactored configuration components to improve extensibility and uniformity --- .../Components/ConfigurationBase.razor | 16 +++++++--- .../Components/ConfigurationBase.razor.cs | 31 +++++++++++++++++-- .../ConfigurationMinConfidenceSelection.razor | 4 +-- ...nfigurationMinConfidenceSelection.razor.cs | 8 ++++- .../Components/ConfigurationMultiSelect.razor | 6 ++-- .../ConfigurationMultiSelect.razor.cs | 13 ++++++-- .../Components/ConfigurationOption.razor | 8 ++--- .../Components/ConfigurationOption.razor.cs | 13 ++++++++ .../ConfigurationProviderSelection.razor | 4 +-- .../ConfigurationProviderSelection.razor.cs | 8 ++++- .../Components/ConfigurationSelect.razor | 2 +- .../Components/ConfigurationSelect.razor.cs | 14 +++++++-- .../Components/ConfigurationSlider.razor | 8 ++--- .../Components/ConfigurationSlider.razor.cs | 12 +++++++ .../Components/ConfigurationText.razor | 4 +-- .../Components/ConfigurationText.razor.cs | 11 +++++++ .../Components/LockableButton.razor | 2 +- .../Components/LockableButton.razor.cs | 12 +++++++ .../Settings/SettingsPanelProviders.razor | 2 +- 19 files changed, 141 insertions(+), 37 deletions(-) diff --git a/app/MindWork AI Studio/Components/ConfigurationBase.razor b/app/MindWork AI Studio/Components/ConfigurationBase.razor index e69d8059..875a08c7 100644 --- a/app/MindWork AI Studio/Components/ConfigurationBase.razor +++ b/app/MindWork AI Studio/Components/ConfigurationBase.razor @@ -4,12 +4,20 @@ { @if (!this.Disabled() && this.IsLocked()) { - - @this.Body - + + + @* MudTooltip.RootStyle is set as a workaround for issue -> https://github.com/MudBlazor/MudBlazor/issues/10882 *@ + + + + @this.Body + + } else { - @this.Body + + @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 1f3bc28c..59ef82b2 100644 --- a/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationBase.razor.cs @@ -5,7 +5,7 @@ namespace AIStudio.Components; /// /// A base class for configuration options. /// -public partial class ConfigurationBase : MSGComponentBase +public abstract partial class ConfigurationBase : MSGComponentBase { /// /// The description of the option, i.e., the name. Should be @@ -31,12 +31,37 @@ public partial class ConfigurationBase : MSGComponentBase /// [Parameter] public Func IsLocked { get; set; } = () => false; + + /// + /// Should the option be stretched to fill the available space? + /// + protected abstract bool Stretch { get; } + + /// + /// The CSS class to apply to the component. + /// + protected virtual string GetClassForBase => string.Empty; + + /// + /// The visual variant of the option. + /// + protected virtual Variant Variant => Variant.Text; + + /// + /// The label to display for the option. + /// + protected virtual string Label => string.Empty; + + private StretchItems StretchItems => this.Stretch ? StretchItems.End : StretchItems.None; protected bool IsDisabled => this.Disabled() || this.IsLocked(); - private protected virtual RenderFragment? Body => null; + private string Classes => $"{this.GetClassForBase} {MARGIN_CLASS}"; + + private protected virtual RenderFragment? Body => null; + + private const string MARGIN_CLASS = "mb-6"; - protected const string MARGIN_CLASS = "mb-6"; protected static readonly Dictionary SPELLCHECK_ATTRIBUTES = new(); #region Overrides of ComponentBase diff --git a/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor b/app/MindWork AI Studio/Components/ConfigurationMinConfidenceSelection.razor index b3eacda2..93a47e8b 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 ConfigurationBaseCore - \ No newline at end of file +@inherits MSGComponentBase + \ 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 0cff7228..b5d130c8 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 : ConfigurationBaseCore +public partial class ConfigurationMinConfidenceSelection : MSGComponentBase { /// /// The selected value. @@ -23,6 +23,12 @@ public partial class ConfigurationMinConfidenceSelection : ConfigurationBaseCore /// [Parameter] public bool RestrictToGlobalMinimumConfidence { get; set; } + + [Parameter] + public Func Disabled { get; set; } = () => false; + + [Parameter] + public Func IsLocked { get; set; } = () => false; private ConfidenceLevel FilteredSelectedValue() { diff --git a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor index 1c4c3e0c..6d9d7b89 100644 --- a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor +++ b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor @@ -9,10 +9,8 @@ Strict="@true" Disabled="@this.IsDisabled" Margin="Margin.Dense" - Label="@this.OptionDescription" - Class="@GetClass" - Variant="Variant.Outlined" - HelperText="@this.OptionHelp" + Class="rounded-lg" + Underline="false" SelectedValuesChanged="@this.OptionChanged"> @foreach (var data in this.Data) { diff --git a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor.cs b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor.cs index 5c9d31ff..f2e5ed51 100644 --- a/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationMultiSelect.razor.cs @@ -28,6 +28,17 @@ public partial class ConfigurationMultiSelect : ConfigurationBaseCore [Parameter] public Action> SelectionUpdate { get; set; } = _ => { }; + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => true; + + protected override Variant Variant => Variant.Outlined; + + protected override string Label => this.OptionDescription; + + #endregion + private async Task OptionChanged(IEnumerable? updatedValues) { if(updatedValues is null) @@ -39,8 +50,6 @@ public partial class ConfigurationMultiSelect : ConfigurationBaseCore await this.InformAboutChange(); } - private static string GetClass => $"{MARGIN_CLASS} rounded-lg"; - private string GetMultiSelectionText(List? selectedValues) { if(selectedValues is null || selectedValues.Count == 0) diff --git a/app/MindWork AI Studio/Components/ConfigurationOption.razor b/app/MindWork AI Studio/Components/ConfigurationOption.razor index ea5bfafd..a2ad673e 100644 --- a/app/MindWork AI Studio/Components/ConfigurationOption.razor +++ b/app/MindWork AI Studio/Components/ConfigurationOption.razor @@ -1,7 +1,5 @@ @inherits ConfigurationBaseCore - - - @(this.State() ? this.LabelOn : this.LabelOff) - - \ No newline at end of file + + @(this.State() ? this.LabelOn : this.LabelOff) + \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs b/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs index 081d72db..bbd0da1a 100644 --- a/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationOption.razor.cs @@ -31,6 +31,19 @@ public partial class ConfigurationOption : ConfigurationBaseCore [Parameter] public Action StateUpdate { get; set; } = _ => { }; + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => true; + + /// + protected override Variant Variant => Variant.Outlined; + + /// + protected override string Label => this.OptionDescription; + + #endregion + private async Task OptionChanged(bool updatedState) { this.StateUpdate(updatedState); diff --git a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor index 6118201f..be6a93cd 100644 --- a/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor +++ b/app/MindWork AI Studio/Components/ConfigurationProviderSelection.razor @@ -1,2 +1,2 @@ -@inherits ConfigurationBaseCore - \ No newline at end of file +@inherits MSGComponentBase + \ 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 8c392b18..8eced0f2 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 : ConfigurationBaseCore +public partial class ConfigurationProviderSelection : MSGComponentBase { private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ConfigurationProviderSelection).Namespace, nameof(ConfigurationProviderSelection)); @@ -26,6 +26,12 @@ public partial class ConfigurationProviderSelection : ConfigurationBaseCore [Parameter] public Tools.Components Component { get; set; } = Tools.Components.NONE; + [Parameter] + public Func Disabled { get; set; } = () => false; + + [Parameter] + public Func IsLocked { get; set; } = () => false; + [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 a679752d..c3459101 100644 --- a/app/MindWork AI Studio/Components/ConfigurationSelect.razor +++ b/app/MindWork AI Studio/Components/ConfigurationSelect.razor @@ -1,7 +1,7 @@ @inherits ConfigurationBaseCore @typeparam TConfig - + @foreach (var data in this.Data) { diff --git a/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs b/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs index 47ab55bc..14c73eea 100644 --- a/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationSelect.razor.cs @@ -28,12 +28,22 @@ public partial class ConfigurationSelect : ConfigurationBaseCore [Parameter] public Action SelectionUpdate { get; set; } = _ => { }; + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => true; + + /// + protected override string Label => this.OptionDescription; + + protected override Variant Variant => Variant.Outlined; + + #endregion + private async Task OptionChanged(TConfig updatedValue) { this.SelectionUpdate(updatedValue); await this.SettingsManager.StoreSettings(); await this.InformAboutChange(); } - - private static string GetClass => $"{MARGIN_CLASS} rounded-lg"; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigurationSlider.razor b/app/MindWork AI Studio/Components/ConfigurationSlider.razor index eded0922..b04b511d 100644 --- a/app/MindWork AI Studio/Components/ConfigurationSlider.razor +++ b/app/MindWork AI Studio/Components/ConfigurationSlider.razor @@ -1,8 +1,6 @@ @typeparam T @inherits ConfigurationBaseCore - - - @this.Value() @this.Unit - - \ No newline at end of file + + @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 750182fe..429119e1 100644 --- a/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationSlider.razor.cs @@ -42,6 +42,18 @@ public partial class ConfigurationSlider : ConfigurationBaseCore where T : st [Parameter] public Action ValueUpdate { get; set; } = _ => { }; + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => true; + + /// + protected override Variant Variant => Variant.Outlined; + + protected override string Label => this.OptionDescription; + + #endregion + #region Overrides of ComponentBase protected override async Task OnInitializedAsync() diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor b/app/MindWork AI Studio/Components/ConfigurationText.razor index b835cd77..80ec63ae 100644 --- a/app/MindWork AI Studio/Components/ConfigurationText.razor +++ b/app/MindWork AI Studio/Components/ConfigurationText.razor @@ -4,9 +4,7 @@ T="string" Text="@this.Text()" TextChanged="@this.InternalUpdate" - Label="@this.OptionDescription" Disabled="@this.IsDisabled" - Class="@MARGIN_CLASS" Adornment="Adornment.Start" AdornmentIcon="@this.Icon" AdornmentColor="@this.IconColor" @@ -15,5 +13,5 @@ AutoGrow="@this.AutoGrow" MaxLines="@this.GetMaxLines" Immediate="@true" - Variant="Variant.Outlined" + Underline="false" /> \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs index 686ea782..7bcce41e 100644 --- a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs @@ -47,6 +47,17 @@ public partial class ConfigurationText : ConfigurationBaseCore { AutoReset = false }; + + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => true; + + protected override Variant Variant => Variant.Outlined; + + protected override string Label => this.OptionDescription; + + #endregion #region Overrides of ConfigurationBase diff --git a/app/MindWork AI Studio/Components/LockableButton.razor b/app/MindWork AI Studio/Components/LockableButton.razor index 81f964cc..825c5a62 100644 --- a/app/MindWork AI Studio/Components/LockableButton.razor +++ b/app/MindWork AI Studio/Components/LockableButton.razor @@ -1,5 +1,5 @@ @inherits ConfigurationBaseCore - + @this.Text \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/LockableButton.razor.cs b/app/MindWork AI Studio/Components/LockableButton.razor.cs index fe3c0f45..cbfbd910 100644 --- a/app/MindWork AI Studio/Components/LockableButton.razor.cs +++ b/app/MindWork AI Studio/Components/LockableButton.razor.cs @@ -16,6 +16,18 @@ public partial class LockableButton : ConfigurationBaseCore [Parameter] public string Text { get; set; } = string.Empty; + [Parameter] + public string Class { get; set; } = string.Empty; + + #region Overrides of ConfigurationBase + + /// + protected override bool Stretch => false; + + protected override string GetClassForBase => this.Class; + + #endregion + private async Task ClickAsync() { if (this.IsLocked() || this.Disabled()) diff --git a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor index 8a8c1de9..616149d0 100644 --- a/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor +++ b/app/MindWork AI Studio/Components/Settings/SettingsPanelProviders.razor @@ -75,7 +75,7 @@ } - + @T("LLM Provider Confidence")