Choose enclosed attachments before generating; drop instant-generate

The generate form now lets the user pick which extra attachments
(basis_anhaenge) to enclose — none selected by default. Only the chosen
ones are attached, and their names are passed to the LLM so the cover
letter's "Anlagen" list and wording reflect exactly what is enclosed.

Job offers keep only "Als Bewerbung übernehmen" (draft first); the
"Übernehmen & KI-Unterlagen" button and its route are removed.

REST API: POST /applications/:id/generate accepts an optional `anlagen`
array of attachment IDs (Swagger updated).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 17:36:14 +02:00
co-authored by Claude Opus 4.8
parent 360e04d677
commit 26872ece08
6 changed files with 77 additions and 43 deletions
+6 -1
View File
@@ -387,7 +387,12 @@ function createExternalApi(deps) {
[id]
);
runGeneration(id);
// Optional: IDs of static attachments (basis_anhaenge) to enclose; none
// by default. Also reflected in the cover letter's "Anlagen" list.
const anlagenIds = Array.isArray((req.body || {}).anlagen)
? req.body.anlagen.map((v) => parseInt(v, 10)).filter((n) => !Number.isNaN(n))
: [];
runGeneration(id, { anlagenIds });
res.status(202).json({ success: true });
} catch (error) {
console.error('API generate error:', error);