处理反馈
(self, reply: str)
| 1716 | return {"success": False, "message": str(e)} |
| 1717 | |
| 1718 | def handle_feedback(self, reply: str) -> Dict[str, Any]: |
| 1719 | """处理反馈""" |
| 1720 | print(f"Intent: Feedback - {reply!r}") |
| 1721 | |
| 1722 | # 从数据库获取最近的推送记录 |
| 1723 | push_info = get_latest_push(self.user_id) |
| 1724 | |
| 1725 | if not push_info: |
| 1726 | # 如果没有推送记录,使用测试数据 |
| 1727 | print("Warning: No recent push found, using test data") |
| 1728 | test_papers = [ |
| 1729 | {"id": i+1, "arxiv_id": f"2401.{i:03d}", "title": f"Paper {i+1}"} |
| 1730 | for i in range(20) |
| 1731 | ] |
| 1732 | papers = test_papers |
| 1733 | push_id = f"test_{datetime.now().strftime('%Y%m%d_%H%M%S')}" |
| 1734 | else: |
| 1735 | print(f"Using papers from push: {push_info['push_id']}") |
| 1736 | papers = push_info['papers'] |
| 1737 | push_id = push_info['push_id'] |
| 1738 | |
| 1739 | try: |
| 1740 | feedback_agent = importlib.import_module("agents.feedback-agent.main") |
| 1741 | |
| 1742 | result = feedback_agent.process_feedback( |
| 1743 | user_id=self.user_id, |
| 1744 | push_id=push_id, |
| 1745 | reply=reply, |
| 1746 | papers=papers, |
| 1747 | feishu_user_id=self.feishu_user_id, |
| 1748 | chat_id=self.chat_id, |
| 1749 | send_to_feishu=self.send_to_feishu, |
| 1750 | ) |
| 1751 | return result |
| 1752 | except Exception as e: |
| 1753 | return {"success": False, "message": str(e)} |
| 1754 | |
| 1755 | def handle_reading_report( |
| 1756 | self, |
no test coverage detected