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
+6 -2
View File
@@ -119,11 +119,15 @@ async function image(prompt, options = {}) {
* @returns {object} {content, prompt, usage}
*/
async function generatePost(channel, opts = {}) {
const { topic, rubric = '', useCritique = true, returnPrompt = false } = opts;
const { topic, rubric = '', useCritique = true, returnPrompt = false, customPrompt } = opts;
if (!topic) throw new Error('topic is required');
const systemPrompt = pb.buildPostSystemPrompt(channel, rubric);
const userPrompt = `Напиши пост на тему: "${topic}"`;
const stylePrompt = customPrompt || channel?.ai_style_prompt || null;
let userPrompt = `Напиши пост на тему: "${topic}"`;
if (stylePrompt) {
userPrompt += `\n\n---\nДОПОЛНИТЕЛЬНЫЕ ИНСТРУКЦИИ (выполнить обязательно):\n${stylePrompt.trim()}`;
}
// Шаг 1: первичная генерация (с повышенной температурой для разнообразия)
const first = await chat(