feat(ai): AI Workspace per job application — modules + append-only history
CI and Deploy / test (push) Failing after 1m52s
CI and Deploy / deploy (push) Has been skipped

Phase 5 backend. A unified AI Workspace for each application, orchestrating the
five suggestion modules through the existing ISummarizerService provider
abstraction and storing every generation as append-only history (AiInteraction)
so outputs can be reused, compared, and deleted — distinct from the existing
AiWorkspaceNote cache (one row, overwritten).

Modules (all suggestion-only, "never invent facts" guardrail, never mutate the
profile/variant/application): job-analysis, career-match, cover-letter (6 modes),
interview, application-review. Each builds a prompt from the job + master profile
text and returns markdown.

- Models/AiInteraction.cs + migration AddAiInteractions (verified on container)
- Services/AiWorkspaceService.cs (prompts, history, delete)
- Controllers/AiWorkspaceController.cs (/api/jobapplications/{id}/ai:
  generate, history, delete, modules+provider)
- 7 tests (store, history filter/order, delete, mode normalization, unknown
  module, empty output, tenant scoping); 306 backend green

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
cesnimda
2026-07-18 15:17:13 +02:00
parent 074c78a7ef
commit f299d7be7c
9 changed files with 2695 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
namespace JobTrackerApi.Models;
// Phase 5 — AI Career Assistant. Append-only history of every AI interaction for a job application.
// Unlike AiWorkspaceNote (one row per (owner, job, type), overwritten on regenerate — a cache), this
// keeps EVERY generation so the user can restore, compare, reuse, or delete past outputs. Suggestion
// only: an interaction never mutates the master profile, a CV variant, or the application itself.
// docs/architecture/ai-career-assistant.md.
public sealed class AiInteraction
{
public int Id { get; set; }
public string OwnerUserId { get; set; } = string.Empty;
public int JobApplicationId { get; set; }
public JobApplication? JobApplication { get; set; }
// job-analysis | career-match | cover-letter | interview | application-review
public string Module { get; set; } = string.Empty;
// Optional mode within a module (e.g. cover-letter: professional|friendly|short|detailed|modern|traditional).
public string? Mode { get; set; }
// Human label for the history list, e.g. "Cover letter · Professional".
public string Title { get; set; } = string.Empty;
// Resolved provider label at generation time (transparency for the history list).
public string Provider { get; set; } = string.Empty;
// The generated suggestion. { text: string, meta?: object } — text is markdown the UI renders;
// meta carries any structured extras (e.g. career-match percent).
public string ResultJson { get; set; } = string.Empty;
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}