feat: 提交
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Volo.Abp.Caching;
|
||||
using Volo.Abp.Domain;
|
||||
using Yi.Framework.Mapster;
|
||||
using Yi.Framework.SemanticKernel;
|
||||
using Yi.Framework.Stock.Domain.Managers;
|
||||
using Yi.Framework.Stock.Domain.Managers.SemanticKernel;
|
||||
using Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins;
|
||||
using Yi.Framework.Stock.Domain.Shared;
|
||||
|
||||
@@ -14,7 +15,6 @@ namespace Yi.Framework.Stock.Domain
|
||||
typeof(YiFrameworkStockDomainSharedModule),
|
||||
typeof(YiFrameworkMapsterModule),
|
||||
typeof(AbpDddDomainModule),
|
||||
typeof(YiFrameworkSemanticKernelModule),
|
||||
typeof(AbpCachingModule)
|
||||
)]
|
||||
public class YiFrameworkStockDomainModule : AbpModule
|
||||
@@ -24,6 +24,27 @@ namespace Yi.Framework.Stock.Domain
|
||||
var configuration = context.Services.GetConfiguration();
|
||||
var services = context.Services;
|
||||
|
||||
// 配置绑定
|
||||
var semanticKernelSection = configuration.GetSection("SemanticKernel");
|
||||
services.Configure<SemanticKernelOptions>(configuration.GetSection("SemanticKernel"));
|
||||
// 从配置中获取值
|
||||
var options = semanticKernelSection.Get<SemanticKernelOptions>();
|
||||
foreach (var optionsModelId in options.ModelIds)
|
||||
{
|
||||
services.AddKernel()
|
||||
.AddAzureOpenAIChatCompletion(
|
||||
deploymentName: optionsModelId,
|
||||
endpoint: options.Endpoint,
|
||||
apiKey: options.ApiKey,
|
||||
serviceId: optionsModelId,
|
||||
modelId: optionsModelId);
|
||||
|
||||
// .AddOpenAIChatCompletion(
|
||||
// serviceId: optionsModelId,
|
||||
// modelId: optionsModelId,
|
||||
// endpoint: new Uri(options.Endpoint),
|
||||
// apiKey: options.ApiKey);
|
||||
}
|
||||
// 添加插件
|
||||
services.AddSingleton<KernelPlugin>(sp =>
|
||||
KernelPluginFactory.CreateFromType<NewsPlugins>(serviceProvider: sp));
|
||||
|
||||
Reference in New Issue
Block a user