add missing
This commit is contained in:
parent
1fcb25a8f7
commit
f161ab6e6c
|
|
@ -4,10 +4,12 @@ public static class KnowledgeSettingHelper
|
|||
{
|
||||
public static ITextEmbedding GetTextEmbeddingSetting(IServiceProvider services, string collectionName)
|
||||
{
|
||||
var settings = services.GetRequiredService<KnowledgeBaseSettings>();
|
||||
var db = services.GetRequiredService<IBotSharpRepository>();
|
||||
var configs = db.GetKnowledgeCollectionConfigs(new VectorCollectionConfigFilter
|
||||
{
|
||||
CollectionNames = new[] { collectionName }
|
||||
CollectionNames = [collectionName],
|
||||
VectorStroageProviders = [settings.VectorDb.Provider]
|
||||
});
|
||||
|
||||
var found = configs?.FirstOrDefault()?.TextEmbedding;
|
||||
|
|
@ -17,7 +19,6 @@ public static class KnowledgeSettingHelper
|
|||
|
||||
if (found == null)
|
||||
{
|
||||
var settings = services.GetRequiredService<KnowledgeBaseSettings>();
|
||||
provider = settings.Default.TextEmbedding.Provider;
|
||||
model = settings.Default.TextEmbedding.Model;
|
||||
dimension = settings.Default.TextEmbedding.Dimension;
|
||||
|
|
|
|||
|
|
@ -31,18 +31,9 @@ public partial class KnowledgeService : IKnowledgeService
|
|||
return db;
|
||||
}
|
||||
|
||||
private ITextEmbedding GetTextEmbedding(string collection)
|
||||
private ITextEmbedding GetTextEmbedding(string collectionName)
|
||||
{
|
||||
return KnowledgeSettingHelper.GetTextEmbeddingSetting(_services, collection);
|
||||
}
|
||||
|
||||
private VectorCollectionConfig? GetVectorCollectionConfig(string collection)
|
||||
{
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
return db.GetKnowledgeCollectionConfigs(new VectorCollectionConfigFilter
|
||||
{
|
||||
CollectionNames = new[] { collection }
|
||||
})?.FirstOrDefault();
|
||||
return KnowledgeSettingHelper.GetTextEmbeddingSetting(_services, collectionName);
|
||||
}
|
||||
|
||||
private async Task<string> GetUserId()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public partial class MongoRepository
|
|||
Id = Guid.NewGuid().ToString(),
|
||||
Name = x.Name,
|
||||
Type = x.Type,
|
||||
VectorStorage = KnowledgeVectorStorageConfigMongoModel.ToMongoModel(x.VectorStorage),
|
||||
TextEmbedding = KnowledgeEmbeddingConfigMongoModel.ToMongoModel(x.TextEmbedding)
|
||||
})?.ToList() ?? new List<KnowledgeCollectionConfigDocument>();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue