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:
ShiYu
2025-05-31 00:33:37 +08:00
parent 5886eb8690
commit 32af3720e3
8 changed files with 98 additions and 120 deletions

View File

@@ -2,7 +2,6 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using Foxel.Services.Attributes;
using Vector = Pgvector.Vector;
namespace Foxel.Models.DataBase;
@@ -15,7 +14,7 @@ public class Picture : BaseModel
[StringLength(1024)] public string? ThumbnailPath { get; set; } = string.Empty;
[StringLength(2000)] public string Description { get; set; } = string.Empty;
[Column(TypeName = "vector(1024)")] public Vector? Embedding { get; set; }
public float[]? Embedding { get; set; }
public DateTime? TakenAt { get; set; }
@@ -57,8 +56,8 @@ public enum PermissionType
public enum ProcessingStatus
{
Pending, // 等待处理
Processing, // 处理中
Completed, // 处理完成
Failed // 处理失败
Pending, // 等待处理
Processing, // 处理中
Completed, // 处理完成
Failed // 处理失败
}