forked from admin/zeropost-engine
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:
+6
-2
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user