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