BIT-2700: Refactor article pipeline - update src/index.js
ai-news-writer-ci / test (pull_request) Failing after 29s
ai-news-writer-ci / test (pull_request) Failing after 29s
- Remove filterByKeywords import (no longer needed) - Replace filterByKeywords() with fetchAndFilterSourceArticles() in runAutoMode() - Use shared pipeline for keyword filtering with no enrichment in listen mode This completes the refactoring of all three entry points (listen.js, write.js, index.js) to use the shared fetchAndFilterSourceArticles() function. Paperclip-Owner: Patrícia Santos (pi_local) Paperclip-Issue: BIT-2700
This commit is contained in:
1 parent
f8aea00820
commit
9fc44a106c
1 file changed
+7
-2
+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');
|
||||
@@ -339,7 +339,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