(user_id: str, month: str, rows: List[Dict[str, Any]])
| 306 | |
| 307 | |
| 308 | def _render_topic_index(user_id: str, month: str, rows: List[Dict[str, Any]]) -> str: |
| 309 | topic_groups = _build_topic_groups(rows) |
| 310 | lines = [ |
| 311 | f"# Topic Index - {month}", |
| 312 | "", |
| 313 | f"用户:`{user_id}`", |
| 314 | "", |
| 315 | ] |
| 316 | if not topic_groups: |
| 317 | lines.append("暂无可索引主题。") |
| 318 | lines.append("") |
| 319 | return "\n".join(lines) |
| 320 | for topic, items in topic_groups.items(): |
| 321 | lines.extend([f"## {topic}", ""]) |
| 322 | for item in items: |
| 323 | link = item["links"] or item["title"] |
| 324 | lines.append(f"- {item['date']} · {link} · {item['title']}") |
| 325 | lines.append("") |
| 326 | return "\n".join(lines) |
| 327 | |
| 328 | |
| 329 | def export_monthly_report( |
no test coverage detected