feat: 完善渠道商管理
This commit is contained in:
@@ -93,4 +93,9 @@ public class AiModelCreateInput
|
||||
/// 是否为尊享模型
|
||||
/// </summary>
|
||||
public bool IsPremium { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
@@ -81,4 +81,9 @@ public class AiModelDto
|
||||
/// 是否为尊享模型
|
||||
/// </summary>
|
||||
public bool IsPremium { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
|
||||
@@ -99,4 +99,9 @@ public class AiModelUpdateInput
|
||||
/// 是否为尊享模型
|
||||
/// </summary>
|
||||
public bool IsPremium { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ public class ChannelService : ApplicationService, IChannelService
|
||||
ProviderName = input.ProviderName,
|
||||
IconUrl = input.IconUrl,
|
||||
IsPremium = input.IsPremium,
|
||||
IsEnabled = input.IsEnabled,
|
||||
IsDeleted = false
|
||||
};
|
||||
|
||||
@@ -222,6 +223,7 @@ public class ChannelService : ApplicationService, IChannelService
|
||||
entity.ProviderName = input.ProviderName;
|
||||
entity.IconUrl = input.IconUrl;
|
||||
entity.IsPremium = input.IsPremium;
|
||||
entity.IsEnabled = input.IsEnabled;
|
||||
|
||||
await _modelRepository.UpdateAsync(entity);
|
||||
return entity.Adapt<AiModelDto>();
|
||||
|
||||
@@ -35,8 +35,9 @@ public class ModelService : ApplicationService, IModelService
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
// 查询所有未删除的模型,使用WhereIF动态添加筛选条件
|
||||
// 查询所有未删除且已启用的模型,使用WhereIF动态添加筛选条件
|
||||
var modelIds = (await _modelRepository._DbQueryable
|
||||
.Where(x => x.IsEnabled)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), x =>
|
||||
x.Name.Contains(input.SearchKey) || x.ModelId.Contains(input.SearchKey))
|
||||
.WhereIF(input.ProviderNames is not null, x =>
|
||||
@@ -51,6 +52,7 @@ public class ModelService : ApplicationService, IModelService
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total));
|
||||
|
||||
var entities = await _modelRepository._DbQueryable.Where(x => modelIds.Contains(x.ModelId))
|
||||
.Where(x => x.IsEnabled)
|
||||
.OrderBy(x => x.OrderNum)
|
||||
.OrderBy(x => x.Name).ToListAsync();
|
||||
|
||||
@@ -77,7 +79,7 @@ public class ModelService : ApplicationService, IModelService
|
||||
public async Task<List<string>> GetProviderListAsync()
|
||||
{
|
||||
var providers = await _modelRepository._DbQueryable
|
||||
.Where(x => !x.IsDeleted)
|
||||
.Where(x => !x.IsDeleted && x.IsEnabled)
|
||||
.Where(x => !string.IsNullOrEmpty(x.ProviderName))
|
||||
.GroupBy(x => x.ProviderName)
|
||||
.OrderBy(x => x.OrderNum)
|
||||
|
||||
@@ -85,4 +85,9 @@ public class AiModelEntity : Entity<Guid>, IOrderNum, ISoftDelete
|
||||
/// 是否为尊享模型
|
||||
/// </summary>
|
||||
public bool IsPremium { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
@@ -71,6 +71,7 @@ public class AiGateWayManager : DomainService
|
||||
.LeftJoin<AiAppAggregateRoot>((model, app) => model.AiAppId == app.Id)
|
||||
.Where((model, app) => model.ModelId == modelId)
|
||||
.Where((model, app) => model.ModelApiType == modelApiType)
|
||||
.Where((model, app) => model.IsEnabled)
|
||||
.Select((model, app) =>
|
||||
new AiModelDescribe
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ModelManager : DomainService
|
||||
{
|
||||
// 从数据库查询
|
||||
var premiumModelIds = await _aiModelRepository._DbQueryable
|
||||
.Where(x => x.IsPremium)
|
||||
.Where(x => x.IsPremium && x.IsEnabled)
|
||||
.Select(x => x.ModelId)
|
||||
.ToListAsync();
|
||||
return premiumModelIds;
|
||||
|
||||
Reference in New Issue
Block a user