mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-05 00:44:35 +00:00
Improved the pauses between indexing steps and between files of the Batch Processing Assistant (#1240)
This commit is contained in:
1 parent
a117074972
commit
899139c88b
32 files changed
+787
-425
No files matched your search
@@ -2,6 +2,7 @@ using System.Linq.Expressions;
|
||||
|
||||
using AIStudio.Assistants.BatchProcessing;
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Tools.Pauses;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
@@ -12,8 +13,12 @@ namespace AIStudio.Settings.DataModel;
|
||||
public sealed class DataBatchProcessing(Expression<Func<Data, DataBatchProcessing>>? configSelection = null)
|
||||
{
|
||||
public const string DEFAULT_FILE_PATTERNS = "*.pdf;*.docx;*.pptx;*.xlsx;*.md;*.txt;*.jpg;*.jpeg;*.png;*.webp;*.gif;*.bmp;*.tif;*.tiff;*.mp3;*.wav;*.wave;*.aac;*.flac;*.ogg;*.opus;*.m4a;*.m4b;*.wma;*.alac;*.aif;*.aiff;*.caf;*.mp4;*.m4v;*.avi;*.mkv;*.mov;*.wmv;*.flv;*.webm";
|
||||
public const int MIN_DELAY_SECONDS = 6;
|
||||
public const int MAX_DELAY_SECONDS = 300;
|
||||
|
||||
/// <summary>
|
||||
/// The pauses between two files either bound may ask for: at least 6 seconds, at most 300 seconds.
|
||||
/// </summary>
|
||||
public static readonly PauseLimits PAUSE_LIMITS = new(6, 300);
|
||||
|
||||
public const int DEFAULT_MIN_DELAY_SECONDS = 6;
|
||||
public const int DEFAULT_MAX_DELAY_SECONDS = 10;
|
||||
public const bool DEFAULT_INCLUDE_SUBDIRECTORIES = false;
|
||||
@@ -82,7 +87,7 @@ public sealed class DataBatchProcessing(Expression<Func<Data, DataBatchProcessin
|
||||
|
||||
public int MinimumDelaySeconds { get; set; } = ManagedConfiguration.Register(configSelection, value => value.MinimumDelaySeconds, DEFAULT_MIN_DELAY_SECONDS);
|
||||
|
||||
public int MaximumDelaySeconds { get; set; } = DEFAULT_MAX_DELAY_SECONDS;
|
||||
public int MaximumDelaySeconds { get; set; } = ManagedConfiguration.Register(configSelection, value => value.MaximumDelaySeconds, DEFAULT_MAX_DELAY_SECONDS);
|
||||
|
||||
public ConfidenceLevel MinimumProviderConfidence { get; set; } = ManagedConfiguration.Register(configSelection, value => value.MinimumProviderConfidence, ConfidenceLevel.NONE);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class DataBatchProcessingExtensions
|
||||
{
|
||||
/// <param name="settings">The settings of the Batch Processing Assistant.</param>
|
||||
extension(DataBatchProcessing settings)
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether a configuration plugin locks the lower bound of the pause between two files.
|
||||
/// </summary>
|
||||
public static bool IsMinimumPauseLocked => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.MinimumDelaySeconds, out var meta) && meta.IsLocked;
|
||||
|
||||
/// <summary>
|
||||
/// Whether a configuration plugin locks the upper bound of the pause between two files.
|
||||
/// </summary>
|
||||
public static bool IsMaximumPauseLocked => ManagedConfiguration.TryGet(x => x.BatchProcessing, x => x.MaximumDelaySeconds, out var meta) && meta.IsLocked;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Linq.Expressions;
|
||||
|
||||
using AIStudio.Tools.Pauses;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
/// <summary>
|
||||
@@ -9,9 +11,9 @@ namespace AIStudio.Settings.DataModel;
|
||||
public sealed class DataDataSourceIndexing(Expression<Func<Data, DataDataSourceIndexing>>? configSelection = null)
|
||||
{
|
||||
/// <summary>
|
||||
/// The longest pause between two indexing steps either bound may ask for.
|
||||
/// The pauses between two indexing steps either bound may ask for: none at all, up to 300 seconds.
|
||||
/// </summary>
|
||||
public const int MAX_PAUSE_BETWEEN_STEPS_SECONDS = 300;
|
||||
public static readonly PauseLimits PAUSE_LIMITS = new(0, 300);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an unmanaged instance, e.g., for the JSON deserializer.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using AIStudio.Tools.Pauses;
|
||||
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class DataDataSourceIndexingExtensions
|
||||
{
|
||||
/// <param name="settings">The settings of the indexing.</param>
|
||||
extension(DataDataSourceIndexing settings)
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether a configuration plugin locks the lower bound of the pause between two indexing steps.
|
||||
/// </summary>
|
||||
public static bool IsMinimumPauseLocked => ManagedConfiguration.TryGet(x => x.App.DataSourceIndexing, x => x.MinimumPauseBetweenStepsSeconds, out var meta) && meta.IsLocked;
|
||||
|
||||
/// <summary>
|
||||
/// Whether a configuration plugin locks the upper bound of the pause between two indexing steps.
|
||||
/// </summary>
|
||||
public static bool IsMaximumPauseLocked => ManagedConfiguration.TryGet(x => x.App.DataSourceIndexing, x => x.MaximumPauseBetweenStepsSeconds, out var meta) && meta.IsLocked;
|
||||
|
||||
/// <summary>
|
||||
/// The bounds of the pause between two indexing steps which apply now, as the user set them
|
||||
/// and as configuration plugins lock them, cf. PauseRange.GetEffective.
|
||||
/// </summary>
|
||||
public PauseRange EffectivePauseRange => PauseRange.GetEffective(
|
||||
DataDataSourceIndexing.PAUSE_LIMITS,
|
||||
settings.MinimumPauseBetweenStepsSeconds,
|
||||
() => DataDataSourceIndexing.IsMinimumPauseLocked,
|
||||
settings.MaximumPauseBetweenStepsSeconds,
|
||||
() => DataDataSourceIndexing.IsMaximumPauseLocked);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user