(
*,
user_id: str,
push_id: str,
paper_numbers: Iterable[Any],
write_feishu: Optional[bool] = None,
response_language: str = "zh",
)
| 2751 | payload["wiki_backfilled"] = wiki_backfilled |
| 2752 | return payload |
| 2753 | |
| 2754 | |
| 2755 | def _reading_placeholder_path(user_id: str, paper: Dict[str, Any]) -> Path: |
| 2756 | with _reading_agent_output_env_patch(): |
| 2757 | target_dir = reading_agent._resolve_configured_dir( # noqa: SLF001 - shared storage contract |
| 2758 | "PAPERFLOW_READING_REPORTS_DIR", |
| 2759 | "data/exports", |
| 2760 | paper, |
| 2761 | user_id=user_id, |
| 2762 | category="reading_reports", |
| 2763 | ) |
| 2764 | target_dir.mkdir(parents=True, exist_ok=True) |
| 2765 | obsidian_report = target_dir.name.startswith("Deep Reading - ") |
| 2766 | stem = ( |
| 2767 | reading_agent._paper_title_file_stem(paper) # noqa: SLF001 |
| 2768 | if obsidian_report |
| 2769 | else f"{reading_agent._paper_file_stem(paper)} - reading-report" # noqa: SLF001 |
| 2770 | ) |
| 2771 | return target_dir / f"{stem}.md" |
| 2772 | |
| 2773 | |
| 2774 | def _write_reading_placeholder( |
| 2775 | *, |
| 2776 | user_id: str, |
| 2777 | paper: Dict[str, Any], |
| 2778 | report_path: Path, |
| 2779 | status: str, |
| 2780 | steps: Iterable[str], |
| 2781 | error: str = "", |
| 2782 | response_language: str = "zh", |
| 2783 | ) -> None: |
| 2784 | title = str(paper.get("title") or report_path.stem).strip() or report_path.stem |
| 2785 | now = datetime.now().isoformat(timespec="seconds") |
| 2786 | is_en = _normalize_response_language(response_language) == "en" |
| 2787 | status_title = "Reading in progress" if is_en else "正在精读中" |
| 2788 | if status == "failed": |
| 2789 | status_title = "Reading failed" if is_en else "精读失败" |
| 2790 | elif status == "queued": |
| 2791 | status_title = "Reading in progress" if is_en else "正在精读中" |
| 2792 | frontmatter = { |
| 2793 | "user_id": user_id, |
| 2794 | "paper_id": paper.get("id"), |
| 2795 | "arxiv_id": paper.get("arxiv_id"), |
| 2796 | "doi": paper.get("doi"), |
| 2797 | "title": title, |
| 2798 | "publish_date": paper.get("publish_date"), |
| 2799 | "pdf_url": paper.get("pdf_url"), |
| 2800 | "abs_url": paper.get("abs_url") or paper.get("paper_url") or paper.get("url"), |
| 2801 | "generation_provider": "paperflow", |
| 2802 | "generation_model": "background-reading-task", |
| 2803 | "report_version": "in-progress", |
| 2804 | "report_status": status, |
| 2805 | "saved_at": now, |
| 2806 | "updated_at": now, |
| 2807 | } |
| 2808 | lines = ["---"] |
| 2809 | for key, value in frontmatter.items(): |
| 2810 | if value not in (None, "", [], {}): |
no test coverage detected