BotSharp/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.List.cs

33 lines
1 KiB
C#
Raw Normal View History

2024-08-06 21:02:02 +00:00
namespace BotSharp.Plugin.KnowledgeBase.Services;
public partial class KnowledgeService
{
public async Task<KnowledgeCollectionInfo> GetKnowledgeCollectionInfo(string collectionName)
{
try
{
var db = GetVectorDb();
return await db.GetCollectionInfo(collectionName);
}
catch (Exception ex)
{
_logger.LogWarning($"Error when getting knowledge collectio info. {ex.Message}\r\n{ex.InnerException}");
return new KnowledgeCollectionInfo();
}
}
2024-08-06 22:43:11 +00:00
public async Task<UuidPagedItems<KnowledgeCollectionData>> GetKnowledgeCollectionData(KnowledgeFilter filter)
{
try
{
var db = GetVectorDb();
return await db.GetCollectionData(filter);
}
catch (Exception ex)
{
_logger.LogWarning($"Error when getting knowledge collectio data. {ex.Message}\r\n{ex.InnerException}");
return new UuidPagedItems<KnowledgeCollectionData>();
}
}
2024-08-06 21:02:02 +00:00
}