feat: implement semantic search, knowledge unit extraction, and visualization components

This commit is contained in:
2026-05-03 15:59:30 +02:00
parent 94ecc7a404
commit 1f187b5125
24 changed files with 844 additions and 21 deletions
@@ -13,10 +13,15 @@ public record QuizQuestion(
[property: JsonPropertyName("correct_index")] int CorrectIndex
);
public record KnowledgeUnitDto(string Id, string Type, string Content, Dictionary<string, object>? Metadata = null);
public record KnowledgeLinkDto(string Source, string Target, string Relation);
public record KnowledgePacket
{
[JsonPropertyName("concepts")] public List<KeyConcept> Concepts { get; init; } = new();
[JsonPropertyName("quizzes")] public List<QuizQuestion> Quizzes { get; init; } = new();
[JsonPropertyName("units")] public List<KnowledgeUnitDto> Units { get; init; } = new();
[JsonPropertyName("links")] public List<KnowledgeLinkDto> Links { get; init; } = new();
[JsonPropertyName("graph")] public NexusReader.Application.Queries.Graph.GraphDataDto? Graph { get; init; }
[JsonPropertyName("summary")] public string? Summary { get; init; }
}
@@ -0,0 +1,8 @@
namespace NexusReader.Application.DTOs.AI;
public class RelevantContext
{
public string Text { get; set; } = string.Empty;
public string SourceId { get; set; } = string.Empty; // ContentHash or EbookTitle
public double Confidence { get; set; }
}
@@ -0,0 +1,11 @@
namespace NexusReader.Application.DTOs.AI;
public class SemanticSearchResultDto
{
public string ContentHash { get; set; } = string.Empty;
public string Snippet { get; set; } = string.Empty;
public string? UnitType { get; set; }
public float RelevanceScore { get; set; }
public string? SourceBookTitle { get; set; }
public Dictionary<string, object>? Metadata { get; set; } // Bonus context
}