feat: 拆分 wecom_shown_keys 与 movement_baseline 历史层
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,6 +15,15 @@ logger = logging.getLogger(__name__)
|
||||
KeyFn = Callable[[dict[str, Any]], str]
|
||||
|
||||
|
||||
RECENT_BOARD_KEYS = (
|
||||
"skills_trending",
|
||||
"skills_hot",
|
||||
"github_trending",
|
||||
"github_emerging",
|
||||
"github_topic",
|
||||
)
|
||||
|
||||
|
||||
def compare_depth() -> int:
|
||||
return env_int("DAILY_DELTA_COMPARE_DEPTH", 15)
|
||||
|
||||
@@ -39,6 +48,23 @@ def _key_set(items: list[dict[str, Any]], key_fn: KeyFn, *, depth: int) -> set[s
|
||||
return {key_fn(item) for item in items[:depth] if key_fn(item)}
|
||||
|
||||
|
||||
def load_recent_board_keys(
|
||||
date_str: str,
|
||||
*,
|
||||
lookback_days: int | None = None,
|
||||
) -> dict[str, set[str]]:
|
||||
"""近 N 天各榜已展示过的 skill id / repo(不含当日,供补榜去重)。
|
||||
|
||||
委托 board_history.load_recent_shown_keys,只读 wecom_shown_keys,
|
||||
不读 movement_baseline。
|
||||
"""
|
||||
from daily.board_history import load_recent_shown_keys
|
||||
from daily.config import board_dedup_days
|
||||
|
||||
days = lookback_days if lookback_days is not None else board_dedup_days()
|
||||
return load_recent_shown_keys(date_str, lookback_days=days)
|
||||
|
||||
|
||||
def find_previous_data(date_str: str) -> tuple[str, dict[str, Any]] | None:
|
||||
"""查找最近一份早于 date_str 的 data.json。"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user