enisn
5 months ago
No known key found for this signature in database
GPG Key ID: A052619F04155D1C
2 changed files with
3 additions and
5 deletions
-
framework/src/Volo.Abp.AI/Volo/Abp/AI/AbpAIModule.cs
-
framework/src/Volo.Abp.AI/Volo/Abp/AI/Extensions/ChatClientWithSystemMessageExtensions.cs
|
|
|
@ -67,6 +67,7 @@ public class AbpAIModule : AbpModule |
|
|
|
builderConfigurer.Action(workspaceConfig.Kernel.Builder!); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: Check if we can use transient instead of singleton for Kernel
|
|
|
|
context.Services.AddKeyedTransient<Kernel>( |
|
|
|
AbpAIOptions.GetKernelServiceKeyName(workspaceConfig.Name), |
|
|
|
(provider, _) => workspaceConfig.Kernel.Builder!.Build()); |
|
|
|
@ -84,7 +85,8 @@ public class AbpAIModule : AbpModule |
|
|
|
context.Services.AddKeyedTransient<IChatClient>( |
|
|
|
AbpAIOptions.GetChatClientServiceKeyName(workspaceConfig.Name), |
|
|
|
(sp, _) => sp.GetKeyedService<Kernel>(AbpAIOptions.GetKernelServiceKeyName(workspaceConfig.Name))? |
|
|
|
.GetRequiredService<IChatClient>() ?? throw new InvalidOperationException("Kernel or IChatClient not found with workspace name: " + workspaceConfig.Name) |
|
|
|
.GetRequiredService<IChatClient>() |
|
|
|
?? throw new InvalidOperationException("Kernel or IChatClient not found with workspace name: " + workspaceConfig.Name) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,7 +1,3 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.AI; |
|
|
|
using Volo.Abp.AI.Delegates; |
|
|
|
|
|
|
|
|