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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user