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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user