Skip to content

leafxuzm/follow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

follow — 邮件追踪 & AI 摘要工具

从 Gmail 拉取指定标签的邮件,送 AI 分析总结,生成 HTML 日报 + Obsidian 笔记。

功能

  • 邮件拉取: 通过 Gmail IMAP 按标签拉取前一天的邮件(标签由 Gmail 过滤规则自动归类)
  • AI 分析: 支持 DeepSeek / Anthropic Claude,按结构化模板输出日报
  • 去重: SQLite 缓存 message_id,重复运行不重复分析
  • 容错: 分析前先保存原始邮件到 raw/,API 失败可重试不丢数据
  • 输出:
    • 终端直接打印 AI 分析结果
    • output/report-YYYY-MM-DD.html — GitHub 风格暗色 HTML 报告
    • Obsidian vault .md 笔记(带 YAML frontmatter)
  • 特殊处理: 邮件截断保留头尾,确保 diff 不被切掉

快速开始

cd tool/follow

# 1. 创建虚拟环境
python3 -m venv venv
./venv/bin/pip install -r requirements.txt

# 2. 配置
cp config.example.yaml config.yaml
# 编辑 config.yaml,填入 Gmail App Password、DeepSeek/Anthropic API Key

# 3. 在 Gmail 网页端创建标签(如 "kernel"),设过滤规则自动打标签

# 4. 运行
./venv/bin/python follow.py

配置

gmail:
  email: "you@gmail.com"
  app_password: "xxxx xxxx xxxx xxxx"   # Gmail App Password
  label: "kernel"                        # Gmail 标签名(空字符串 = 拉取 INBOX)

ai:
  provider: "deepseek"                   # deepseek | anthropic
  api_key: "sk-..."
  model: "deepseek-chat"

output:
  dir: "./output"
  days: 1                                # 拉取最近 N 天
  max_emails: 200                        # 单次拉取上限

obsidian:
  enabled: true
  vault_dir: "/path/to/obsidian/vault"
  subdir: "path/within/vault"

evernote:
  enabled: false
  import_email: "xxx@m.evernote.com"
  notebook: "日报"

Gmail 标签配置

  1. Gmail → 左侧栏 → 创建新标签 kernel
  2. 搜索栏 → 主题填 PATCH,包含字词填 @vger.kernel.org
  3. 创建过滤器 → 贴上标签 kernel + 略过收件匣

命令行

./venv/bin/python follow.py              # 拉取前一天
./venv/bin/python follow.py --days 3     # 最近 3 天
./venv/bin/python follow.py --open       # 生成后在浏览器打开 HTML
./venv/bin/python follow.py --config prod.yaml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages