feat: customPrompt piped through full generation chain

- generatePost: customPrompt или channel.ai_style_prompt → добавляется к userPrompt
- routes/generate.js: принимает customPrompt, передаёт в очередь
- workers/generation.js: передаёт customPrompt в generatePost и generateArticle
This commit is contained in:
Ник (Claude)
2026-06-11 15:15:22 +03:00
parent 1ef770b5fc
commit 08086650fc
3 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ const generationQueue = require('../workers/generation');
// POST /api/generate — создать задачу генерации
router.post('/', async (req, res) => {
try {
const { type, topic, channelId, rubric, keywords = [], useCritique = true } = req.body;
const { type, topic, channelId, rubric, keywords = [], useCritique = true, customPrompt } = req.body;
const userId = req.headers['x-user-id'] || null;
if (!type) return res.status(400).json({ error: 'type is required' });
@@ -22,7 +22,7 @@ router.post('/', async (req, res) => {
);
const jobId = rows[0].id;
await generationQueue.add({ jobId, type, topic, channelId, rubric, keywords, useCritique });
await generationQueue.add({ jobId, type, topic, channelId, rubric, keywords, useCritique, customPrompt });
res.json({ jobId, status: 'pending' });
} catch (err) {