MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _write_reading_placeholder

Function _write_reading_placeholder

deployments/desktop/shared/agents.py:2613–2658  ·  view source on GitHub ↗
(
    *,
    user_id: str,
    paper: Dict[str, Any],
    report_path: Path,
    status: str,
    steps: Iterable[str],
    error: str = "",
    response_language: str = "zh",
)

Source from the content-addressed store, hash-verified

2611 continue
2612 if result:
2613 doc["wiki_ingest"] = result
2614 backfilled += 1
2615 return backfilled
2616
2617
2618def create_reading_reports(
2619 *,
2620 user_id: str,
2621 push_id: str,
2622 paper_numbers: Iterable[Any],
2623 write_feishu: Optional[bool] = None,
2624 response_language: str = "zh",
2625) -> Dict[str, Any]:
2626 push = db_ops.get_push_papers(push_id)
2627 if not push or not push.get("papers"):
2628 raise ValueError(f"Push not found: {push_id}")
2629 papers = list(push["papers"])
2630 selected = _unique_ints(paper_numbers, maximum=len(papers))
2631 should_write_feishu = _env_bool("PAPERFLOW_WRITE_FEISHU", default=False) if write_feishu is None else bool(write_feishu)
2632 language = _normalize_response_language(response_language)
2633 if not selected:
2634 return _reports_payload([], write_feishu_requested=should_write_feishu)
2635
2636 with _reading_agent_output_env_patch(), _local_only_feishu_doc_patch(not should_write_feishu):
2637 docs = reading_agent.create_reading_report(
2638 user_id=user_id,
2639 paper_ids=selected,
2640 papers=papers,
2641 send_to_feishu=should_write_feishu,
2642 request_metadata={
2643 "selection_push_id": push_id,
2644 "report_source_type": "desktop_gui",
2645 "report_style": _configured_report_style(),
2646 "response_language": language,
2647 },
2648 )
2649
2650 wiki_backfilled = _backfill_docs_to_wiki(user_id, docs)
2651 payload = _reports_payload(docs, write_feishu_requested=should_write_feishu)
2652 payload["wiki_backfilled"] = wiki_backfilled
2653 return payload
2654
2655
2656def _normalize_arxiv_id(value: str) -> str:
2657 raw = str(value or "").strip()
2658 if not raw:
2659 raise ValueError("arxiv_id is required")
2660 raw = raw.removeprefix("https://arxiv.org/abs/").removeprefix("http://arxiv.org/abs/")
2661 raw = raw.removeprefix("https://arxiv.org/pdf/").removeprefix("http://arxiv.org/pdf/")

Callers 2

_finish_reading_taskFunction · 0.85

Calls 3

getMethod · 0.80
nowMethod · 0.80

Tested by

no test coverage detected