AI-Studio/app/MindWork AI Studio/Dialogs/BatchProcessingResumeDialog.razor.cs
j-erler 05790e8af4 Added the Batch Processing Assistant
The assistant processes all documents of a folder in one batch run. Each
document is extracted to Markdown by the Rust runtime and sent to the
selected provider together with the user's instructions.

The instructions come from one of three sources: a free prompt, one of
the existing document analysis policies including its minimum provider
confidence, or a file the user imports.

The output is either one Markdown file per document, or one CSV results
table in which each answer becomes a row. The user can name the results
table; its columns are the document and the answer.

Every run writes a log named log.csv with the document, time, model,
status, and the reason for any error. When a later run finds a log in
the output folder, the assistant asks whether to continue it. Continuing
processes only the documents that failed or whose results no longer
exist, which recovers runs interrupted by a crash or by documents
exceeding the context window of the model. A single failing document
never stops the run, and the run can be canceled at any time.

Columns are separated by a vertical bar and quoted per RFC 4180, so that
the files open in spreadsheet applications regardless of the list
separator of the user. Documents are identified by their path relative
to the input folder, because two subfolders may contain a document of
the same name.

Includes the English and German localization.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 18:05:18 +02:00

41 lines
1.3 KiB
C#

using AIStudio.Assistants.BatchProcessing;
using AIStudio.Components;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Dialogs;
/// <summary>
/// Asks the user whether a previous batch run should be continued or started from scratch.
/// </summary>
public partial class BatchProcessingResumeDialog : MSGComponentBase
{
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; } = null!;
/// <summary>
/// The number of documents which were processed successfully during the previous run.
/// </summary>
[Parameter]
public int NumCompletedFiles { get; set; }
/// <summary>
/// The number of documents which still need to be processed.
/// </summary>
[Parameter]
public int NumRemainingFiles { get; set; }
/// <summary>
/// The number of documents which the log lists as successfully processed,
/// but whose results no longer exist. They count as remaining and are
/// processed again when the run is continued.
/// </summary>
[Parameter]
public int NumMissingResults { get; set; }
private void Cancel() => this.MudDialog.Cancel();
private void Continue() => this.MudDialog.Close(DialogResult.Ok(BatchProcessingResumeDecision.CONTINUE));
private void Restart() => this.MudDialog.Close(DialogResult.Ok(BatchProcessingResumeDecision.RESTART));
}