执行每日推送 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 | |
| 1691 | |
| 1692 | def daily_push( |
| 1693 | user_id: str = "user_001", |
| 1694 | days: int = 1, |
| 1695 | arxiv_categories: List[str] = None, |
| 1696 | conferences: List[str] = None, |
| 1697 | journals: List[str] = None, |
| 1698 | semantic_queries: List[str] = None, |
| 1699 | custom_rss_urls: List[str] = None, |
| 1700 | enable_semantic_scholar: Optional[bool] = None, |
| 1701 | enable_custom_rss: Optional[bool] = None, |
| 1702 | limit_per_source: int = DEFAULT_LIMIT_PER_SOURCE, |
| 1703 | push_limit: Optional[int] = None, |
| 1704 | target_date: Optional[str] = None, |
| 1705 | output_file: str = None, |
| 1706 | send_to_feishu: bool = False, |
| 1707 | feishu_chat_id: str = None, # 飞书群 ID(可选,用于多角色) |
| 1708 | progress_callback: Optional[Callable[[Dict[str, Any]], None]] = None, |
| 1709 | ): |
| 1710 | """ |
| 1711 | 执行每日推送 |
| 1712 | |
| 1713 | Args: |
| 1714 | user_id: 用户 ID |
| 1715 | days: 抓取最近 N 天 |
| 1716 | arxiv_categories: arXiv 类别列表 |
| 1717 | conferences: 会议列表 |
| 1718 | journals: 期刊列表 |
| 1719 | limit_per_source: 每个数据源的最大论文数 |
| 1720 | push_limit: 最终推送推荐数量上限 |
| 1721 | output_file: 输出文件路径(可选) |
| 1722 | send_to_feishu: 是否发送到飞书 |
| 1723 | feishu_chat_id: 飞书群 ID(可选,用于多角色) |
| 1724 | """ |
| 1725 | print(f"Starting daily push for user: {user_id}") |
| 1726 | |
| 1727 | # 1. 读取用户画像 |
| 1728 | print("Loading user profile...") |
| 1729 | profile = get_profile(user_id) |
| 1730 | if profile is None: |
| 1731 | print(f"Profile missing for user {user_id}, attempting runtime bootstrap...") |
| 1732 | try: |
| 1733 | runtime_bootstrap = importlib.import_module("scripts.runtime_bootstrap") |
| 1734 | runtime_bootstrap.ensure_role_profiles(Path(PROJECT_ROOT)) |
| 1735 | profile = get_profile(user_id) |
| 1736 | except Exception as exc: |
| 1737 | print(f"Runtime bootstrap failed while repairing profile: {exc}") |
| 1738 | |
| 1739 | if profile is None: |
| 1740 | message = f"Profile not found for user {user_id}" |
| 1741 | print(f"Error: {message}") |
| 1742 | return {"success": False, "message": message} |
| 1743 | normalized_profile = ensure_profile_schema(profile) |
| 1744 | initialized_profile = drift_engine.initialize_hidden_anchor( |
| 1745 | normalized_profile, |
| 1746 | strategy_mode=drift_engine.STRATEGY_REAL_USER, |
| 1747 | ) |
| 1748 | if initialized_profile.get("drift_state") != profile.get("drift_state"): |
| 1749 | update_profile(user_id, initialized_profile) |
no test coverage detected