feat: 提交

This commit is contained in:
cc
2025-06-20 18:06:33 +08:00
parent f16e1cd7a6
commit 6abcc49ed4
15 changed files with 138 additions and 118 deletions

View File

@@ -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)
{

View File

@@ -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>

View File

@@ -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