From be9442c113e2bc92aa3cc585623498f88586f59d Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Mon, 19 Jan 2026 22:12:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EAI=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 AI 应用快捷配置查询能力,在 IChannelService 中定义获取快捷配置列表接口,并在 ChannelService 中实现对应接口,支持按排序号及创建时间获取快捷配置数据。 --- .../Dtos/Channel/AiAppShortcutDto.cs | 42 +++++++++++++++++++ .../IServices/IChannelService.cs | 10 +++++ .../Services/ChannelService.cs | 23 +++++++++- .../Model/AiAppShortcutAggregateRoot.cs | 37 ++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/Channel/AiAppShortcutDto.cs create mode 100644 Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Entities/Model/AiAppShortcutAggregateRoot.cs 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; } +}