fix(cv): bind letter proposals to current sources and preserve document choices

This commit is contained in:
cesnimda
2026-10-26 03:44:37 +01:00
parent 8948c988e2
commit 8979244576
21 changed files with 816 additions and 32 deletions
+4 -1
View File
@@ -2,12 +2,13 @@ using JobTrackerApi.Data;
using JobTrackerApi.Models;
using JobTrackerApi.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Moq;
using Xunit;
namespace JobTrackerApi.Tests;
public sealed class AiWorkspaceTests
public sealed partial class AiWorkspaceTests
{
private sealed class FakeAi : ISummarizerService
{
@@ -16,6 +17,7 @@ public sealed class AiWorkspaceTests
public string? LastInstruction;
public string? ActualProvider;
public string? FallbackReason;
public Func<Task>? BeforeReturn;
// The source text the module assembled — what the prompt actually saw.
public string? LastText;
public Task<string?> SummarizeSectionAsync(string instruction, string text, int maxLength = 180, int minLength = 40)
@@ -34,6 +36,7 @@ public sealed class AiWorkspaceTests
CancellationToken cancellationToken = default)
{
var generated = await SummarizeSectionAsync(instruction, text, maxLength, minLength);
if (BeforeReturn is not null) await BeforeReturn();
return generated is null ? null : new AiGenerationResult(generated, ActualProvider, "test-model", FallbackReason,
FallbackReason is null ? "local_primary" : "external_fallback");
}