()
| 72 | |
| 73 | |
| 74 | def main(): |
| 75 | print("=" * 60) |
| 76 | print("飞书反馈处理器 - 半自动模式") |
| 77 | print("=" * 60) |
| 78 | print() |
| 79 | |
| 80 | # 1. 获取用户 ID |
| 81 | user_id = input("用户 ID [默认:user_001]: ").strip() or "user_001" |
| 82 | |
| 83 | # 2. 加载今日推送 |
| 84 | print("\n加载今日推送...") |
| 85 | papers = load_today_push() |
| 86 | |
| 87 | if not papers: |
| 88 | print("未找到论文数据,退出") |
| 89 | return |
| 90 | |
| 91 | print(f"加载了 {len(papers)} 篇论文") |
| 92 | |
| 93 | # 3. 循环处理反馈 |
| 94 | print("\n" + "-" * 60) |
| 95 | print("请从飞书复制用户回复,粘贴到下方(输入 q 退出):") |
| 96 | print("支持格式:1 2 4 6 | 1-5 6 9 | 1,2,4,6") |
| 97 | print("-" * 60) |
| 98 | |
| 99 | while True: |
| 100 | print() |
| 101 | reply = input("回复:").strip() |
| 102 | |
| 103 | if reply.lower() in ('q', 'quit', 'exit'): |
| 104 | print("退出") |
| 105 | break |
| 106 | |
| 107 | if not reply: |
| 108 | continue |
| 109 | |
| 110 | # 解析回复 |
| 111 | selected = parse_user_reply(reply) |
| 112 | |
| 113 | if not selected: |
| 114 | print("未识别到有效编号,请重新输入") |
| 115 | continue |
| 116 | |
| 117 | print(f"选中论文编号:{sorted(selected)}") |
| 118 | |
| 119 | # 处理反馈 |
| 120 | push_id = f"manual_{datetime.now().strftime('%Y%m%d_%H%M%S')}" |
| 121 | |
| 122 | result = process_feedback( |
| 123 | user_id=user_id, |
| 124 | push_id=push_id, |
| 125 | reply=reply, |
| 126 | papers=papers, |
| 127 | feishu_user_id=None # 不发送飞书确认 |
| 128 | ) |
| 129 | |
| 130 | print(f"\n处理结果:") |
| 131 | print(f" 选中:{result.get('selected_count', 0)} 篇") |
no test coverage detected