feat: 新增企微已推送新闻 link 去重缓存

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-09 11:33:26 +08:00
parent aff75141cb
commit ba8631c867
3 changed files with 117 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ def _cn_enabled() -> bool:
def _hours_window() -> int:
return max(1, env_int("DAILY_AI_NEWS_HOURS", 72))
return max(1, env_int("DAILY_AI_NEWS_HOURS", 24))
def _per_feed_limit() -> int:
@@ -497,7 +497,7 @@ def _format_news_section(
return lines
def prepare_wecom_news_items(news: dict[str, Any]) -> list[dict[str, Any]]:
def prepare_wecom_news_items(news: dict[str, Any], *, date_str: str | None = None) -> list[dict[str, Any]]:
if not news.get("enabled"):
return []
limit = _wecom_limit()
@@ -528,10 +528,14 @@ def prepare_wecom_news_items(news: dict[str, Any]) -> list[dict[str, Any]]:
"desc_short": _clean_text(item.get("summary", ""), 36),
}
)
if date_str:
from daily.news.pushed_links import filter_unpushed_items
items = filter_unpushed_items(items, date_str=date_str)
return items
def prepare_wecom_cn_news_items(news: dict[str, Any]) -> list[dict[str, Any]]:
def prepare_wecom_cn_news_items(news: dict[str, Any], *, date_str: str | None = None) -> list[dict[str, Any]]:
if not news.get("enabled"):
return []
limit = _wecom_cn_limit()
@@ -577,4 +581,8 @@ def prepare_wecom_cn_news_items(news: dict[str, Any]) -> list[dict[str, Any]]:
"desc_short": _clean_text(item.get("summary", ""), 36),
}
)
if date_str:
from daily.news.pushed_links import filter_unpushed_items
items = filter_unpushed_items(items, date_str=date_str)
return items