diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Channel/AiAppShortcutDto.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Channel/AiAppShortcutDto.cs new file mode 100644 index 00000000..799823ff --- /dev/null +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Channel/AiAppShortcutDto.cs @@ -0,0 +1,42 @@ +namespace Yi.Framework.AiHub.Application.Contracts.Dtos.Channel; + +/// +/// AI应用快捷配置DTO +/// +public class AiAppShortcutDto +{ + /// + /// 应用ID + /// + public Guid Id { get; set; } + + /// + /// 应用名称 + /// + public string Name { get; set; } + + /// + /// 应用终结点 + /// + public string Endpoint { get; set; } + + /// + /// 额外URL + /// + public string? ExtraUrl { get; set; } + + /// + /// 应用Key + /// + public string ApiKey { get; set; } + + /// + /// 排序 + /// + public int OrderNum { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreationTime { get; set; } +} diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IChannelService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IChannelService.cs index d45b542e..bf703fe1 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IChannelService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/IServices/IChannelService.cs @@ -83,4 +83,14 @@ public interface IChannelService Task DeleteModelAsync(Guid id); #endregion + + #region AI应用快捷配置 + + /// + /// 获取AI应用快捷配置列表 + /// + /// 快捷配置列表 + Task> GetAppShortcutListAsync(); + + #endregion } diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/ChannelService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/ChannelService.cs index 5a609297..bdbe66b2 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/ChannelService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/ChannelService.cs @@ -19,13 +19,16 @@ public class ChannelService : ApplicationService, IChannelService { private readonly ISqlSugarRepository _appRepository; private readonly ISqlSugarRepository _modelRepository; + private readonly ISqlSugarRepository _appShortcutRepository; public ChannelService( ISqlSugarRepository appRepository, - ISqlSugarRepository modelRepository) + ISqlSugarRepository modelRepository, + ISqlSugarRepository appShortcutRepository) { _appRepository = appRepository; _modelRepository = modelRepository; + _appShortcutRepository = appShortcutRepository; } #region AI应用管理 @@ -239,4 +242,22 @@ public class ChannelService : ApplicationService, IChannelService } #endregion + + #region AI应用快捷配置 + + /// + /// 获取AI应用快捷配置列表 + /// + [HttpGet("channel/app-shortcut")] + public async Task> GetAppShortcutListAsync() + { + var entities = await _appShortcutRepository._DbQueryable + .OrderBy(x => x.OrderNum) + .OrderByDescending(x => x.CreationTime) + .ToListAsync(); + + return entities.Adapt>(); + } + + #endregion } \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Entities/Model/AiAppShortcutAggregateRoot.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Entities/Model/AiAppShortcutAggregateRoot.cs new file mode 100644 index 00000000..5cae2def --- /dev/null +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Entities/Model/AiAppShortcutAggregateRoot.cs @@ -0,0 +1,37 @@ +using SqlSugar; +using Volo.Abp.Domain.Entities.Auditing; +using Yi.Framework.Core.Data; + +namespace Yi.Framework.AiHub.Domain.Entities.Model; + +/// +/// AI应用快捷配置表 +/// +[SugarTable("Ai_App_Shortcut")] +public class AiAppShortcutAggregateRoot : FullAuditedAggregateRoot, IOrderNum +{ + /// + /// 应用名称 + /// + public string Name { get; set; } + + /// + /// 应用终结点 + /// + public string Endpoint { get; set; } + + /// + /// 额外url + /// + public string? ExtraUrl { get; set; } + + /// + /// 应用key + /// + public string ApiKey { get; set; } + + /// + /// 排序 + /// + public int OrderNum { get; set; } +}