feat: 新增错误信息返回
This commit is contained in:
@@ -56,4 +56,9 @@ public class ImageTaskOutput
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
public string? ErrorInfo { get; set; }
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class AiImageService : ApplicationService
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly TokenManager _tokenManager;
|
||||
private readonly ISqlSugarRepository<AiModelEntity> _aiModelRepository;
|
||||
|
||||
public AiImageService(
|
||||
ISqlSugarRepository<ImageStoreTaskAggregateRoot> imageTaskRepository,
|
||||
IBackgroundJobManager backgroundJobManager,
|
||||
@@ -43,7 +44,8 @@ public class AiImageService : ApplicationService
|
||||
PremiumPackageManager premiumPackageManager,
|
||||
ModelManager modelManager,
|
||||
IGuidGenerator guidGenerator,
|
||||
IWebHostEnvironment webHostEnvironment, TokenManager tokenManager, ISqlSugarRepository<AiModelEntity> aiModelRepository)
|
||||
IWebHostEnvironment webHostEnvironment, TokenManager tokenManager,
|
||||
ISqlSugarRepository<AiModelEntity> aiModelRepository)
|
||||
{
|
||||
_imageTaskRepository = imageTaskRepository;
|
||||
_backgroundJobManager = backgroundJobManager;
|
||||
@@ -66,7 +68,7 @@ public class AiImageService : ApplicationService
|
||||
public async Task<Guid> GenerateAsync([FromBody] ImageGenerationInput input)
|
||||
{
|
||||
var userId = CurrentUser.GetId();
|
||||
|
||||
|
||||
// 黑名单校验
|
||||
await _aiBlacklistManager.VerifiyAiBlacklist(userId);
|
||||
|
||||
@@ -76,7 +78,7 @@ public class AiImageService : ApplicationService
|
||||
await _tokenManager.ValidateTokenAsync(input.TokenId, input.ModelId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// VIP校验
|
||||
if (!CurrentUser.IsAiVip())
|
||||
{
|
||||
@@ -174,6 +176,7 @@ public class AiImageService : ApplicationService
|
||||
{
|
||||
mimeType = header.Split(':')[1].Split(';')[0];
|
||||
}
|
||||
|
||||
base64Content = parts[1];
|
||||
}
|
||||
}
|
||||
@@ -253,7 +256,10 @@ public class AiImageService : ApplicationService
|
||||
// StoreBase64 = x.StoreBase64,
|
||||
StoreUrl = x.StoreUrl,
|
||||
TaskStatus = x.TaskStatus,
|
||||
CreationTime = x.CreationTime
|
||||
PublishStatus = x.PublishStatus,
|
||||
Categories = x.Categories,
|
||||
CreationTime = x.CreationTime,
|
||||
ErrorInfo = x.ErrorInfo
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
@@ -322,7 +328,7 @@ public class AiImageService : ApplicationService
|
||||
|
||||
await _imageTaskRepository.UpdateAsync(task);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取图片模型列表
|
||||
/// </summary>
|
||||
@@ -368,4 +374,4 @@ public class PagedResult<T>
|
||||
Total = total;
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user