|
@@ -1,8 +1,10 @@
|
|
|
|
|
+using Microsoft.AspNetCore.DataProtection;
|
|
|
using Microsoft.AspNetCore.Http.Connections;
|
|
using Microsoft.AspNetCore.Http.Connections;
|
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
|
using Microsoft.AspNetCore.ResponseCompression;
|
|
using Microsoft.AspNetCore.ResponseCompression;
|
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
|
|
|
+using NPOI.POIFS.Crypt;
|
|
|
using OASystem.API.Middlewares;
|
|
using OASystem.API.Middlewares;
|
|
|
using OASystem.API.OAMethodLib;
|
|
using OASystem.API.OAMethodLib;
|
|
|
using OASystem.API.OAMethodLib.AMapApi;
|
|
using OASystem.API.OAMethodLib.AMapApi;
|
|
@@ -10,6 +12,7 @@ using OASystem.API.OAMethodLib.APNs;
|
|
|
using OASystem.API.OAMethodLib.DeepSeekAPI;
|
|
using OASystem.API.OAMethodLib.DeepSeekAPI;
|
|
|
using OASystem.API.OAMethodLib.GenericSearch;
|
|
using OASystem.API.OAMethodLib.GenericSearch;
|
|
|
using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
|
|
|
+using OASystem.API.OAMethodLib.HunYuanAPI;
|
|
|
using OASystem.API.OAMethodLib.JuHeAPI;
|
|
using OASystem.API.OAMethodLib.JuHeAPI;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
using OASystem.API.OAMethodLib.Quartz.Jobs;
|
|
using OASystem.API.OAMethodLib.Quartz.Jobs;
|
|
@@ -21,6 +24,9 @@ using Quartz.Spi;
|
|
|
using QuzrtzJob.Factory;
|
|
using QuzrtzJob.Factory;
|
|
|
using Serilog.Events;
|
|
using Serilog.Events;
|
|
|
using System.IO.Compression;
|
|
using System.IO.Compression;
|
|
|
|
|
+using TencentCloud.Common;
|
|
|
|
|
+using TencentCloud.Common.Profile;
|
|
|
|
|
+using TencentCloud.Hunyuan.V20230901;
|
|
|
using static OASystem.API.Middlewares.RateLimitMiddleware;
|
|
using static OASystem.API.Middlewares.RateLimitMiddleware;
|
|
|
|
|
|
|
|
Console.Title = $"FMGJ OASystem Server";
|
|
Console.Title = $"FMGJ OASystem Server";
|
|
@@ -491,6 +497,48 @@ builder.Services.AddHttpClient("PublicQiYeWeChatApi", c => c.BaseAddress = new U
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
+#region 混元API
|
|
|
|
|
+
|
|
|
|
|
+// 从配置中读取腾讯云密钥信息(请确保appsettings.json中有对应配置)
|
|
|
|
|
+var secretId = builder.Configuration["TencentCloud:SecretId"];
|
|
|
|
|
+var secretKey = builder.Configuration["TencentCloud:SecretKey"];
|
|
|
|
|
+var region = builder.Configuration["TencentCloud:Region"] ?? "ap-guangzhou";
|
|
|
|
|
+
|
|
|
|
|
+// 配置HttpClientFactory(SDK内部会用到)
|
|
|
|
|
+builder.Services.AddHttpClient();
|
|
|
|
|
+
|
|
|
|
|
+// 注册腾讯云Hunyuan Client为Singleton(推荐)
|
|
|
|
|
+builder.Services.AddSingleton(provider =>
|
|
|
|
|
+{
|
|
|
|
|
+ Credential cred = new Credential
|
|
|
|
|
+ {
|
|
|
|
|
+ SecretId = secretId,
|
|
|
|
|
+ SecretKey = secretKey
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ ClientProfile clientProfile = new ClientProfile();
|
|
|
|
|
+ HttpProfile httpProfile = new HttpProfile
|
|
|
|
|
+ {
|
|
|
|
|
+ Endpoint = "hunyuan.tencentcloudapi.com"
|
|
|
|
|
+ };
|
|
|
|
|
+ clientProfile.HttpProfile = httpProfile;
|
|
|
|
|
+
|
|
|
|
|
+ return new HunyuanClient(cred, region, clientProfile);
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 注册自定义服务接口及其实现为Scoped生命周期
|
|
|
|
|
+builder.Services.AddScoped<IHunyuanService, HunyuanService>();
|
|
|
|
|
+
|
|
|
|
|
+// 注册混元服务
|
|
|
|
|
+//builder.Services.AddHttpClient<IHunyuanService, HunyuanService>(client =>
|
|
|
|
|
+//{
|
|
|
|
|
+// client.BaseAddress = new Uri("https://hunyuan.ap-chengdu.tencentcloudapi.com/");
|
|
|
|
|
+// client.Timeout = TimeSpan.FromSeconds(60);
|
|
|
|
|
+//});
|
|
|
|
|
+
|
|
|
|
|
+//builder.Services.Configure<HunyuanApiSettings>(builder.Configuration.GetSection("HunyuanApiSettings"));
|
|
|
|
|
+#endregion
|
|
|
|
|
+
|
|
|
#region 有道API 服务
|
|
#region 有道API 服务
|
|
|
//builder.Services.AddControllersWithViews();
|
|
//builder.Services.AddControllersWithViews();
|
|
|
//builder.Services.AddSingleton<IYouDaoApiService, YouDaoApiService>();
|
|
//builder.Services.AddSingleton<IYouDaoApiService, YouDaoApiService>();
|