@@ -11,13 +11,13 @@ import fetch from 'node-fetch';
1111import fs from 'node:fs' ;
1212import path from 'node:path' ;
1313import TurndownService from 'turndown' ;
14- import { ArticleMetadata , ExternalCitation } from '../parsers/shared/types' ;
1514import { parseMarkdownStructuredArticle } from '../parsers/grok' ;
15+ import { ArticleMetadata , ExternalCitation } from '../parsers/shared/types' ;
1616import { parseWikiArticle } from '../parsers/wiki' ;
1717import { paths } from '../shared/paths' ;
1818import { loadTopics , selectTopics , Topic } from '../shared/topics' ;
1919
20- export type FetchSource = 'wiki' | 'grok' ;
20+ export type FetchSource = 'wiki' | 'grok' | 'both' ;
2121
2222const WIKI_BASE_URL = 'https://en.wikipedia.org' ;
2323const WIKI_API = `${ WIKI_BASE_URL } /w/api.php` ;
@@ -368,17 +368,17 @@ const fetchGrok = async (topic: Topic): Promise<void> => {
368368 console . log ( `[grok] saved ${ topic . id } -> ${ target } ` ) ;
369369} ;
370370
371- export const runFetchWorkflow = async (
372- source : 'wiki' | 'grok' ,
373- topicId ?: string ,
374- ) : Promise < void > => {
371+ export const runFetchWorkflow = async ( source : FetchSource , topicId ?: string ) : Promise < void > => {
375372 const topics = loadTopics ( ) ;
376373 const selection = selectTopics ( topics , topicId ) ;
377374 for ( const topic of selection ) {
378375 try {
379376 if ( source === 'wiki' ) {
380377 await fetchWiki ( topic ) ;
381- } else {
378+ } else if ( source === 'grok' ) {
379+ await fetchGrok ( topic ) ;
380+ } else if ( source === 'both' ) {
381+ await fetchWiki ( topic ) ;
382382 await fetchGrok ( topic ) ;
383383 }
384384 } catch ( error ) {
0 commit comments