fix: styleName undefined when rubrics used in generateCover

This commit is contained in:
Ник (Claude)
2026-06-09 11:39:57 +03:00
parent 5576665c02
commit ad133027d0
+4 -2
View File
@@ -395,13 +395,15 @@ async function generateCover({ articleId, title, tags = [], channelId = null })
// Выбираем рубрику если они заданы // Выбираем рубрику если они заданы
let selectedRubric = null; let selectedRubric = null;
let styleName;
const rubrics = channelStyle?.image_rubrics; const rubrics = channelStyle?.image_rubrics;
if (Array.isArray(rubrics) && rubrics.length > 0) { if (Array.isArray(rubrics) && rubrics.length > 0) {
selectedRubric = await selectRubric({ title, tags, rubrics }); selectedRubric = await selectRubric({ title, tags, rubrics });
console.log(`[Cover] article=${articleId} channel=${channelId} rubric=${selectedRubric?.id}`); styleName = selectedRubric?.id || 'rubric';
console.log(`[Cover] article=${articleId} channel=${channelId} rubric=${styleName}`);
} else { } else {
const styleIdx = pickStyleIndex(articleId); const styleIdx = pickStyleIndex(articleId);
const styleName = channelStyle?.image_style || COVER_STYLES[styleIdx].name; styleName = channelStyle?.image_style || COVER_STYLES[styleIdx].name;
console.log(`[Cover] article=${articleId} channel=${channelId || 'none'} style=${styleName}`); console.log(`[Cover] article=${articleId} channel=${channelId || 'none'} style=${styleName}`);
} }