Merge remote-tracking branch 'origin/ai-hub' into ai-hub
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
namespace Yi.Framework.AiHub.Application.Contracts.Dtos.Channel;
|
||||
|
||||
/// <summary>
|
||||
/// AI应用快捷配置DTO
|
||||
/// </summary>
|
||||
public class AiAppShortcutDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用ID
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用终结点
|
||||
/// </summary>
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 额外URL
|
||||
/// </summary>
|
||||
public string? ExtraUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用Key
|
||||
/// </summary>
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
@@ -83,4 +83,14 @@ public interface IChannelService
|
||||
Task DeleteModelAsync(Guid id);
|
||||
|
||||
#endregion
|
||||
|
||||
#region AI应用快捷配置
|
||||
|
||||
/// <summary>
|
||||
/// 获取AI应用快捷配置列表
|
||||
/// </summary>
|
||||
/// <returns>快捷配置列表</returns>
|
||||
Task<List<AiAppShortcutDto>> GetAppShortcutListAsync();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -19,13 +19,16 @@ public class ChannelService : ApplicationService, IChannelService
|
||||
{
|
||||
private readonly ISqlSugarRepository<AiAppAggregateRoot, Guid> _appRepository;
|
||||
private readonly ISqlSugarRepository<AiModelEntity, Guid> _modelRepository;
|
||||
private readonly ISqlSugarRepository<AiAppShortcutAggregateRoot, Guid> _appShortcutRepository;
|
||||
|
||||
public ChannelService(
|
||||
ISqlSugarRepository<AiAppAggregateRoot, Guid> appRepository,
|
||||
ISqlSugarRepository<AiModelEntity, Guid> modelRepository)
|
||||
ISqlSugarRepository<AiModelEntity, Guid> modelRepository,
|
||||
ISqlSugarRepository<AiAppShortcutAggregateRoot, Guid> appShortcutRepository)
|
||||
{
|
||||
_appRepository = appRepository;
|
||||
_modelRepository = modelRepository;
|
||||
_appShortcutRepository = appShortcutRepository;
|
||||
}
|
||||
|
||||
#region AI应用管理
|
||||
@@ -239,4 +242,22 @@ public class ChannelService : ApplicationService, IChannelService
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AI应用快捷配置
|
||||
|
||||
/// <summary>
|
||||
/// 获取AI应用快捷配置列表
|
||||
/// </summary>
|
||||
[HttpGet("channel/app-shortcut")]
|
||||
public async Task<List<AiAppShortcutDto>> GetAppShortcutListAsync()
|
||||
{
|
||||
var entities = await _appShortcutRepository._DbQueryable
|
||||
.OrderBy(x => x.OrderNum)
|
||||
.OrderByDescending(x => x.CreationTime)
|
||||
.ToListAsync();
|
||||
|
||||
return entities.Adapt<List<AiAppShortcutDto>>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
using Yi.Framework.Core.Data;
|
||||
|
||||
namespace Yi.Framework.AiHub.Domain.Entities.Model;
|
||||
|
||||
/// <summary>
|
||||
/// AI应用快捷配置表
|
||||
/// </summary>
|
||||
[SugarTable("Ai_App_Shortcut")]
|
||||
public class AiAppShortcutAggregateRoot : FullAuditedAggregateRoot<Guid>, IOrderNum
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用终结点
|
||||
/// </summary>
|
||||
public string Endpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 额外url
|
||||
/// </summary>
|
||||
public string? ExtraUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用key
|
||||
/// </summary>
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user