创建精读报告 Args: user_id: 用户 ID paper_ids: 选中的论文编号列表 papers: 论文列表 folder_id: 飞书文件夹 ID(可选) send_to_feishu: 是否发送飞书通知 feishu_user_id: 飞书用户 ID chat_id: 聊天 ID(优先使用,发送到原对话框) Returns: 创建的文档信息列表
(
user_id: str,
paper_ids: List[int],
papers: List[Dict],
folder_id: Optional[str] = None,
send_to_feishu: bool = True,
feishu_user_id: Optional[str] = None,
chat_id: Optional[str] = None
)
| 4638 | |
| 4639 | |
| 4640 | def _legacy_create_reading_report( |
| 4641 | user_id: str, |
| 4642 | paper_ids: List[int], |
| 4643 | papers: List[Dict], |
| 4644 | folder_id: Optional[str] = None, |
| 4645 | send_to_feishu: bool = True, |
| 4646 | feishu_user_id: Optional[str] = None, |
| 4647 | chat_id: Optional[str] = None |
| 4648 | ) -> List[Dict[str, Any]]: |
| 4649 | """ |
| 4650 | 创建精读报告 |
| 4651 | |
| 4652 | Args: |
| 4653 | user_id: 用户 ID |
| 4654 | paper_ids: 选中的论文编号列表 |
| 4655 | papers: 论文列表 |
| 4656 | folder_id: 飞书文件夹 ID(可选) |
| 4657 | send_to_feishu: 是否发送飞书通知 |
| 4658 | feishu_user_id: 飞书用户 ID |
| 4659 | chat_id: 聊天 ID(优先使用,发送到原对话框) |
| 4660 | |
| 4661 | Returns: |
| 4662 | 创建的文档信息列表 |
| 4663 | """ |
| 4664 | print(f"Creating reading reports for user: {user_id}") |
| 4665 | print(f"Selected papers: {paper_ids}") |
| 4666 | |
| 4667 | # 优先使用 chat_id,否则使用 feishu_user_id |
| 4668 | target_id = chat_id or feishu_user_id |
| 4669 | use_chat_id = chat_id is not None |
| 4670 | |
| 4671 | # 获取用户画像 |
| 4672 | profile = get_profile(user_id) |
| 4673 | if not profile: |
| 4674 | print(f"Warning: No profile found for user {user_id}, using default") |
| 4675 | profile = {"core_directions": {}} |
| 4676 | |
| 4677 | # 获取选中的论文 |
| 4678 | selected_papers = resolve_selected_papers(paper_ids, papers) |
| 4679 | |
| 4680 | if not selected_papers: |
| 4681 | print("No valid papers selected") |
| 4682 | if send_to_feishu and target_id: |
| 4683 | send_text( |
| 4684 | target_id, |
| 4685 | "这次没有找到可生成精读的论文,请先推送后回复编号,或重新发送“精读”。", |
| 4686 | use_chat_id=use_chat_id, |
| 4687 | ) |
| 4688 | return [] |
| 4689 | |
| 4690 | # 为每篇论文创建报告 |
| 4691 | created_docs = [] |
| 4692 | |
| 4693 | for i, paper in enumerate(selected_papers): |
| 4694 | print(f"\n[{i+1}/{len(selected_papers)}] Processing: {paper.get('title', 'Unknown')[:50]}...") |
| 4695 | |
| 4696 | # 生成报告内容 |
| 4697 | report_content = generate_reading_report(paper, profile) |
nothing calls this directly
no test coverage detected