2026-03-12 18:48:13 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using ImageCatalog_2.Models;
|
|
|
|
|
|
|
|
|
|
namespace ImageCatalog_2.Services;
|
|
|
|
|
|
|
|
|
|
public sealed class AiExtractionRequest
|
|
|
|
|
{
|
|
|
|
|
public required string SearchRoot { get; init; }
|
|
|
|
|
public required bool Recursive { get; init; }
|
2026-05-09 17:53:15 +02:00
|
|
|
public bool IncludeThumbnails { get; init; }
|
2026-05-09 17:27:05 +02:00
|
|
|
public required string ModelsFolderPath { get; init; }
|
|
|
|
|
public bool UseGpu { get; init; }
|
2026-05-09 18:54:20 +02:00
|
|
|
public int WorkloadLevel { get; init; } = 3;
|
2026-03-12 18:48:13 +01:00
|
|
|
public string CsvOutputPath { get; init; } = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 18:54:20 +02:00
|
|
|
public sealed record AiExtractionProgressUpdate(
|
|
|
|
|
int TotalFiles,
|
|
|
|
|
int ProcessedFiles,
|
|
|
|
|
double PercentComplete,
|
|
|
|
|
double AverageImagesPerSecond,
|
|
|
|
|
int WorkloadLevel,
|
2026-05-09 19:31:21 +02:00
|
|
|
int WorkerCount,
|
|
|
|
|
bool UseGpu);
|
2026-05-09 18:54:20 +02:00
|
|
|
|
|
|
|
|
public sealed record AiExtractionRunSummary(
|
|
|
|
|
int TotalFiles,
|
|
|
|
|
int ProcessedFiles,
|
|
|
|
|
int FailedFiles,
|
|
|
|
|
double AverageImagesPerSecond,
|
|
|
|
|
int WorkloadLevel,
|
2026-05-09 19:31:21 +02:00
|
|
|
int WorkerCount,
|
|
|
|
|
bool UseGpu);
|
2026-05-09 18:54:20 +02:00
|
|
|
|
2026-03-12 18:48:13 +01:00
|
|
|
public interface IAiExtractionService
|
|
|
|
|
{
|
2026-05-09 18:54:20 +02:00
|
|
|
Task<AiExtractionRunSummary> RunAsync(
|
2026-03-12 18:48:13 +01:00
|
|
|
AiExtractionRequest request,
|
|
|
|
|
CancellationToken token,
|
|
|
|
|
Func<AiResultItem, Task> onResult,
|
2026-05-09 18:54:20 +02:00
|
|
|
Func<AiExtractionProgressUpdate, Task> onProgress);
|
2026-03-12 18:48:13 +01:00
|
|
|
}
|