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:
@@ -15,7 +15,7 @@ const generationQueue = new Queue('generation', {
|
||||
});
|
||||
|
||||
generationQueue.process(async (job) => {
|
||||
const { jobId, type, topic, channelId, rubric, keywords, useCritique } = job.data;
|
||||
const { jobId, type, topic, channelId, rubric, keywords, useCritique, customPrompt } = job.data;
|
||||
|
||||
await query(`UPDATE generation_jobs SET status='processing', updated_at=NOW() WHERE id=$1`, [jobId]);
|
||||
|
||||
@@ -28,12 +28,12 @@ generationQueue.process(async (job) => {
|
||||
|
||||
if (type === 'post') {
|
||||
if (!channel) throw new Error('Channel not found for post generation');
|
||||
const r = await ai.generatePost(channel, { topic, rubric, useCritique });
|
||||
const r = await ai.generatePost(channel, { topic, rubric, useCritique, customPrompt });
|
||||
resultText = r.content;
|
||||
usage = r.usage;
|
||||
|
||||
} else if (type === 'article') {
|
||||
const r = await ai.generateArticle(channel || { language: 'ru' }, { topic, keywords });
|
||||
const r = await ai.generateArticle(channel || { language: 'ru' }, { topic, keywords, customPrompt });
|
||||
resultText = r.content;
|
||||
usage = r.usage;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user