feat: AI Notes 智能纪要链接自动获取与月记背景支持

- snooper_calendar.py: 新增 fetch_ai_notes_links(),优先从 AI Notes 会话获取纪要链接
  - 支持 docx/minutes 格式,不限制三级域名
  - 优先读本地缓存,本地无 topic 时从网络补充
  - 按链接类型区分匹配窗口:permission_change ±24h,finish_recording ±6h
  - 具体主题要求与日历事件标题匹配,通用主题(视频会议)允许匹配
  - 返回未匹配链接列表,供日报保留展示
- snooper_storage.py: 保存时从 content_data 提取 URL 和 topic 到 content
  - 递归遍历 bytes 提取 URL,避免 JSON 序列化丢失
  - 新增 _extract_links_with_topics() 同时提取 URL 和会议主题
- lark_snooper.py: 未匹配链接插入今日会议章节的相关智能纪要子章节
- snooper_monthly.py: 新增 load_previous_monthly_background(),支持前5个工作日读取上月月记
- tests/test_calendar.py: 适配 fetch_calendar_events 返回 tuple
This commit is contained in:
Benature
2026-11-21 20:29:55 +08:00
parent f53ca5b481
commit 5edd199da7
5 changed files with 519 additions and 8 deletions

View File

@ -353,6 +353,7 @@ def cmd_summarize(args):
)
calendar_events = []
calendar_error = None
unmatched_ai_notes = []
if not getattr(args, "no_calendar", False):
from snooper_calendar import (
CalendarError,
@ -360,12 +361,14 @@ def cmd_summarize(args):
resolve_calendar_links,
)
unmatched_ai_notes = []
try:
calendar_events = fetch_calendar_events(
calendar_events, unmatched_ai_notes = fetch_calendar_events(
LarkClient(LarkAuth()),
target_day,
tz,
meeting_links=resolve_calendar_links(config),
storage=storage,
)
except CalendarError as error:
calendar_error = str(error)
@ -406,6 +409,22 @@ def cmd_summarize(args):
)
content = format_followup_checkboxes(shorten_headings(content))
content = escape_obsidian_tags(content)
# Append unmatched AI Notes links within the meeting section
if unmatched_ai_notes:
lines = ["", "### 相关智能纪要", ""]
for link in unmatched_ai_notes:
topic = link.get("topic", "")
url = link["url"]
if topic:
lines.append(f"- [{topic}]({url})")
else:
lines.append(f"- {url}")
# Insert before the next major section (## 三、关键沟通与结论)
marker = "## 三、关键沟通与结论"
if marker in content:
content = content.replace(marker, "\n".join(lines) + "\n\n" + marker, 1)
else:
content += "\n".join(lines)
properties = {
"version": get_version(),
"model": model.rsplit("/", 1)[-1],