Fixed embedding mismatch

This commit is contained in:
2026-03-18 22:12:18 +00:00
parent a7574d2a93
commit bec0f37623
4 changed files with 6 additions and 9 deletions

View File

@@ -34,7 +34,7 @@ public class ApplicationDbContext : IdentityDbContext<IdentityUser>
else else
{ {
entity.Property(r => r.Embedding) entity.Property(r => r.Embedding)
.HasColumnType("vector(1536)"); .HasColumnType("vector(768)");
} }
}); });
} }

View File

@@ -14,8 +14,8 @@ using Seasoned.Backend.Data;
namespace Seasoned.Backend.Migrations namespace Seasoned.Backend.Migrations
{ {
[DbContext(typeof(ApplicationDbContext))] [DbContext(typeof(ApplicationDbContext))]
[Migration("20260318201722_InitialCreateWith768Vector")] [Migration("20260318220841_FixEmbeddingDimensions")]
partial class InitialCreateWith768Vector partial class FixEmbeddingDimensions
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@@ -9,7 +9,7 @@ using Pgvector;
namespace Seasoned.Backend.Migrations namespace Seasoned.Backend.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class InitialCreateWith768Vector : Migration public partial class FixEmbeddingDimensions : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)

View File

@@ -40,10 +40,8 @@ public class RecipeService : IRecipeService
{ {
return new RecipeResponseDto { Title = "Error: No image provided" }; return new RecipeResponseDto { Title = "Error: No image provided" };
} }
var googleAI = new GoogleAI(_apiKey);
var model = googleAI.GenerativeModel("gemini-3.1-flash-lite-preview"); var model = _googleAI.GenerativeModel("gemini-3.1-flash-lite-preview");
using var ms = new MemoryStream(); using var ms = new MemoryStream();
await image.CopyToAsync(ms); await image.CopyToAsync(ms);
@@ -100,8 +98,7 @@ public class RecipeService : IRecipeService
public async Task<ChefConsultResponseDto> ConsultChefAsync(string userPrompt) public async Task<ChefConsultResponseDto> ConsultChefAsync(string userPrompt)
{ {
var googleAI = new GoogleAI(_apiKey); var model = _googleAI.GenerativeModel("gemini-3.1-flash-lite-preview");
var model = googleAI.GenerativeModel("gemini-3.1-flash-lite-preview");
var systemPrompt = @"You are the 'Seasoned' Head Chef, a master of real-world culinary arts. var systemPrompt = @"You are the 'Seasoned' Head Chef, a master of real-world culinary arts.
You operate a professional kitchen and only provide advice that can be used in a real kitchen. You operate a professional kitchen and only provide advice that can be used in a real kitchen.