mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 18:32:12 +00:00
Added settings pattern reset
This commit is contained in:
parent
75aeb784d2
commit
8cf138ccac
@ -6571,6 +6571,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T62
|
|||||||
-- Default source of the instructions
|
-- Default source of the instructions
|
||||||
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T704081768"] = "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.
|
-- 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."
|
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::SETTINGS::SETTINGSDIALOGBATCHPROCESSING::T762890100"] = "Leave empty when an input folder should be selected for every batch run."
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
@inherits ConfigurationBaseCore
|
@inherits ConfigurationBaseCore
|
||||||
|
|
||||||
|
@if (this.ResetValue is null)
|
||||||
|
{
|
||||||
<MudTextField
|
<MudTextField
|
||||||
T="string"
|
T="string"
|
||||||
Text="@this.Text()"
|
Text="@this.Text()"
|
||||||
@ -15,3 +17,28 @@
|
|||||||
Immediate="@true"
|
Immediate="@true"
|
||||||
Underline="false"
|
Underline="false"
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||||
|
<MudTextField
|
||||||
|
T="string"
|
||||||
|
Text="@this.Text()"
|
||||||
|
TextChanged="@this.InternalUpdate"
|
||||||
|
Disabled="@this.IsDisabled"
|
||||||
|
Adornment="Adornment.Start"
|
||||||
|
AdornmentIcon="@this.Icon"
|
||||||
|
AdornmentColor="@this.IconColor"
|
||||||
|
UserAttributes="@SPELLCHECK_ATTRIBUTES"
|
||||||
|
Lines="@this.NumLines"
|
||||||
|
AutoGrow="@this.AutoGrow"
|
||||||
|
MaxLines="@this.GetMaxLines"
|
||||||
|
Immediate="@true"
|
||||||
|
Underline="false"
|
||||||
|
Class="flex-grow-1"
|
||||||
|
/>
|
||||||
|
<MudButton Variant="Variant.Outlined" StartIcon="@Icons.Material.Filled.Restore" Disabled="@this.IsDisabled" OnClick="@this.ResetTextAsync" Class="mb-1">
|
||||||
|
@this.ResetButtonText
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
|||||||
@ -42,6 +42,18 @@ public partial class ConfigurationText : ConfigurationBaseCore
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public int MaxLines { get; set; } = 12;
|
public int MaxLines { get; set; } = 12;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When configured, displays a button which restores this value.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public Func<string>? ResetValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The text displayed on the optional reset button.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public string ResetButtonText { get; set; } = string.Empty;
|
||||||
|
|
||||||
private string internalText = string.Empty;
|
private string internalText = string.Empty;
|
||||||
private readonly Timer timer = new(TimeSpan.FromMilliseconds(500))
|
private readonly Timer timer = new(TimeSpan.FromMilliseconds(500))
|
||||||
{
|
{
|
||||||
@ -86,6 +98,16 @@ public partial class ConfigurationText : ConfigurationBaseCore
|
|||||||
this.timer.Start();
|
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)
|
private async Task OptionChanged(string updatedText)
|
||||||
{
|
{
|
||||||
this.TextUpdate(updatedText);
|
this.TextUpdate(updatedText);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
@using AIStudio.Assistants.BatchProcessing
|
@using AIStudio.Assistants.BatchProcessing
|
||||||
@using AIStudio.Settings
|
@using AIStudio.Settings
|
||||||
|
@using AIStudio.Settings.DataModel
|
||||||
@using AIStudio.Tools.Rust
|
@using AIStudio.Tools.Rust
|
||||||
@inherits SettingsDialogBase
|
@inherits SettingsDialogBase
|
||||||
|
|
||||||
@ -16,7 +17,7 @@
|
|||||||
|
|
||||||
<MudText Typo="Typo.h6" Class="mb-3">@T("Input")</MudText>
|
<MudText Typo="Typo.h6" Class="mb-3">@T("Input")</MudText>
|
||||||
<ConfigurationText OptionDescription="@T("Default input folder")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.Folder" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.InputDirectory)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.InputDirectory = value)" OptionHelp="@T("Leave empty when an input folder should be selected for every batch run.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.InputDirectory, out var meta) && meta.IsLocked"/>
|
<ConfigurationText OptionDescription="@T("Default input folder")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.Folder" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.InputDirectory)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.InputDirectory = value)" OptionHelp="@T("Leave empty when an input folder should be selected for every batch run.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.InputDirectory, out var meta) && meta.IsLocked"/>
|
||||||
<ConfigurationText OptionDescription="@T("Default file patterns")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.FilterAlt" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.FilePatterns)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.FilePatterns = value)" OptionHelp="@T("Separate multiple file patterns with a semicolon, e.g., *.pdf;*.docx.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.FilePatterns, out var meta) && meta.IsLocked"/>
|
<ConfigurationText OptionDescription="@T("Default file patterns")" Disabled="@this.DefaultsDisabled" Icon="@Icons.Material.Filled.FilterAlt" Text="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.FilePatterns)" TextUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.FilePatterns = value)" ResetValue="@(() => DataBatchProcessing.DEFAULT_FILE_PATTERNS)" ResetButtonText="@T("Restore default patterns")" OptionHelp="@T("Separate multiple file patterns with a semicolon, e.g., *.pdf;*.docx.")" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.FilePatterns, out var meta) && meta.IsLocked"/>
|
||||||
<ConfigurationOption OptionDescription="@T("Include subfolders by default?")" Disabled="@this.DefaultsDisabled" LabelOn="@T("Subfolders are included")" LabelOff="@T("Only the selected folder is processed")" State="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.IncludeSubdirectories)" StateUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.IncludeSubdirectories = value)" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.IncludeSubdirectories, out var meta) && meta.IsLocked"/>
|
<ConfigurationOption OptionDescription="@T("Include subfolders by default?")" Disabled="@this.DefaultsDisabled" LabelOn="@T("Subfolders are included")" LabelOff="@T("Only the selected folder is processed")" State="@(() => this.SettingsManager.ConfigurationData.BatchProcessing.IncludeSubdirectories)" StateUpdate="@(value => this.SettingsManager.ConfigurationData.BatchProcessing.IncludeSubdirectories = value)" IsLocked="() => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.IncludeSubdirectories, out var meta) && meta.IsLocked"/>
|
||||||
|
|
||||||
<MudText Typo="Typo.h6" Class="mb-3 mt-6">@T("Instructions")</MudText>
|
<MudText Typo="Typo.h6" Class="mb-3 mt-6">@T("Instructions")</MudText>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user