From 8cf138ccacb55e0cd06c46eb006b830466338394 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 11 Aug 2026 13:43:47 +0200 Subject: [PATCH] Added settings pattern reset --- .../Assistants/I18N/allTexts.lua | 3 + .../Components/ConfigurationText.razor | 57 ++++++++++++++----- .../Components/ConfigurationText.razor.cs | 22 +++++++ .../SettingsDialogBatchProcessing.razor | 3 +- 4 files changed, 69 insertions(+), 16 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 6cadf0c1..9944939c 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -6571,6 +6571,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T62 -- Default source of the instructions UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T704081768"] = "Default source of the instructions" +-- Restore default patterns +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T7425959"] = "Restore default patterns" + -- Leave empty when an input folder should be selected for every batch run. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T762890100"] = "Leave empty when an input folder should be selected for every batch run." diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor b/app/MindWork AI Studio/Components/ConfigurationText.razor index 80ec63ae..a5d52346 100644 --- a/app/MindWork AI Studio/Components/ConfigurationText.razor +++ b/app/MindWork AI Studio/Components/ConfigurationText.razor @@ -1,17 +1,44 @@ @inherits ConfigurationBaseCore - \ No newline at end of file +@if (this.ResetValue is null) +{ + +} +else +{ + + + + @this.ResetButtonText + + +} diff --git a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs index 5074fa73..a1b1f393 100644 --- a/app/MindWork AI Studio/Components/ConfigurationText.razor.cs +++ b/app/MindWork AI Studio/Components/ConfigurationText.razor.cs @@ -41,6 +41,18 @@ public partial class ConfigurationText : ConfigurationBaseCore /// [Parameter] public int MaxLines { get; set; } = 12; + + /// + /// When configured, displays a button which restores this value. + /// + [Parameter] + public Func? ResetValue { get; set; } + + /// + /// The text displayed on the optional reset button. + /// + [Parameter] + public string ResetButtonText { get; set; } = string.Empty; private string internalText = string.Empty; private readonly Timer timer = new(TimeSpan.FromMilliseconds(500)) @@ -85,6 +97,16 @@ public partial class ConfigurationText : ConfigurationBaseCore this.internalText = text; this.timer.Start(); } + + private async Task ResetTextAsync() + { + if (this.ResetValue is null || this.IsDisabled) + return; + + this.timer.Stop(); + this.internalText = this.ResetValue(); + await this.OptionChanged(this.internalText); + } private async Task OptionChanged(string updatedText) { diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBatchProcessing.razor b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBatchProcessing.razor index af9423b7..8da310ed 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBatchProcessing.razor +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBatchProcessing.razor @@ -1,5 +1,6 @@ @using AIStudio.Assistants.BatchProcessing @using AIStudio.Settings +@using AIStudio.Settings.DataModel @using AIStudio.Tools.Rust @inherits SettingsDialogBase @@ -16,7 +17,7 @@ @T("Input") - + @T("Instructions")