处理冷启动
(self, text: str)
| 1662 | return {"success": False, "message": str(e)} |
| 1663 | |
| 1664 | def handle_cold_start(self, text: str) -> Dict[str, Any]: |
| 1665 | """处理冷启动""" |
| 1666 | print("Intent: Cold Start") |
| 1667 | |
| 1668 | try: |
| 1669 | coldstart_agent = importlib.import_module("agents.coldstart-agent.main") |
| 1670 | explicit_command = detect_explicit_command_intent(text) |
| 1671 | scholar_url = extract_google_scholar_url(text) |
| 1672 | homepage_url = extract_homepage_url(text) |
| 1673 | natural_language = strip_bootstrap_urls(text) if (scholar_url or homepage_url) else text |
| 1674 | reset_existing = should_reset_existing_profile_for_cold_start(text) |
| 1675 | |
| 1676 | if explicit_command and explicit_command.get("intent") == "cold_start": |
| 1677 | if not scholar_url and not homepage_url: |
| 1678 | natural_language = ( |
| 1679 | self.role_meta.get("natural_language") |
| 1680 | or self.role_meta.get("bootstrap_summary") |
| 1681 | or self.role_meta.get("description") |
| 1682 | or "" |
| 1683 | ).strip() |
| 1684 | elif (scholar_url or homepage_url) and not natural_language: |
| 1685 | natural_language = None |
| 1686 | |
| 1687 | coldstart_agent.cold_start( |
| 1688 | user_id=self.user_id, |
| 1689 | natural_language=natural_language or None, |
| 1690 | scholar_url=scholar_url, |
| 1691 | homepage_url=homepage_url, |
| 1692 | reset_existing=reset_existing, |
| 1693 | send_to_feishu=self.send_to_feishu, |
| 1694 | feishu_user_id=self.feishu_user_id, |
| 1695 | chat_id=self.chat_id |
| 1696 | ) |
| 1697 | return {"success": True, "message": "冷启动完成"} |
| 1698 | except Exception as e: |
| 1699 | return {"success": False, "message": str(e)} |
| 1700 | |
| 1701 | def handle_daily_push(self) -> Dict[str, Any]: |
| 1702 | """处理每日推送""" |