feat: implement semantic search, knowledge unit extraction, and visualization components
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using NexusReader.Domain.Enums;
|
||||
|
||||
namespace NexusReader.Domain.Entities;
|
||||
|
||||
public class KnowledgeUnit
|
||||
{
|
||||
[Key]
|
||||
[MaxLength(128)]
|
||||
public string Id { get; set; } = string.Empty; // Hash(Source + Content + Version)
|
||||
|
||||
[Required]
|
||||
[MaxLength(128)]
|
||||
public string SourceId { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string Version { get; set; } = "1.0";
|
||||
|
||||
[Required]
|
||||
public KnowledgeUnitType Type { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
public string? MetadataJson { get; set; } // e.g. { "page": 1, "path": "Chapter 1 > Intro" }
|
||||
|
||||
[Required]
|
||||
[MaxLength(128)]
|
||||
public string TenantId { get; set; } = string.Empty;
|
||||
|
||||
[Column(TypeName = "vector(768)")] // Default for text-embedding-004
|
||||
public float[]? Vector { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// Relationships
|
||||
public ICollection<KnowledgeUnitLink> OutgoingLinks { get; set; } = new List<KnowledgeUnitLink>();
|
||||
public ICollection<KnowledgeUnitLink> IncomingLinks { get; set; } = new List<KnowledgeUnitLink>();
|
||||
}
|
||||
Reference in New Issue
Block a user