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

Function _daily_note_graph

deployments/desktop/shared/agents.py:3581–3715  ·  view source on GitHub ↗
(user_id: str, limit: int, *, scope: str = "latest", month: str = "")

Source from the content-addressed store, hash-verified

3579 "02": "Feb",
3580 "03": "Mar",
3581 "04": "Apr",
3582 "05": "May",
3583 "06": "Jun",
3584 "07": "Jul",
3585 "08": "Aug",
3586 "09": "Sept",
3587 "10": "Oct",
3588 "11": "Nov",
3589 "12": "Dec",
3590 }
3591 expected = f"Daily Note - {month_labels.get(month_number, '')} {year}.md"
3592 return [path for path in paths if path.name == expected]
3593 return [paths[-1]]
3594
3595
3596def _normalize_title_key(value: Any) -> str:
3597 return re.sub(r"\s+", " ", str(value or "").strip()).casefold()
3598
3599
3600def _extract_daily_note_summary(lines: List[str]) -> str:
3601 text = "\n".join(lines)
3602 match = re.search(r"-\s+\*\*(.*?)\*\*", text, flags=re.DOTALL)
3603 if match:
3604 return re.sub(r"\s+", " ", match.group(1)).strip()
3605 paragraphs = [
3606 re.sub(r"\s+", " ", line.strip("- ").strip()).strip()
3607 for line in lines
3608 if line.strip() and not line.strip().startswith("[[") and "paperflow:" not in line
3609 ]
3610 return "\n".join(paragraphs).strip()
3611
3612
3613def _parse_daily_note_entries(path: Path) -> List[Dict[str, str]]:
3614 try:
3615 lines = path.read_text(encoding="utf-8").splitlines()
3616 except OSError:
3617 return []
3618 entries: List[Dict[str, str]] = []
3619 current_topic = "未分类"
3620 index = 0
3621 while index < len(lines):
3622 line = lines[index].strip()
3623 if line.startswith("# ") and not line.startswith("## "):
3624 current_topic = line[2:].strip() or "未分类"
3625 index += 1
3626 continue
3627 if line.startswith("## "):
3628 title = line[3:].strip()
3629 body_lines: List[str] = []
3630 index += 1
3631 while index < len(lines) and not lines[index].startswith("## ") and not lines[index].startswith("# "):
3632 body_lines.append(lines[index])
3633 index += 1
3634 if title == "PaperFlow Summary":
3635 continue
3636 entries.append(
3637 {
3638 "topic": current_topic,

Callers 1

wiki_graphFunction · 0.85

Calls 10

add_nodeFunction · 0.85
_wiki_node_payloadFunction · 0.85
getMethod · 0.80
encodeMethod · 0.80
_normalize_title_keyFunction · 0.70

Tested by

no test coverage detected