Add shared attachment context controls for AI job tools

This commit is contained in:
cesnimda
2026-03-23 22:30:54 +01:00
parent 6acd9f3e15
commit 05bc42c3d5
4 changed files with 59 additions and 35 deletions
@@ -1471,7 +1471,7 @@ namespace JobTrackerApi.Controllers
}
[HttpGet("{id:int}/candidate-fit")]
public async Task<ActionResult<CandidateFitDto>> GetCandidateFit([FromRoute] int id, CancellationToken cancellationToken)
public async Task<ActionResult<CandidateFitDto>> GetCandidateFit([FromRoute] int id, [FromQuery] string? attachmentIds, CancellationToken cancellationToken)
{
var job = await _db.JobApplications
.Include(j => j.Company)
@@ -1500,7 +1500,7 @@ namespace JobTrackerApi.Controllers
var strengths = jobTags.Where(tag => normalizedCv.Contains(tag.ToLowerInvariant())).Take(8).ToList();
var gaps = jobTags.Where(tag => !normalizedCv.Contains(tag.ToLowerInvariant())).Take(8).ToList();
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken);
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken, attachmentIds);
var jobContext = $@"Job title: {job.JobTitle}
Company: {job.Company?.Name}
Status: {job.Status}
@@ -1594,7 +1594,7 @@ Candidate CV/profile:
}
[HttpGet("{id:int}/focus-plan")]
public async Task<ActionResult<FocusPlanDto>> GetFocusPlan([FromRoute] int id, CancellationToken cancellationToken)
public async Task<ActionResult<FocusPlanDto>> GetFocusPlan([FromRoute] int id, [FromQuery] string? attachmentIds, CancellationToken cancellationToken)
{
var job = await _db.JobApplications
.Include(j => j.Company)
@@ -1623,7 +1623,7 @@ Candidate CV/profile:
var matchedTags = jobTags.Where(tag => normalizedCv.Contains(tag.ToLowerInvariant())).Take(5).ToList();
var missingTags = jobTags.Where(tag => !normalizedCv.Contains(tag.ToLowerInvariant())).Take(5).ToList();
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken);
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken, attachmentIds);
var context = $@"Job title: {job.JobTitle}
Company: {job.Company?.Name}
Status: {job.Status}
@@ -1675,14 +1675,15 @@ Candidate master CV:
}
[HttpGet("{id:int}/interview-prep")]
public async Task<ActionResult<InterviewPrepDto>> GetInterviewPrep([FromRoute] int id, CancellationToken cancellationToken)
public async Task<ActionResult<InterviewPrepDto>> GetInterviewPrep([FromRoute] int id, [FromQuery] string? attachmentIds, CancellationToken cancellationToken)
{
var job = await _db.JobApplications
.Include(j => j.Company)
.FirstOrDefaultAsync(j => j.Id == id, cancellationToken);
if (job is null) return NotFound();
var context = string.Join("\n\n", new[] { job.JobTitle, job.Company?.Name, job.Description, job.TranslatedDescription, job.Notes, job.ShortSummary }
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken, attachmentIds);
var context = string.Join("\n\n", new[] { job.JobTitle, job.Company?.Name, job.Description, job.TranslatedDescription, job.Notes, job.ShortSummary, attachmentContext?.Context }
.Where(x => !string.IsNullOrWhiteSpace(x)));
var tags = SkillTagger.Detect(context).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
var talkingPoints = tags.Take(4).Select(x => $"Describe a concrete example where you delivered results with {x}.").ToList();
@@ -2047,7 +2048,7 @@ Candidate master CV:
}
[HttpGet("{id:int}/followup-draft")]
public async Task<ActionResult<FollowUpDraftDto>> GetFollowUpDraft([FromRoute] int id, [FromQuery] string? mode, CancellationToken cancellationToken)
public async Task<ActionResult<FollowUpDraftDto>> GetFollowUpDraft([FromRoute] int id, [FromQuery] string? mode, [FromQuery] string? attachmentIds, CancellationToken cancellationToken)
{
var job = await _db.JobApplications
.AsNoTracking()
@@ -2083,7 +2084,7 @@ Candidate master CV:
: job.Status == "Rejected" ? "feedback-request"
: "post-apply")
: mode.Trim().ToLowerInvariant();
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken);
var attachmentContext = await BuildAttachmentContextAsync(id, cancellationToken, attachmentIds);
var aiContext = $@"Candidate name: {signerName}
Role: {job.JobTitle}
Company: {companyName}