feat: custom prompt for articles + HD image quality per channel

- ai.js: generateArticle принимает customPrompt (от юзера) или channel.ai_style_prompt
- articles.js + routes/articles.js: проброс customPrompt через цепочку
- postImages.js: channel.image_quality='hd' → gpt-5.4-image-2+medium, иначе gpt-5-image-mini+low
- aiUsage.js: правильные цены routerai (RUB/token), gpt-5-image-mini и gpt-5.4-image-2
- channels.js: updateChannel сохраняет ai_style_prompt и image_quality
- DB: channels.ai_style_prompt TEXT, channels.image_quality VARCHAR(16) DEFAULT standard
This commit is contained in:
Ник (Claude)
2026-06-11 15:11:18 +03:00
parent e6c192e806
commit 1ef770b5fc
6 changed files with 42 additions and 11 deletions
+2 -2
View File
@@ -116,9 +116,9 @@ router.get('/id/:id', async (req, res) => {
// POST /api/articles/generate
router.post('/generate', async (req, res) => {
try {
const { topic, keywords = [], tags = [], autoPublish: autoPub = true, category = 'ai-tools' } = req.body;
const { topic, keywords = [], tags = [], autoPublish: autoPub = true, category = 'ai-tools', customPrompt } = req.body;
if (!topic) return res.status(400).json({ error: 'topic is required' });
const article = await articlesSvc.generateAndSaveArticle({ topic, keywords, tags, autoPublish: autoPub, category });
const article = await articlesSvc.generateAndSaveArticle({ topic, keywords, tags, autoPublish: autoPub, category, customPrompt });
// Hook: автопубликация в каналы
if (article && article.status === 'published') {
autoPublish.scheduleForArticle(article.id).catch(err => {