Refactor AI daily report pipeline

This commit is contained in:
Mimikko-zeus
2026-06-04 15:21:56 +08:00
parent 94e18ce22d
commit 5a98696255
64 changed files with 4778 additions and 1316 deletions

View File

@@ -0,0 +1,24 @@
from __future__ import annotations
from typing import Callable
from ai_daily_report.models import SourceConfig
from ai_daily_report.sources.aihot import fetch_aihot
from ai_daily_report.sources.juya import fetch_juya
from ai_daily_report.sources.rss import fetch_rss
SourceFetcher = Callable[[SourceConfig, str, Callable[[str, int], str]], list[dict]]
SOURCE_FETCHERS: dict[str, SourceFetcher] = {
"aihot": fetch_aihot,
"rss": fetch_rss,
"juya_rss": fetch_juya,
}
def get_source_fetcher(source_type: str) -> SourceFetcher:
if source_type not in SOURCE_FETCHERS:
raise KeyError(f"Unknown source type: {source_type}")
return SOURCE_FETCHERS[source_type]