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

Function read_local_pdf

deployments/desktop/shared/agents.py:2551–2591  ·  view source on GitHub ↗
(
    user_id: str,
    pdf_path: str,
    title: str = "",
    write_feishu: Optional[bool] = None,
    response_language: str = "zh",
)

Source from the content-addressed store, hash-verified

2549 "report_source_key": normalized_arxiv_id,
2550 "report_source_name": normalized_arxiv_id,
2551 "report_style": _configured_report_style(),
2552 "response_language": language,
2553 },
2554 )
2555 wiki_backfilled = _backfill_docs_to_wiki(user_id, docs)
2556 payload = _reports_payload(docs, write_feishu_requested=should_write_feishu)
2557 payload["wiki_backfilled"] = wiki_backfilled
2558 return payload
2559
2560
2561def read_local_pdf(
2562 user_id: str,
2563 pdf_path: str,
2564 title: str = "",
2565 write_feishu: Optional[bool] = None,
2566 response_language: str = "zh",
2567) -> Dict[str, Any]:
2568 path = Path(str(pdf_path or "")).expanduser()
2569 if not path.is_absolute():
2570 path = PROJECT_ROOT / path
2571 if not path.exists() or not path.is_file():
2572 raise ValueError(f"PDF not found: {path}")
2573
2574 paper = {
2575 "title": title.strip() or path.stem,
2576 "authors": [],
2577 "abstract": "",
2578 "source": "local_pdf",
2579 "pdf_path": str(path),
2580 "url": str(path),
2581 }
2582 should_write_feishu = _env_bool("PAPERFLOW_WRITE_FEISHU", default=False) if write_feishu is None else bool(write_feishu)
2583 language = _normalize_response_language(response_language)
2584 with _reading_agent_output_env_patch(), _local_only_feishu_doc_patch(not should_write_feishu):
2585 docs = reading_agent.create_reading_report(
2586 user_id=user_id,
2587 paper_ids=[],
2588 papers=[paper],
2589 send_to_feishu=should_write_feishu,
2590 request_metadata={
2591 "report_source_type": "desktop_pdf_path",
2592 "report_source_key": str(path),
2593 "report_source_name": path.name,
2594 "report_style": _configured_report_style(),

Callers

nothing calls this directly

Calls 8

_configured_report_styleFunction · 0.85
_backfill_docs_to_wikiFunction · 0.85
_reports_payloadFunction · 0.85
_env_boolFunction · 0.70
create_reading_reportMethod · 0.45

Tested by

no test coverage detected