feat: 提交
This commit is contained in:
@@ -4,15 +4,14 @@ using Microsoft.SemanticKernel.Connectors.AzureOpenAI;
|
||||
using Microsoft.SemanticKernel.Connectors.OpenAI;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Yi.Framework.ChatHub.Domain.Shared.Dtos;
|
||||
using Yi.Framework.SemanticKernel;
|
||||
|
||||
namespace Yi.Framework.ChatHub.Domain.Managers
|
||||
{
|
||||
public class AiManager : ISingletonDependency
|
||||
{
|
||||
private readonly SemanticKernelClient _client;
|
||||
private readonly Kernel _client;
|
||||
|
||||
public AiManager(SemanticKernelClient client)
|
||||
public AiManager(Kernel client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
@@ -30,7 +29,7 @@ namespace Yi.Framework.ChatHub.Domain.Managers
|
||||
MaxTokens = 3000
|
||||
};
|
||||
|
||||
var chatCompletionService = this._client.Kernel.GetRequiredService<IChatCompletionService>(model);
|
||||
var chatCompletionService = this._client.GetRequiredService<IChatCompletionService>(model);
|
||||
|
||||
var history = new ChatHistory();
|
||||
foreach (var aiChatContextDto in aiChatContextDtos)
|
||||
@@ -48,7 +47,7 @@ namespace Yi.Framework.ChatHub.Domain.Managers
|
||||
var results = chatCompletionService.GetStreamingChatMessageContentsAsync(
|
||||
chatHistory: history,
|
||||
executionSettings: openSettings,
|
||||
kernel: _client.Kernel);
|
||||
kernel: _client);
|
||||
|
||||
await foreach (var result in results)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<Import Project="..\..\..\common.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.SemanticKernel\Yi.Framework.SemanticKernel.csproj" />
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.SqlSugarCore.Abstractions\Yi.Framework.SqlSugarCore.Abstractions.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.ChatHub.Domain.Shared\Yi.Framework.ChatHub.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
@@ -13,6 +12,7 @@
|
||||
<PackageReference Include="Volo.Abp.Caching" Version="$(AbpVersion)" />
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Caching.FreeRedis\Yi.Framework.Caching.FreeRedis.csproj" />
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Mapster\Yi.Framework.Mapster.csproj" />
|
||||
<PackageReference Include="Microsoft.SemanticKernel" Version="1.57.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
using Volo.Abp.Domain;
|
||||
using Yi.Framework.Caching.FreeRedis;
|
||||
using Yi.Framework.ChatHub.Domain.Shared;
|
||||
using Yi.Framework.SemanticKernel;
|
||||
|
||||
namespace Yi.Framework.ChatHub.Domain
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiFrameworkChatHubDomainSharedModule),
|
||||
typeof(YiFrameworkCachingFreeRedisModule),
|
||||
typeof(YiFrameworkSemanticKernelModule),
|
||||
typeof(AbpDddDomainModule)
|
||||
)]
|
||||
public class YiFrameworkChatHubDomainModule : AbpModule
|
||||
|
||||
Reference in New Issue
Block a user