From 0e36f7c0b3970e72a60bf1306fe2dfa464687511 Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Sun, 29 Jun 2025 15:41:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/AiChatService.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiChatService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiChatService.cs index 1d1d74d2..565ca3a3 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiChatService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application/Services/AiChatService.cs @@ -91,22 +91,22 @@ public class AiChatService : ApplicationService public async Task PostSendAsync(SendMessageInput input, CancellationToken cancellationToken) { //除了免费模型,其他的模型都要校验 - // if (input.Model != "DeepSeek-R1-0528") - // { - // //有token,需要黑名单校验 - // if (CurrentUser.IsAuthenticated) - // { - // await _aiBlacklistManager.VerifiyAiBlacklist(CurrentUser.GetId()); - // if (!CurrentUser.Roles.Contains("YiXinAi-Vip")) - // { - // throw new UserFriendlyException("该模型需要VIP用户才能使用,请购买VIP后重新登录重试"); - // } - // } - // else - // { - // throw new UserFriendlyException("未登录用户,只能使用未加速的DeepSeek-R1,请登录后重试"); - // } - // } + if (input.Model != "DeepSeek-R1") + { + //有token,需要黑名单校验 + if (CurrentUser.IsAuthenticated) + { + await _aiBlacklistManager.VerifiyAiBlacklist(CurrentUser.GetId()); + if (!CurrentUser.Roles.Contains("YiXinAi-Vip")&&!CurrentUser.Roles.Contains("admin")) + { + throw new UserFriendlyException("该模型需要VIP用户才能使用,请购买VIP后重新登录重试"); + } + } + else + { + throw new UserFriendlyException("未登录用户,只能使用未加速的DeepSeek-R1,请登录后重试"); + } + } //前面都是校验,后面才是真正的调用 var httpContext = this._httpContextAccessor.HttpContext;