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