feat: Support multiple vector database selection, add InMemory and Qdrant adapters, introduce admin dashboard

This commit is contained in:
shiyu
2025-05-31 21:00:48 +08:00
parent b2bacc54a9
commit 44d2616fd4
51 changed files with 5498 additions and 1214 deletions

View File

@@ -0,0 +1,30 @@
using Foxel.Services.Configuration;
namespace Foxel.Services.VectorDB;
public class VectorDbInitializer : IHostedService
{
private readonly IVectorDbService _vectorDbService;
private readonly IConfigService _configService;
private const string VectorDbTypeConfigKey = "VectorDb:Type";
public VectorDbInitializer(IVectorDbService vectorDbService, IConfigService configService)
{
_vectorDbService = vectorDbService;
_configService = configService;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
var dbTypeStr = await _configService.GetValueAsync(VectorDbTypeConfigKey) ?? "InMemory";
if (string.Equals(dbTypeStr, "InMemory", StringComparison.OrdinalIgnoreCase))
{
await _vectorDbService.BuildUserPictureVectorsAsync();
}
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}