Add guided CV builder controls
CI and Deploy / test (push) Failing after 0s
CI and Deploy / deploy (push) Has been skipped

This commit is contained in:
2026-04-20 21:22:31 +02:00
parent eea327e1f6
commit 657cb95a48
3 changed files with 59 additions and 6 deletions
@@ -109,6 +109,9 @@ public sealed class ProfileCvController : ControllerBase
public JsonElement? JobApplicationId { get; set; }
public string? TemplateId { get; set; }
public string? SourceText { get; set; }
public string? PromptBackground { get; set; }
public string? Tone { get; set; }
public string? Language { get; set; }
}
public sealed record ParseCvRequest(string? Text);
public sealed record CvTemplateDescriptor(string Id, string Title, string Tone, string AccentColor, string PreviewTagline, string PreviewSummary, List<string> PreviewBullets);
@@ -296,6 +299,9 @@ public sealed class ProfileCvController : ControllerBase
var style = string.IsNullOrWhiteSpace(request.Style) ? "ats-minimal" : request.Style.Trim();
var templateId = NormalizeTemplateId(request.TemplateId ?? style);
var targetRole = string.IsNullOrWhiteSpace(request.TargetRole) ? null : request.TargetRole.Trim();
var tone = string.IsNullOrWhiteSpace(request.Tone) ? null : request.Tone.Trim();
var language = string.IsNullOrWhiteSpace(request.Language) ? null : request.Language.Trim();
var promptBackground = string.IsNullOrWhiteSpace(request.PromptBackground) ? null : request.PromptBackground.Trim();
var jobApplicationId = ParseFlexibleNullableInt(request.JobApplicationId);
var jobContext = jobApplicationId.HasValue
? await _db.JobApplications
@@ -327,9 +333,12 @@ public sealed class ProfileCvController : ControllerBase
: effectiveTargetRole is not null
? $"Target role: {effectiveTargetRole}. Keep it broadly reusable but clearly aligned to that role family."
: "Keep it broadly reusable for future tailoring.";
var toneGuidance = tone is not null ? $"Tone guidance: {tone}." : "Tone guidance: confident, professional, concise, and factual.";
var languageGuidance = language is not null ? $"Write the CV in {language}." : "Write the CV in English unless the source clearly requires another language.";
var backgroundGuidance = promptBackground is not null ? $"Candidate background and emphasis: {promptBackground}" : string.Empty;
var subject = sectionName is null ? "this CV" : $"the '{sectionName}' section of this CV";
var instruction = $"Rewrite only {subject}. Preserve facts, avoid inventing employers, titles, qualifications, dates, locations, or metrics. Style guidance: {style}. Template direction: {templateGuidance}. {roleGuidance} Return only the rewritten text with clean headings and bullets when useful.";
var instruction = $"Rewrite only {subject}. Preserve facts, avoid inventing employers, titles, qualifications, dates, locations, salaries, or metrics. Style guidance: {style}. Template direction: {templateGuidance}. {roleGuidance} {toneGuidance} {languageGuidance} {backgroundGuidance} Return only the rewritten CV text with clean headings and strong bullet phrasing when useful.";
var rewritten = await _aiService.SummarizeSectionAsync(
instruction,
rewriteSource,