(
*,
paper: Dict[str, Any],
report_payload: Dict[str, Any],
report_path: Path,
report_content: str,
)
| 2022 | |
| 2023 | def _daily_note_entry( |
| 2024 | *, |
| 2025 | paper: Dict[str, Any], |
| 2026 | report_payload: Dict[str, Any], |
| 2027 | report_path: Path, |
| 2028 | report_content: str, |
| 2029 | ) -> str: |
| 2030 | title = _clean_text(paper.get("title")) or report_path.stem |
| 2031 | marker_key = _clean_text(paper.get("arxiv_id") or paper.get("doi") or title) |
| 2032 | marker = f"<!-- paperflow:{hashlib.sha1(marker_key.encode('utf-8')).hexdigest()[:16]} -->" |
| 2033 | note_link = _obsidian_note_link(report_path) |
| 2034 | pdf_url = _clean_text(paper.get("pdf_url")) or _get_direct_pdf_url(paper) |
| 2035 | summary = _clean_text( |
| 2036 | _extract_report_answer(report_content, "总结一下论文的主要内容") |
| 2037 | or report_payload.get("paper_summary") |
| 2038 | or report_payload.get("one_sentence_summary") |
| 2039 | or report_payload.get("clean_abstract_summary") |
| 2040 | or paper.get("abstract") |
| 2041 | ) |
| 2042 | if len(summary) > 900: |
| 2043 | summary = summary[:900].rstrip() + "..." |
| 2044 | star = "⭐" if str(report_payload.get("recommendation_label") or "").lower() in {"highly_recommended", "must_read", "high_match"} else "" |
| 2045 | lines = [ |
| 2046 | marker, |
| 2047 | f"## {star}{title}".rstrip(), |
| 2048 | "", |
| 2049 | f"[[{note_link}|Deep Reading]]", |
| 2050 | ] |
| 2051 | if pdf_url: |
| 2052 | lines.extend(["", f"[{pdf_url}]({pdf_url})"]) |
| 2053 | if summary: |
| 2054 | lines.extend(["", f"- **{summary}**"]) |
| 2055 | return "\n".join(lines).rstrip() + "\n" |
| 2056 | |
| 2057 | |
| 2058 | def _extract_report_answer(report_content: str, question: str) -> str: |
| 2059 | text = str(report_content or "") |
no test coverage detected