mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 14:37:59 +00:00
refactored confidence levels and ensured checks work
This commit is contained in:
1 parent
786b106096
commit
88999d985c
44 files changed
+324
-335
No files matched your search
@@ -43,8 +43,8 @@ public sealed record EmbeddingStateFile(
|
||||
DateTimeOffset LastWriteUtc,
|
||||
DateTimeOffset EmbeddedAtUtc,
|
||||
int ChunkCount,
|
||||
string ComplianceLevel,
|
||||
int ComplianceLevelRank);
|
||||
string ConfidenceLevel,
|
||||
int ConfidenceLevelRank);
|
||||
|
||||
public sealed record EmbeddingStateChunk(
|
||||
string ChunkId,
|
||||
@@ -74,5 +74,5 @@ public sealed record EmbeddingStateSearchResult(
|
||||
DateTimeOffset LastWriteUtc,
|
||||
DateTimeOffset EmbeddedAtUtc,
|
||||
int ChunkCount,
|
||||
string ComplianceLevel,
|
||||
int ComplianceLevelRank);
|
||||
string ConfidenceLevel,
|
||||
int ConfidenceLevelRank);
|
||||
@@ -62,13 +62,13 @@ internal sealed class EmbeddingStateDbContext(DbContextOptions<EmbeddingStateDbC
|
||||
entity.Property(file => file.LastWriteUtc).HasColumnName("last_write_utc").HasConversion(utcDateTimeOffsetConverter).IsRequired();
|
||||
entity.Property(file => file.EmbeddedAtUtc).HasColumnName("embedded_at_utc").HasConversion(utcDateTimeOffsetConverter).IsRequired();
|
||||
entity.Property(file => file.ChunkCount).HasColumnName("chunk_count");
|
||||
entity.Property(file => file.ComplianceLevel).HasColumnName("compliance_level").IsRequired();
|
||||
entity.Property(file => file.ComplianceLevelRank).HasColumnName("compliance_level_rank");
|
||||
entity.Property(file => file.ConfidenceLevel).HasColumnName("confidence_level").IsRequired();
|
||||
entity.Property(file => file.ConfidenceLevelRank).HasColumnName("confidence_level_rank");
|
||||
|
||||
entity.HasIndex(file => file.DataSourceId).HasDatabaseName("idx_embedded_files_data_source");
|
||||
entity.HasIndex(file => file.AbsolutePath).HasDatabaseName("idx_embedded_files_absolute_path");
|
||||
entity.HasIndex(file => file.FileType).HasDatabaseName("idx_embedded_files_file_type");
|
||||
entity.HasIndex(file => file.ComplianceLevelRank).HasDatabaseName("idx_embedded_files_compliance");
|
||||
entity.HasIndex(file => file.ConfidenceLevelRank).HasDatabaseName("idx_embedded_files_confidence");
|
||||
entity.HasIndex(file => new { file.DataSourceId, file.AbsolutePath }).HasDatabaseName("idx_embedded_files_data_source_absolute_path").IsUnique();
|
||||
|
||||
entity
|
||||
@@ -165,9 +165,9 @@ internal sealed class EmbeddingStateFileEntity
|
||||
|
||||
public int ChunkCount { get; set; }
|
||||
|
||||
public string ComplianceLevel { get; set; } = string.Empty;
|
||||
public string ConfidenceLevel { get; set; } = string.Empty;
|
||||
|
||||
public int ComplianceLevelRank { get; set; }
|
||||
public int ConfidenceLevelRank { get; set; }
|
||||
|
||||
public EmbeddingStateDataSourceEntity? DataSource { get; set; }
|
||||
|
||||
@@ -233,9 +233,9 @@ internal sealed class EmbeddingStateSearchResultEntity
|
||||
|
||||
public int ChunkCount { get; set; }
|
||||
|
||||
public string ComplianceLevel { get; set; } = string.Empty;
|
||||
public string ConfidenceLevel { get; set; } = string.Empty;
|
||||
|
||||
public int ComplianceLevelRank { get; set; }
|
||||
public int ConfidenceLevelRank { get; set; }
|
||||
}
|
||||
|
||||
internal sealed class EmbeddingStateDateTimeOffsetConverter() : ValueConverter<DateTimeOffset, string>(
|
||||
|
||||
+4
-4
@@ -45,8 +45,8 @@ public partial class InitialRagIndex : Migration
|
||||
last_write_utc = table.Column<string>(type: "TEXT", nullable: false),
|
||||
embedded_at_utc = table.Column<string>(type: "TEXT", nullable: false),
|
||||
chunk_count = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
compliance_level = table.Column<string>(type: "TEXT", nullable: false),
|
||||
compliance_level_rank = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
confidence_level = table.Column<string>(type: "TEXT", nullable: false),
|
||||
confidence_level_rank = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -89,9 +89,9 @@ public partial class InitialRagIndex : Migration
|
||||
column: "absolute_path");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "idx_embedded_files_compliance",
|
||||
name: "idx_embedded_files_confidence",
|
||||
table: "embedded_files",
|
||||
column: "compliance_level_rank");
|
||||
column: "confidence_level_rank");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "idx_embedded_files_data_source",
|
||||
|
||||
+8
-8
@@ -77,14 +77,14 @@ partial class EmbeddingStateDbContextModelSnapshot : ModelSnapshot
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("chunk_count");
|
||||
|
||||
entity.Property<string>("ComplianceLevel")
|
||||
entity.Property<string>("ConfidenceLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnName("compliance_level");
|
||||
.HasColumnName("confidence_level");
|
||||
|
||||
entity.Property<int>("ComplianceLevelRank")
|
||||
entity.Property<int>("ConfidenceLevelRank")
|
||||
.HasColumnType("INTEGER")
|
||||
.HasColumnName("compliance_level_rank");
|
||||
.HasColumnName("confidence_level_rank");
|
||||
|
||||
entity.Property<DateTimeOffset>("CreationUtc")
|
||||
.HasConversion(utcDateTimeOffsetConverter)
|
||||
@@ -135,8 +135,8 @@ partial class EmbeddingStateDbContextModelSnapshot : ModelSnapshot
|
||||
entity.HasIndex("AbsolutePath")
|
||||
.HasDatabaseName("idx_embedded_files_absolute_path");
|
||||
|
||||
entity.HasIndex("ComplianceLevelRank")
|
||||
.HasDatabaseName("idx_embedded_files_compliance");
|
||||
entity.HasIndex("ConfidenceLevelRank")
|
||||
.HasDatabaseName("idx_embedded_files_confidence");
|
||||
|
||||
entity.HasIndex("DataSourceId")
|
||||
.HasDatabaseName("idx_embedded_files_data_source");
|
||||
@@ -226,11 +226,11 @@ partial class EmbeddingStateDbContextModelSnapshot : ModelSnapshot
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
entity.Property<string>("ComplianceLevel")
|
||||
entity.Property<string>("ConfidenceLevel")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
entity.Property<int>("ComplianceLevelRank")
|
||||
entity.Property<int>("ConfidenceLevelRank")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
entity.Property<DateTimeOffset>("CreationUtc")
|
||||
|
||||
+6
-6
@@ -268,8 +268,8 @@ public sealed class SqliteEmbeddingStateClientImplementation(
|
||||
f.last_write_utc AS LastWriteUtc,
|
||||
c.embedded_at_utc AS EmbeddedAtUtc,
|
||||
f.chunk_count AS ChunkCount,
|
||||
f.compliance_level AS ComplianceLevel,
|
||||
f.compliance_level_rank AS ComplianceLevelRank
|
||||
f.confidence_level AS ConfidenceLevel,
|
||||
f.confidence_level_rank AS ConfidenceLevelRank
|
||||
FROM embedding_chunks_fts
|
||||
JOIN embedding_chunks c ON c.id = embedding_chunks_fts.rowid
|
||||
JOIN embedded_files f ON f.parent_file_id = c.parent_file_id
|
||||
@@ -359,8 +359,8 @@ public sealed class SqliteEmbeddingStateClientImplementation(
|
||||
fileEntity.LastWriteUtc = file.LastWriteUtc;
|
||||
fileEntity.EmbeddedAtUtc = file.EmbeddedAtUtc;
|
||||
fileEntity.ChunkCount = file.ChunkCount;
|
||||
fileEntity.ComplianceLevel = file.ComplianceLevel;
|
||||
fileEntity.ComplianceLevelRank = file.ComplianceLevelRank;
|
||||
fileEntity.ConfidenceLevel = file.ConfidenceLevel;
|
||||
fileEntity.ConfidenceLevelRank = file.ConfidenceLevelRank;
|
||||
}
|
||||
|
||||
private static void ApplyChunk(EmbeddingStateChunkEntity chunkEntity, EmbeddingStateChunk chunk)
|
||||
@@ -393,8 +393,8 @@ public sealed class SqliteEmbeddingStateClientImplementation(
|
||||
result.LastWriteUtc,
|
||||
result.EmbeddedAtUtc,
|
||||
result.ChunkCount,
|
||||
result.ComplianceLevel,
|
||||
result.ComplianceLevelRank);
|
||||
result.ConfidenceLevel,
|
||||
result.ConfidenceLevelRank);
|
||||
|
||||
private static string BuildFtsQuery(string query)
|
||||
{
|
||||
|
||||
@@ -20,5 +20,5 @@ public sealed record VectorSearchResult(
|
||||
string CreationUtc,
|
||||
string LastWriteUtc,
|
||||
string EmbeddedAtUtc,
|
||||
string ComplianceLevel,
|
||||
int ComplianceLevelRank);
|
||||
string ConfidenceLevel,
|
||||
int ConfidenceLevelRank);
|
||||
@@ -20,5 +20,5 @@ public sealed record VectorStoragePoint(
|
||||
DateTimeOffset CreationUtc,
|
||||
DateTimeOffset LastWriteUtc,
|
||||
DateTimeOffset EmbeddedAtUtc,
|
||||
string ComplianceLevel,
|
||||
int ComplianceLevelRank);
|
||||
string ConfidenceLevel,
|
||||
int ConfidenceLevelRank);
|
||||
Reference in new issue
Block a user