Browse Source
Allow resolving kernel with ChatClient configured only
pull/23895/head
Enis Necipoglu
1 year ago
No known key found for this signature in database
GPG Key ID: 1EC55E13241E1680
1 changed files with
14 additions and
0 deletions
-
framework/src/Volo.Abp.AI/Volo/Abp/AI/AbpAIModule.cs
|
|
|
@ -99,5 +99,19 @@ public class AbpAIModule : AbpModule |
|
|
|
sp => sp.GetRequiredKeyedService<IChatClient>(serviceName) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
if (workspaceConfig.Kernel.Builder is null) |
|
|
|
{ |
|
|
|
context.Services.AddKeyedTransient<Kernel>( |
|
|
|
AbpAIWorkspaceOptions.GetKernelServiceKeyName(workspaceConfig.Name), |
|
|
|
(sp, _) => |
|
|
|
{ |
|
|
|
var chatClient = sp.GetRequiredKeyedService<IChatClient>(serviceName); |
|
|
|
var builder = Kernel.CreateBuilder(); |
|
|
|
builder.Services.AddSingleton<IChatClient>(chatClient); |
|
|
|
return builder.Build(); |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |