mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
cdf8356e11
- Updated `Ask.razor` to change `PageNumber` to a nullable integer and added `IndexOnPage` to the `Citation` class. Adjusted regex for citation parsing. - Introduced `PageNumber` and `IndexOnPage` properties in `DocumentChunk.cs`, marking `Content` as required. - Modified migration files to reflect changes in `DocumentChunk` and `Document` entities. - Updated citation format in `ChatService.cs` to include `index-on-page` and adjusted document chunk text formatting. - Changed embedding generation method in `VectorSearchService.cs` and updated document chunk creation to include new properties.
67 lines
2.5 KiB
C#
67 lines
2.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SqlDatabaseVectorSearch.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Initial : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Documents",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
|
CreationDate = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Documents", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DocumentChunks",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
DocumentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
Index = table.Column<int>(type: "int", nullable: false),
|
|
PageNumber = table.Column<int>(type: "int", nullable: true),
|
|
IndexOnPage = table.Column<int>(type: "int", nullable: false),
|
|
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Embedding = table.Column<string>(type: "vector(1536)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DocumentChunks", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DocumentChunks_Documents",
|
|
column: x => x.DocumentId,
|
|
principalTable: "Documents",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DocumentChunks_DocumentId",
|
|
table: "DocumentChunks",
|
|
column: "DocumentId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DocumentChunks");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Documents");
|
|
}
|
|
}
|
|
}
|