add create vector knowledge

This commit is contained in:
Jicheng Lu 2024-08-23 13:49:06 -05:00
parent 2af2b7d74c
commit 37e87c934e
4 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@ public interface IKnowledgeService
Task<IEnumerable<string>> GetVectorCollections();
Task<IEnumerable<VectorSearchResult>> SearchVectorKnowledge(string query, string collectionName, VectorSearchOptions options);
Task FeedVectorKnowledge(string collectionName, KnowledgeCreationModel model);
Task<StringIdPagedItems<VectorSearchResult>> GetVectorCollectionData(string collectionName, VectorFilter filter);
Task<StringIdPagedItems<VectorSearchResult>> GetPagedVectorCollectionData(string collectionName, VectorFilter filter);
Task<bool> DeleteVectorCollectionData(string collectionName, string id);
Task<bool> CreateVectorCollectionData(string collectionName, VectorCreateModel create);
Task<bool> UpdateVectorCollectionData(string collectionName, VectorUpdateModel update);

View file

@ -39,10 +39,10 @@ public class KnowledgeBaseController : ControllerBase
return results.Select(x => VectorKnowledgeViewModel.From(x)).ToList();
}
[HttpPost("/knowledge/vector/{collection}/data")]
public async Task<StringIdPagedItems<VectorKnowledgeViewModel>> GetVectorCollectionData([FromRoute] string collection, [FromBody] VectorFilter filter)
[HttpPost("/knowledge/vector/{collection}/page")]
public async Task<StringIdPagedItems<VectorKnowledgeViewModel>> 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<VectorKnowledgeViewModel>();

View file

@ -34,7 +34,7 @@ public class KnowledgeBasePlugin : IBotSharpPlugin
{
SubMenu = new List<PluginMenuDef>
{
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")
}
});

View file

@ -18,7 +18,7 @@ public partial class KnowledgeService
}
}
public async Task<StringIdPagedItems<VectorSearchResult>> GetVectorCollectionData(string collectionName, VectorFilter filter)
public async Task<StringIdPagedItems<VectorSearchResult>> GetPagedVectorCollectionData(string collectionName, VectorFilter filter)
{
try
{