diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureChatService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureChatService.cs index fc6dca8e..efa7b790 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureChatService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureChatService.cs @@ -23,12 +23,16 @@ public class AzureChatService : IChatService AzureOpenAIClient azureClient = new( endpoint, - new AzureKeyCredential(apiKey)); + new AzureKeyCredential(apiKey), new AzureOpenAIClientOptions() + { + NetworkTimeout = TimeSpan.FromSeconds(600), + }); + ChatClient chatClient = azureClient.GetChatClient(deploymentName); var response = chatClient.CompleteChatStreamingAsync(messages, new ChatCompletionOptions() { - // MaxOutputTokenCount = 2048 + // MaxOutputTokenCount = 2048 }, cancellationToken: cancellationToken); await foreach (StreamingChatCompletionUpdate update in response) diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureRestChatService.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureRestChatService.cs index 96cbe54a..3bf78c77 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureRestChatService.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/AiChat/Impl/AzureRestChatService.cs @@ -41,7 +41,11 @@ public class AzureRestChatService : IChatService // 序列化请求内容为JSON string jsonBody = JsonConvert.SerializeObject(requestBody); - using var httpClient = new HttpClient(); + using var httpClient = new HttpClient() + { + //10分钟超时 + Timeout = TimeSpan.FromSeconds(600) + }; // 设置请求头 httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {aiModelDescribe.ApiKey}"); // 其他头信息如Content-Type在StringContent中设置 diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index 2ac6b509..1826894f 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -29,6 +29,7 @@ using Volo.Abp.Autofac; using Volo.Abp.BackgroundJobs.Hangfire; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; +using Volo.Abp.Domain.Repositories; using Volo.Abp.MultiTenancy; using Volo.Abp.Swashbuckle; using Yi.Abp.Application; @@ -43,6 +44,7 @@ using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; using Yi.Framework.BackgroundWorkers.Hangfire; using Yi.Framework.Bbs.Application; using Yi.Framework.Bbs.Application.Extensions; +using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.ChatHub.Application; using Yi.Framework.CodeGen.Application; using Yi.Framework.Core.Json; @@ -51,6 +53,7 @@ using Yi.Framework.Rbac.Application; using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Shared.Consts; using Yi.Framework.Rbac.Domain.Shared.Options; +using Yi.Framework.SqlSugarCore.Abstractions; using Yi.Framework.Stock.Application; using Yi.Framework.TenantManagement.Application; @@ -349,7 +352,6 @@ namespace Yi.Abp.Web var service = context.ServiceProvider; var env = context.GetEnvironment(); var app = context.GetApplicationBuilder(); - app.UseRouting(); //跨域