Add focus plans and stage-aware follow-up drafting

This commit is contained in:
cesnimda
2026-03-23 22:04:39 +01:00
parent 19b0424ef3
commit 8db620e45b
8 changed files with 345 additions and 25 deletions
@@ -91,6 +91,34 @@ public sealed class ProfileCvController : ControllerBase
return Ok(new { imported = true, characters = text.Length });
}
[HttpPost("rebuild")]
public async Task<IActionResult> Rebuild()
{
var user = await _users.GetUserAsync(User);
if (user is null) return Unauthorized();
if (string.IsNullOrWhiteSpace(user.ProfileCvText)) return BadRequest("Add or import CV text before rebuilding it.");
var rebuilt = await _aiService.SummarizeSectionAsync(
"Rewrite this CV into a stronger master CV with clear sections such as Professional Summary, Core Skills, Experience Highlights, and Selected Achievements. Preserve only factual claims, avoid inventing employers or metrics, and make the output clean and ready for tailoring to job applications. Return only the rebuilt CV text.",
user.ProfileCvText,
2200,
700);
if (string.IsNullOrWhiteSpace(rebuilt))
{
return BadRequest("The AI service could not rebuild your CV text right now.");
}
user.ProfileCvText = rebuilt.Trim();
var result = await _users.UpdateAsync(user);
if (!result.Succeeded)
{
return BadRequest(string.Join("; ", result.Errors.Select(e => e.Description)));
}
return Ok(new { rebuilt = true, characters = user.ProfileCvText.Length, text = user.ProfileCvText });
}
[HttpPost("improve")]
public async Task<IActionResult> Improve()
{