feat: autogen service — content_queue, autogen_settings, TOPIC_BANK, cron API
This commit is contained in:
@@ -70,7 +70,7 @@ async function getAllTags() {
|
||||
* Генерирует и сохраняет статью.
|
||||
* @param {object} opts - { topic, keywords, tags, autoPublish }
|
||||
*/
|
||||
async function generateAndSaveArticle({ topic, keywords = [], tags = [], autoPublish = true }) {
|
||||
async function generateAndSaveArticle({ topic, keywords = [], tags = [], autoPublish = true, category = 'ai-tools' }) {
|
||||
// job
|
||||
const { rows: jobRows } = await query(
|
||||
`INSERT INTO generation_jobs (type, topic, status) VALUES ('article',$1,'processing') RETURNING id`,
|
||||
@@ -116,11 +116,12 @@ async function generateAndSaveArticle({ topic, keywords = [], tags = [], autoPub
|
||||
const readingTime = estimateReadingTime(content);
|
||||
|
||||
const { rows: artRows } = await query(
|
||||
`INSERT INTO articles (slug, title, excerpt, content, tags, reading_time, status, job_id, seo_title, seo_descr)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10) RETURNING *`,
|
||||
`INSERT INTO articles (slug, title, excerpt, content, tags, category, reading_time, status, job_id, seo_title, seo_descr)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11) RETURNING *`,
|
||||
[
|
||||
slug, title, excerpt, content,
|
||||
JSON.stringify(tags),
|
||||
category,
|
||||
readingTime,
|
||||
autoPublish ? 'published' : 'draft',
|
||||
jobId,
|
||||
|
||||
Reference in New Issue
Block a user