Files
2026-08-20 16:00:01 +08:00

4.2 KiB

wewrite-nanobot

微信公众号文章全流程 AI Skill for nanobot

功能特性

  • ✅ 热点抓取: 微博 + 头条 + 百度实时热搜
  • ✅ AI 选题: 根据热点生成 10 个选题建议
  • ✅ 文章写作: 基于客户风格自动生成文章框架
  • ✅ SEO 优化: 自动生成摘要、标签、备选标题
  • ✅ 微信排版: Markdown → 微信内联样式 HTML
  • ✅ 草稿箱推送: 一键推送到微信公众号

快速开始

1. 基础配置(已完成)

配置文件: /home/ubuntu/wewrite/config.yaml

wechat:
  appid: "wx5716fcd6b95dfa05"
  secret: "已配置"
  
image:
  provider: "doubao"
  api_key: "已配置"

2. 创建客户配置

# 复制示例配置
mkdir -p ~/wewrite/clients/myclient
cp ~/wewrite/clients/demo/style.yaml ~/wewrite/clients/myclient/

# 编辑配置
nano ~/wewrite/clients/myclient/style.yaml

3. 撰写文章

方式一:指定主题(推荐)

cd ~/wewrite && python3 wewrite_cli.py write --client nanobot --topic "AI技术趋势"

方式二:从热点抓取选题

cd ~/wewrite && python3 wewrite_cli.py write --client nanobot

方式三:交互模式(自己选择选题)

cd ~/wewrite && python3 wewrite_cli.py write --client nanobot --interactive

4. 排版预览

cd ~/wewrite && python3 wewrite_cli.py preview output/nanobot/文章.md --theme professional-clean

5. 发布到微信草稿箱

cd ~/wewrite && python3 wewrite_cli.py publish output/nanobot/文章.md --title "最终标题"

命令详解

write - 撰写文章

python3 wewrite_cli.py write [选项]

选项:
  --client, -c    客户名称(必需)
  --topic, -t     指定主题(可选,默认从热点抓取)
  --interactive, -i   交互模式,手动选择选题
  --publish, -p   完成后直接发布到微信
  --cover         封面图片路径

preview - 排版预览

python3 wewrite_cli.py preview 文件.md [选项]

选项:
  --theme, -t     排版主题
                  可选: professional-clean, tech-modern, warm-editorial, minimal

publish - 发布到微信

python3 wewrite_cli.py publish 文件.md [选项]

选项:
  --title, -t     文章标题(必需)
  --cover, -c     封面图片路径

底层发布入口(可直接调用,效果等同 wewrite_cli.py publish): python3 /home/ubuntu/wewrite/toolkit/cli.py publish <md> --cover <封面图> --title <标题>

完整示例

# 1. 进入 wewrite 目录
cd ~/wewrite

# 2. 基于热点写一篇文章
python3 wewrite_cli.py write --client nanobot --interactive

# 3. 查看生成的文章
cat output/nanobot/20260328_*.md

# 4. 排版预览
python3 wewrite_cli.py preview output/nanobot/20260328_*.md --theme tech-modern

# 5. 发布到微信草稿箱
python3 wewrite_cli.py publish output/nanobot/20260328_*.md --title "最终标题"

客户配置说明

编辑 ~/wewrite/clients/{客户名}/style.yaml:

name: "客户名称"
industry: "行业"
target_audience: "目标读者"

topics:
  - AI/人工智能
  - 编程开发
  
tone: "写作语气"
voice: "人称视角"
content_style: "干货"  # 干货/故事/情绪/热点/测评

blacklist:
  words: ["震惊", "必看"]
  topics: ["政治敏感"]

theme: "professional-clean"
author: "署名"

注意事项

  1. 图片生成需要在火山引擎控制台激活 doubao-seedream 模型
  2. 微信发布需要确保公众号有草稿箱权限
  3. 热点抓取依赖网络,失败时可手动指定主题

项目结构

~/wewrite/
├── config.yaml          # 主配置
├── wewrite_cli.py       # CLI 入口
├── scripts/             # 脚本工具
│   ├── fetch_hotspots.py    # 热点抓取
│   └── seo_keywords.py      # SEO分析
├── toolkit/             # 工具链
│   ├── cli.py              # 微信排版/发布
│   └── themes/             # 排版主题
├── clients/             # 客户配置
│   └── nanobot/
│       ├── style.yaml      # 风格配置
│       └── history.yaml    # 历史记录
└── output/              # 输出目录
    └── nanobot/          # 客户输出