diff --git a/src/AntSK.Domain/AntSK.Domain.csproj b/src/AntSK.Domain/AntSK.Domain.csproj index c19f4e0d..ff65e6e4 100644 --- a/src/AntSK.Domain/AntSK.Domain.csproj +++ b/src/AntSK.Domain/AntSK.Domain.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/AntSK.Domain/Domain/Service/KernelService.cs b/src/AntSK.Domain/Domain/Service/KernelService.cs index ddaeae40..15600fdb 100644 --- a/src/AntSK.Domain/Domain/Service/KernelService.cs +++ b/src/AntSK.Domain/Domain/Service/KernelService.cs @@ -1,4 +1,4 @@ -using AntSk.LLM.SparkDesk; +using AntSK.LLM.SparkDesk; using AntSK.Domain.Common.DependencyInjection; using AntSK.Domain.Domain.Interface; using AntSK.Domain.Domain.Other; @@ -14,6 +14,7 @@ using RestSharp; using System; using ServiceLifetime = AntSK.Domain.Common.DependencyInjection.ServiceLifetime; +using AntSK.LLM.Mock; namespace AntSK.Domain.Domain.Service { @@ -93,6 +94,9 @@ private void WithTextGenerationByAIType(IKernelBuilder builder, Apps app, AIMode var options = new SparkDeskOptions { AppId = chatModel.EndPoint, ApiSecret = chatModel.ModelKey, ApiKey = chatModel.ModelName, ModelVersion = Sdcb.SparkDesk.ModelVersion.V3_5 }; builder.Services.AddKeyedSingleton("spark-desk", new SparkDeskTextCompletion(options, app.Id)); break; + case Model.Enum.AIType.Mock: + builder.Services.AddKeyedSingleton("mock", new MockTextCompletion()); + break; } } diff --git a/src/AntSK.Domain/Model/Enum/AIModelType.cs b/src/AntSK.Domain/Model/Enum/AIModelType.cs index b2b9f23d..7b51d9b4 100644 --- a/src/AntSK.Domain/Model/Enum/AIModelType.cs +++ b/src/AntSK.Domain/Model/Enum/AIModelType.cs @@ -9,6 +9,7 @@ public enum AIType AzureOpenAI = 2, LLamaSharp=3, SparkDesk=4, + Mock=5, } /// diff --git a/src/AntSK.sln b/src/AntSK.sln index 90547e91..3cd362dd 100644 --- a/src/AntSK.sln +++ b/src/AntSK.sln @@ -18,7 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MiddleWare", "MiddleWare", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.BackgroundTask", "MiddleWare\AntSK.BackgroundTask\AntSK.BackgroundTask.csproj", "{DF87E829-99C5-44A7-9718-B3E67DC801F6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntSk.LLM.SparkDesk", "AntSk.LLM.SparkDesk\AntSk.LLM.SparkDesk.csproj", "{1B4313B3-EF8E-4ADC-982A-C3F608BDEFDB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntSK.LLM", "AntSk.LLM\AntSK.LLM.csproj", "{19529BFA-152F-4A8C-8254-F2D4896AB739}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -38,10 +38,10 @@ Global {DF87E829-99C5-44A7-9718-B3E67DC801F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF87E829-99C5-44A7-9718-B3E67DC801F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF87E829-99C5-44A7-9718-B3E67DC801F6}.Release|Any CPU.Build.0 = Release|Any CPU - {1B4313B3-EF8E-4ADC-982A-C3F608BDEFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1B4313B3-EF8E-4ADC-982A-C3F608BDEFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B4313B3-EF8E-4ADC-982A-C3F608BDEFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B4313B3-EF8E-4ADC-982A-C3F608BDEFDB}.Release|Any CPU.Build.0 = Release|Any CPU + {19529BFA-152F-4A8C-8254-F2D4896AB739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19529BFA-152F-4A8C-8254-F2D4896AB739}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19529BFA-152F-4A8C-8254-F2D4896AB739}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19529BFA-152F-4A8C-8254-F2D4896AB739}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/AntSK/Pages/KmsPage/AddKms.razor.cs b/src/AntSK/Pages/KmsPage/AddKms.razor.cs index ee885392..73f235d7 100644 --- a/src/AntSK/Pages/KmsPage/AddKms.razor.cs +++ b/src/AntSK/Pages/KmsPage/AddKms.razor.cs @@ -28,9 +28,10 @@ public partial class AddKms protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); - //星火没实现KM先隐藏 - _chatList = _aimodels_Repositories.GetList(p => p.AIModelType == AIModelType.Chat&&p.AIType!=AIType.SparkDesk); - _embeddingList = _aimodels_Repositories.GetList(p => p.AIModelType == AIModelType.Embedding && p.AIType != AIType.SparkDesk); + //星火 Mock没实现KM先隐藏 + List ignores = new List() { AIType.SparkDesk, AIType.Mock }; + _chatList = _aimodels_Repositories.GetList(p => p.AIModelType == AIModelType.Chat&& !ignores.Contains(p.AIType)); + _embeddingList = _aimodels_Repositories.GetList(p => p.AIModelType == AIModelType.Embedding && !ignores.Contains(p.AIType)); if (!string.IsNullOrEmpty(KmsId)) { //查看 diff --git a/src/AntSK/Pages/Setting/AIModel/AddModel.razor b/src/AntSK/Pages/Setting/AIModel/AddModel.razor index 2fd15fce..17e5293a 100644 --- a/src/AntSK/Pages/Setting/AIModel/AddModel.razor +++ b/src/AntSK/Pages/Setting/AIModel/AddModel.razor @@ -76,6 +76,11 @@ + } + @if (context.AIType == AIType.Mock) + { + + }