Implement progress monitoring for image generation in AIImages mod, enhancing user experience with real-time updates. Add localized strings for new features in English and Russian. Refactor UI components for better organization and clarity. Update AIImages.dll to reflect these changes.

This commit is contained in:
Leonid Pershin
2025-10-26 22:56:38 +03:00
parent b9d7ea0c04
commit d67ec8c0ac
11 changed files with 470 additions and 94 deletions

View File

@@ -137,6 +137,42 @@ namespace AIImages.Services
}
}
public async Task<GenerationProgress> GetProgressAsync(
CancellationToken cancellationToken = default
)
{
ThrowIfDisposed();
try
{
// Используем Progress сервис библиотеки
var progress = await _client.Progress.GetProgressAsync(cancellationToken);
// Маппируем на наш тип
return new GenerationProgress
{
Progress = progress.Progress,
CurrentStep = progress.State?.SamplingStep ?? 0,
TotalSteps = progress.State?.SamplingSteps ?? 0,
EtaRelative = progress.EtaRelative,
IsActive = progress.Progress > 0 && progress.Progress < 1.0,
};
}
catch (Exception ex)
{
Log.Warning($"[AI Images] Failed to get progress: {ex.Message}");
// Возвращаем пустой прогресс при ошибке
return new GenerationProgress
{
Progress = 0,
CurrentStep = 0,
TotalSteps = 0,
EtaRelative = 0,
IsActive = false,
};
}
}
public async Task<bool> CheckApiAvailability(
string apiEndpoint,
CancellationToken cancellationToken = default