From 37e87c934e27afef31dc22b96d48255339798b27 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 23 Aug 2024 13:49:06 -0500 Subject: [PATCH] add create vector knowledge --- .../BotSharp.Abstraction/Knowledges/IKnowledgeService.cs | 2 +- .../BotSharp.OpenAPI/Controllers/KnowledgeBaseController.cs | 6 +++--- .../BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs | 2 +- .../Services/KnowledgeService.Get.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs b/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs index 8f504aad..20825791 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs @@ -8,7 +8,7 @@ public interface IKnowledgeService Task> GetVectorCollections(); Task> SearchVectorKnowledge(string query, string collectionName, VectorSearchOptions options); Task FeedVectorKnowledge(string collectionName, KnowledgeCreationModel model); - Task> GetVectorCollectionData(string collectionName, VectorFilter filter); + Task> GetPagedVectorCollectionData(string collectionName, VectorFilter filter); Task DeleteVectorCollectionData(string collectionName, string id); Task CreateVectorCollectionData(string collectionName, VectorCreateModel create); Task UpdateVectorCollectionData(string collectionName, VectorUpdateModel update); diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBaseController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBaseController.cs index 64a8d5af..deb21378 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBaseController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/KnowledgeBaseController.cs @@ -39,10 +39,10 @@ public class KnowledgeBaseController : ControllerBase return results.Select(x => VectorKnowledgeViewModel.From(x)).ToList(); } - [HttpPost("/knowledge/vector/{collection}/data")] - public async Task> GetVectorCollectionData([FromRoute] string collection, [FromBody] VectorFilter filter) + [HttpPost("/knowledge/vector/{collection}/page")] + public async Task> GetPagedVectorCollectionData([FromRoute] string collection, [FromBody] VectorFilter filter) { - var data = await _knowledgeService.GetVectorCollectionData(collection, filter); + var data = await _knowledgeService.GetPagedVectorCollectionData(collection, filter); var items = data.Items?.Select(x => VectorKnowledgeViewModel.From(x))? .ToList() ?? new List(); diff --git a/src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs b/src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs index c3e4e7ae..213825b5 100644 --- a/src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs +++ b/src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs @@ -34,7 +34,7 @@ public class KnowledgeBasePlugin : IBotSharpPlugin { SubMenu = new List { - new PluginMenuDef("Q & A", link: "page/knowledge-base/qna"), + new PluginMenuDef("Q & A", link: "page/knowledge-base/question-answer"), new PluginMenuDef("Relations", link: "page/knowledge-base/relations") } }); diff --git a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Get.cs b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Get.cs index 98224029..ee36780e 100644 --- a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Get.cs +++ b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Get.cs @@ -18,7 +18,7 @@ public partial class KnowledgeService } } - public async Task> GetVectorCollectionData(string collectionName, VectorFilter filter) + public async Task> GetPagedVectorCollectionData(string collectionName, VectorFilter filter) { try {