执行每日推送 Args: user_id: 用户 ID days: 抓取最近 N 天 arxiv_categories: arXiv 类别列表 conferences: 会议列表 journals: 期刊列表 limit_per_source: 每个数据源的最大论文数 push_limit: 最终推送推荐数量上限 output_file: 输出文件路径(可选) send_to_feishu: 是否发送到飞书 feis
(
user_id: str = "user_001",
days: int = 1,
arxiv_categories: List[str] = None,
conferences: List[str] = None,
journals: List[str] = None,
semantic_queries: List[str] = None,
custom_rss_urls: List[str] = None,
enable_semantic_scholar: Optional[bool] = None,
enable_custom_rss: Optional[bool] = None,
limit_per_source: int = DEFAULT_LIMIT_PER_SOURCE,
push_limit: Optional[int] = None,
target_date: Optional[str] = None,
output_file: str = None,
send_to_feishu: bool = False,
feishu_chat_id: str = None, # 飞书群 ID(可选,用于多角色)
progress_callback: Optional[Callable[[Dict[str, Any]], None]] = None,
)
| 1690 | for paper_with_score in items: |
| 1691 | global_count += 1 |
| 1692 | title = str(paper_with_score.paper.get("title", "Unknown") or "Unknown").strip() |
| 1693 | authors = paper_with_score.paper.get("authors", []) |
| 1694 | categories = paper_with_score.paper.get("categories", []) |
| 1695 | category_str = categories[0] if categories else "unknown" |
| 1696 | first_author = authors[0].split(",")[0].strip() if isinstance(authors, list) and authors else "" |
| 1697 | lines.append(f"{global_count:02d}. [{category_str}] {first_author} — {title}") |
| 1698 | lines.append("") |
| 1699 | |
| 1700 | lines.append("━━━━━━━━━━━━") |
| 1701 | lines.append("选择方式(任选):") |
| 1702 | lines.append(" 直接回复编号:1 2 4 6") |
| 1703 | lines.append(" 范围选择:1-5 8 10") |
| 1704 | lines.append(" 快捷命令:all lock / all red / none") |
| 1705 | return "\n".join(lines) |
| 1706 | |
| 1707 | |
| 1708 | def daily_push( |
| 1709 | user_id: str = "user_001", |
| 1710 | days: int = 1, |
| 1711 | arxiv_categories: List[str] = None, |
| 1712 | conferences: List[str] = None, |
| 1713 | journals: List[str] = None, |
| 1714 | semantic_queries: List[str] = None, |
| 1715 | custom_rss_urls: List[str] = None, |
| 1716 | enable_semantic_scholar: Optional[bool] = None, |
| 1717 | enable_custom_rss: Optional[bool] = None, |
| 1718 | limit_per_source: int = DEFAULT_LIMIT_PER_SOURCE, |
| 1719 | push_limit: Optional[int] = None, |
| 1720 | target_date: Optional[str] = None, |
| 1721 | output_file: str = None, |
| 1722 | send_to_feishu: bool = False, |
| 1723 | feishu_chat_id: str = None, # 飞书群 ID(可选,用于多角色) |
| 1724 | progress_callback: Optional[Callable[[Dict[str, Any]], None]] = None, |
| 1725 | ): |
| 1726 | """ |
| 1727 | 执行每日推送 |
| 1728 | |
| 1729 | Args: |
| 1730 | user_id: 用户 ID |
| 1731 | days: 抓取最近 N 天 |
| 1732 | arxiv_categories: arXiv 类别列表 |
| 1733 | conferences: 会议列表 |
| 1734 | journals: 期刊列表 |
| 1735 | limit_per_source: 每个数据源的最大论文数 |
| 1736 | push_limit: 最终推送推荐数量上限 |
| 1737 | output_file: 输出文件路径(可选) |
| 1738 | send_to_feishu: 是否发送到飞书 |
| 1739 | feishu_chat_id: 飞书群 ID(可选,用于多角色) |
| 1740 | """ |
| 1741 | print(f"Starting daily push for user: {user_id}") |
| 1742 | |
| 1743 | # 1. 读取用户画像 |
| 1744 | print("Loading user profile...") |
| 1745 | profile = get_profile(user_id) |
| 1746 | if profile is None: |
| 1747 | print(f"Profile missing for user {user_id}, attempting runtime bootstrap...") |
| 1748 | try: |
| 1749 | runtime_bootstrap = importlib.import_module("scripts.runtime_bootstrap") |
no test coverage detected