(docs: Iterable[Dict[str, Any]], *, write_feishu_requested: bool)
| 2849 | if doc.get("report_path") |
| 2850 | else "" |
| 2851 | ), |
| 2852 | "pdf_path": doc.get("pdf_path"), |
| 2853 | "paper": _paper_card(doc.get("paper") or {}, index + 1), |
| 2854 | "reused": bool(doc.get("reused")), |
| 2855 | "feishu_error": doc.get("feishu_error"), |
| 2856 | } |
| 2857 | for index, doc in enumerate(docs or []) |
| 2858 | ] |
| 2859 | |
| 2860 | |
| 2861 | def _reports_payload(docs: Iterable[Dict[str, Any]], *, write_feishu_requested: bool) -> Dict[str, Any]: |
| 2862 | created_docs = _doc_payloads(docs) |
| 2863 | feishu_errors = [ |
| 2864 | str(doc.get("feishu_error") or "").strip() |
| 2865 | for doc in created_docs |
| 2866 | if str(doc.get("feishu_error") or "").strip() |
| 2867 | ] |
| 2868 | feishu_warning = None |
| 2869 | if write_feishu_requested and feishu_errors: |
| 2870 | feishu_warning = ( |
| 2871 | "飞书文档发送失败,已保留本地 Markdown。" |
| 2872 | "请检查 FEISHU_CLI_CMD / lark-cli 登录状态,以及 FEISHU_APP_ID、FEISHU_APP_SECRET 等飞书环境变量。" |
| 2873 | f"错误:{feishu_errors[0]}" |
| 2874 | ) |
| 2875 | elif write_feishu_requested and created_docs and not any(doc.get("url") for doc in created_docs): |
| 2876 | feishu_warning = ( |
| 2877 | "未拿到飞书文档链接,已保留本地 Markdown。" |
| 2878 | "请检查飞书环境变量和 lark-cli 登录状态。" |
no test coverage detected