mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-07-10 23:12:01 +08:00
feat(vector-db): integrate vector database for image search
- Replace pgvector with Microsoft Vector DB for image vector storage and search - Update Picture model to use float[] instead of Vector type - Modify PictureService to use VectorDbService for vector search - Remove vector-related code from MyDbContext - Add PictureVector model for Vector DB integration
This commit is contained in:
@@ -5,17 +5,6 @@ namespace Foxel;
|
||||
|
||||
public class MyDbContext(DbContextOptions<MyDbContext> options) : DbContext(options)
|
||||
{
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasPostgresExtension("vector");
|
||||
|
||||
modelBuilder.Entity<Picture>()
|
||||
.HasIndex(p => p.Embedding)
|
||||
.HasMethod("ivfflat")
|
||||
.HasOperators("vector_cosine_ops")
|
||||
.HasStorageParameter("lists", 100);
|
||||
}
|
||||
|
||||
public DbSet<Picture> Pictures { get; set; } = null!;
|
||||
public DbSet<User> Users { get; set; } = null!;
|
||||
public DbSet<Tag> Tags { get; set; } = null!;
|
||||
|
||||
Reference in New Issue
Block a user