From 97b7211ccefd6e9c422f61526fd893ae63c97445 Mon Sep 17 00:00:00 2001
From: zyxucp <286513187@qq.com>
Date: Mon, 5 Aug 2024 12:54:37 +0800
Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=A7=E5=B0=8F=E5=86=99=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/AntSK.Domain/AntSK.Domain.csproj | 2 +-
src/AntSK.Domain/Common/AntSkFunctionAttribute.cs | 2 +-
src/AntSK.Domain/Domain/Service/KernelService.cs | 4 ++--
src/AntSK.LLM/SparkDesk/SparkDeskChatCompletion.cs | 4 ++--
src/AntSK.LLM/SparkDesk/SparkDeskTextCompletion.cs | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/AntSK.Domain/AntSK.Domain.csproj b/src/AntSK.Domain/AntSK.Domain.csproj
index a5118e1d..27173e62 100644
--- a/src/AntSK.Domain/AntSK.Domain.csproj
+++ b/src/AntSK.Domain/AntSK.Domain.csproj
@@ -51,7 +51,7 @@
-
+
diff --git a/src/AntSK.Domain/Common/AntSkFunctionAttribute.cs b/src/AntSK.Domain/Common/AntSkFunctionAttribute.cs
index 767e16fe..4ba28262 100644
--- a/src/AntSK.Domain/Common/AntSkFunctionAttribute.cs
+++ b/src/AntSK.Domain/Common/AntSkFunctionAttribute.cs
@@ -1,7 +1,7 @@
namespace AntSK.Domain.Common
{
[AttributeUsage(AttributeTargets.Method)]
- public class AntSkFunctionAttribute : Attribute
+ public class AntSKFunctionAttribute : Attribute
{
// 自定义的ActionAttribute
}
diff --git a/src/AntSK.Domain/Domain/Service/KernelService.cs b/src/AntSK.Domain/Domain/Service/KernelService.cs
index 6a35d474..b50837c6 100644
--- a/src/AntSK.Domain/Domain/Service/KernelService.cs
+++ b/src/AntSK.Domain/Domain/Service/KernelService.cs
@@ -176,7 +176,7 @@ private void WithTextGenerationByAIType(IKernelBuilder builder,AIModels chatMode
public void ImportFunctionsByApp(Apps app, Kernel _kernel)
{
//插件不能重复注册,否则会异常
- if (_kernel.Plugins.Any(p => p.Name == "AntSkFunctions"))
+ if (_kernel.Plugins.Any(p => p.Name == "AntSKFunctions"))
{
return;
}
@@ -187,7 +187,7 @@ public void ImportFunctionsByApp(Apps app, Kernel _kernel)
//本地函数插件
ImportNativeFunction(app, functions);
- _kernel.ImportPluginFromFunctions("AntSkFunctions", functions);
+ _kernel.ImportPluginFromFunctions("AntSKFunctions", functions);
}
///
diff --git a/src/AntSK.LLM/SparkDesk/SparkDeskChatCompletion.cs b/src/AntSK.LLM/SparkDesk/SparkDeskChatCompletion.cs
index a8f4a625..d67efa51 100644
--- a/src/AntSK.LLM/SparkDesk/SparkDeskChatCompletion.cs
+++ b/src/AntSK.LLM/SparkDesk/SparkDeskChatCompletion.cs
@@ -50,7 +50,7 @@ public async Task> GetChatMessageContentsAsync
parameters.Temperature = (float)chatExecutionSettings.Temperature;
parameters.MaxTokens = chatExecutionSettings.MaxTokens ?? parameters.MaxTokens;
- IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSkFunctions").ToList() ?? [];
+ IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSKFunctions").ToList() ?? [];
var functionDefs = functions.Select(func => new FunctionDef(func.Name, func.Description, func.Parameters.Select(p => new FunctionParametersDef(p.Name, p.ParameterType?.IsClass == true ? "object" : "string", p.Description, p.IsRequired)).ToList())).ToList();
List messages = GetSparkMessage(chatHistory);
@@ -133,7 +133,7 @@ public async IAsyncEnumerable GetStreamingChatMessa
parameters.Temperature = (float)chatExecutionSettings.Temperature;
parameters.MaxTokens = chatExecutionSettings.MaxTokens ?? parameters.MaxTokens;
- IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSkFunctions").ToList() ?? [];
+ IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSKFunctions").ToList() ?? [];
var functionDefs = functions.Select(func => new FunctionDef(func.Name, func.Description, func.Parameters.Select(p => new FunctionParametersDef(p.Name, p.ParameterType?.IsClass == true ? "object" : "string", p.Description, p.IsRequired)).ToList())).ToList();
List messages = GetSparkMessage(chatHistory);
await foreach (StreamedChatResponse msg in _client.ChatAsStreamAsync(_options.ModelVersion, messages.ToArray(), parameters, functionDefs.Count > 0 ? [.. functionDefs] : null, cancellationToken: cancellationToken))
diff --git a/src/AntSK.LLM/SparkDesk/SparkDeskTextCompletion.cs b/src/AntSK.LLM/SparkDesk/SparkDeskTextCompletion.cs
index e2ec0513..c72da3e0 100644
--- a/src/AntSK.LLM/SparkDesk/SparkDeskTextCompletion.cs
+++ b/src/AntSK.LLM/SparkDesk/SparkDeskTextCompletion.cs
@@ -67,7 +67,7 @@ public IAsyncEnumerable GetStreamingTextContentsAsync(stri
parameters.Temperature = (float)chatExecutionSettings.Temperature;
parameters.MaxTokens = chatExecutionSettings.MaxTokens ?? parameters.MaxTokens;
- IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSkFunctions").ToList() ?? [];
+ IList functions = kernel?.Plugins.GetFunctionsMetadata().Where(x => x.PluginName == "AntSKFunctions").ToList() ?? [];
var functionDefs = functions.Select(func => new FunctionDef(func.Name, func.Description, func.Parameters.Select(p => new FunctionParametersDef(p.Name, p.ParameterType?.IsClass == true ? "object" : "string", p.Description, p.IsRequired)).ToList())).ToList();
//var messages = GetHistories(prompt);