Merge pull request 'BIT-2700: Refactor / dívida técnica incremental' (#9) from BIT-2700-refactor-article-pipeline into main
ai-news-writer-ci / test (push) Successful in 1m4s
ai-news-writer-ci / test (push) Successful in 1m4s
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
commit
21e0f3fa08
4 files changed
+19
-562
No files matched your search
Generated
-557
File diff suppressed because it is too large.
Load diff
+7
-2
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const logger = require('../logger');
|
||||
const { filterByKeywords } = require('../crawler/rss');
|
||||
const { fetchAndFilterSourceArticles } = require('../pipeline/source-articles');
|
||||
const { detectTopics, generateArticle } = require('../writer/ai');
|
||||
const { publishToWordPress } = require('../publisher/wordpress');
|
||||
const { startRSSListener } = require('../listener/rss-listener');
|
||||
@@ -53,7 +53,12 @@ async function runAutoMode() {
|
||||
const top_topic = topics[0];
|
||||
logger.info(`Top topic: "${top_topic.topic}" — ${top_topic.reason}`);
|
||||
|
||||
const relevant = filterByKeywords(new_articles, top_topic.keywords || []);
|
||||
// Use shared pipeline for keyword filtering (no enrichment in listen mode)
|
||||
const relevant = await fetchAndFilterSourceArticles(sources_config, {
|
||||
filterMode: 'keyword',
|
||||
keywords: top_topic.keywords || sources_config.keywords,
|
||||
enrichCount: 0
|
||||
});
|
||||
const sources = relevant.length > 0 ? relevant : new_articles.slice(0, 5);
|
||||
|
||||
const voice = resolveWritingParams(site);
|
||||
|
||||
+5
-1
@@ -34,12 +34,16 @@ async function runManualWrite(topic) {
|
||||
|
||||
// Fetch, filter, and enrich articles using shared pipeline
|
||||
const enriched_sources = await fetchAndFilterSourceArticles(sources_config, {
|
||||
filterMode: 'topic',
|
||||
filterMode: topic ? 'topic' : 'none',
|
||||
topic: topic || null,
|
||||
topicLimit: 10,
|
||||
enrichCount: 3
|
||||
});
|
||||
|
||||
if (enriched_sources.length === 0) {
|
||||
logger.warn('No relevant source articles found — proceeding with top headlines');
|
||||
}
|
||||
|
||||
const voice = resolveWritingParams(site);
|
||||
const article = await generateArticle({
|
||||
topic: topic || enriched_sources[0]?.title || 'Latest sports news',
|
||||
|
||||
+7
-2
@@ -7,7 +7,7 @@ const { metrics } = require('./monitoring/metrics');
|
||||
const { installProcessDiagnostics } = require('./runtime/process-diagnostics');
|
||||
installProcessDiagnostics();
|
||||
|
||||
const { fetchFeedWithResult, filterByKeywords } = require('./crawler/rss');
|
||||
const { fetchFeedWithResult } = require('./crawler/rss');
|
||||
const { generateArticle, detectTopics } = require('./writer/ai');
|
||||
const { fetchAndFilterSourceArticles } = require('./pipeline/source-articles');
|
||||
const { publishToWordPress, testConnection } = require('./publisher/wordpress');
|
||||
@@ -410,7 +410,12 @@ async function runAutoMode() {
|
||||
const top_topic = topics[0];
|
||||
logger.info(`Top topic: "${top_topic.topic}" — ${top_topic.reason}`);
|
||||
|
||||
const relevant = filterByKeywords(new_articles, top_topic.keywords || []);
|
||||
// Use shared pipeline for keyword filtering (no enrichment in listen mode)
|
||||
const relevant = await fetchAndFilterSourceArticles(sources_config, {
|
||||
filterMode: 'keyword',
|
||||
keywords: top_topic.keywords || sources_config.keywords,
|
||||
enrichCount: 0
|
||||
});
|
||||
const sources = relevant.length > 0 ? relevant : new_articles.slice(0, 5);
|
||||
|
||||
const voice = resolveWritingParams(site);
|
||||
|
||||
Reference in new issue
Block a user