Files
nexus/openclaw/yunce/n8n-content-pipeline-workflow.md

10 KiB
Raw Blame History

N8N 内容转化流水线工作流设计v4

用于AI 英文文章 → 中文公众号/X/视频 内容转化 工作流IDiOf32aOKvTjfTDSM 触发方式OpenClaw 通过 Webhook 调用 管理平台Mac mini 上的 n8n (https://n8n.ishenwei.online)


📋 工作流概述

当前活跃版本: v1 (xQDabttYmLaY8qtr) / v3 (tOGMiC6qOJPOY89E) 最新开发版本: v4 (iOf32aOKvTjfTDSM) — 未激活

OpenClaw (发现文章)
       ↓ (保存文件到 n8n-files 目录)
       ↓ (触发 Webhook)

┌─────────────────────────────────────────────────────────────┐
│  N8N 工作流 (v4): content-translation-pipeline-v4          │
│                                                              │
│  [Webhook] → [Read File] → [Extract Text] → [AI Agent]     │
│       ↓                              ↑ (DeepSeek)           │
│  [Convert to File] → [Write File] → [Send Telegram]         │
└─────────────────────────────────────────────────────────────┘

🔌 节点详细设计v4

节点 1Webhook Trigger

类型: Webhook 名称: Webhook Trigger Path /content-translation-v4 Method POST

接收数据格式:

{
  "note_name": "article-2026-03-29.md",
  "callback_url": "http://192.168.3.189:18789/webhook/yunce"
}

注意: v4 使用 note_name(文件名)而非 note_path,文件需预先上传到 n8n 容器的 /home/node/.n8n-files/ 目录。


节点 2Read Obsidian Note

类型: Read Binary File 名称: Read Obsidian Note

配置:

  • File Path: =/home/node/.n8n-files/{{ $json.body.note_name }}
  • n8n 容器内文件路径: /home/node/.n8n-files/

输出: 二进制文件数据,传递给 Extract from File 节点


节点 3Extract from File

类型: Extract from File 名称: Extract from File Operation text

功能: 从二进制文件提取文本内容

输出变量:

  • original_content(原文内容)
  • note_name(文件名)
  • callback_url(回调地址)

节点 4DeepSeek Chat Model

类型: LM Chat DeepSeek 名称: DeepSeek Chat Model

配置:

  • Model: deepseek-chat
  • Credentials: DeepSeek account(在 n8n 中配置)

连接: → AI Agent作为 languageModel 输入)


节点 5AI Agent

类型: LangChain Agent 名称: AI Agent Version 3.1

Prompt 模板:

你是一个专业的中文内容编辑,擅长将英文文章转化为适合中国读者的高质量内容。

## 你的任务

将以下英文原文转化为:
1. 公众号风格的深度文章2000-3000字
2. X/Twitter 风格的短文案280字内带钩子
3. 视频口播脚本3-5分钟适合抖音/YouTube

## 内容要求

- 语言:地道中文,无翻译腔
- 风格:专业、有干货、适合中国读者
- 调性公众号大V风格有观点有案例
- 商业化:可自然植入 AI Agent / 知识管理相关内容(软性,不硬广)

## 文章主题方向(供校准时参考)
- AI Agent 落地实践与工具推荐
- AI 赋能商业的最佳实践
- AI 时代的网络安全与运维

## 输出格式(严格按此 JSON 返回)

{
  "wechat_title": "中文标题",
  "wechat_excerpt": "公众号摘要100字内",
  "wechat_content": "完整公众号文章Markdown格式",
  "twitter_copy": "X/Twitter文案280字内带emoji",
  "video_title": "视频标题",
  "video_script": "口播脚本(含时间戳和字幕)",
  "cover_keywords": ["关键词1", "关键词2", "关键词3"]
}

## 原文内容
{{ $json.data }}

节点 6Convert to File

类型: Convert to File 名称: Convert to File Operation toJson

功能: 将 AI Agent 输出转换为 JSON 格式文件


节点 7Read/Write Files from Disk

类型: Read/Write File 名称: Read/Write Files from Disk Operation write

配置:

  • File Name: =/home/node/.n8n-files/{{ $('Webhook Trigger').item.json.body.note_name }}_output.md

输出变量:

  • output_file_name
  • output_content

节点 8Send Telegram Message

类型: Telegram 名称: Send Telegram Message

配置:

  • Chat ID: 5038825565
  • Text: "文章转换成功"
  • Credentials: Telegram XingJiang Bot

功能: 通知星匠/用户工作流已完成


🔗 完整节点连接图v4

┌─────────────────────────────────┐
│  Webhook Trigger                │
│  POST /content-translation-v4  │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│  Read Obsidian Note             │
│  (Read Binary File)            │
│  /home/node/.n8n-files/         │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│  Extract from File              │
│  (text operation)               │
└──────────────┬──────────────────┘
               │
    ┌──────────┴──────────┐
    │                      │
    │              ┌───────┴────────┐
    │              │ DeepSeek       │
    │              │ Chat Model     │
    │              └───────┬────────┘
    │                      │
    ▼                      ▼
┌─────────────────────────────────┐
│  AI Agent (LangChain)           │
│  - system prompt               │
│  - original content            │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│  Convert to File (toJson)      │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│  Read/Write Files from Disk     │
│  (write output .md)            │
└──────────────┬──────────────────┘
               │
               ▼
┌─────────────────────────────────┐
│  Send Telegram Message          │
│  文章转换成功                   │
└─────────────────────────────────┘

🔄 调用方式OpenClaw 侧)

# 1. 将文章文件复制到 n8n-files 目录(通过 SFTP 或共享目录)
scp article.md macmini:/tmp/article.md
# 需要手动或通过 API 上传到 n8n 容器的 /home/node/.n8n-files/

# 2. 触发 n8n 工作流
curl -X POST "https://n8n.ishenwei.online/webhook/content-translation-v4" \
  -H "Content-Type: application/json" \
  -d '{
    "note_name": "article-2026-03-29.md",
    "callback_url": "http://192.168.3.189:18789/webhook/yunce"
  }'

📁 Obsidian / n8n 文件目录结构

# n8n 容器内
/home/node/.n8n-files/
├── article-2026-03-29.md          # 原始文章(待处理)
└── article-2026-03-29.md_output.md  # 成品笔记(转换后)

# MacMini ObsidianOpenClaw 读取目录)
~/Workspace/nexus/openclaw/
├── content-queue/                 # 待处理文章队列
└── content-output/               # 成品输出目录

🔧 各版本对比

版本 ID 状态 AI Provider 特点
v1 xQDabttYmLaY8qtr 活跃 DeepSeek (LangChain Agent) 读 Obsidian 路径,写入 content-output
v2 r0v9WAmed2THfN81 未激活 OpenAI (n8n-nodes-langchain) 基于 GPT-4o
v3 tOGMiC6qOJPOY89E 活跃 DeepSeek (直接 API) 直接调用 DeepSeek API稳定性更好
v4 iOf32aOKvTjfTDSM 未激活 DeepSeek (LangChain Agent) 最新版本,用 n8n-files 路径

🔧 环境变量 / Credentials

配置项
DeepSeek API 通过 n8n credential DeepSeek account (ID: T7yJumbH684ClWfI)
Telegram Bot Telegram XingJiang Bot (ID: y1NdRSaJwl0LoY37)
Unsplash API 在 v1/v2 中使用v3/v4 未使用

验收标准

  1. Webhook 被调用后,整个流程自动完成
  2. 成品文件写入 /home/node/.n8n-files/{note_name}_output.md
  3. Telegram 收到完成通知
  4. 任意节点失败时n8n 会中断流程并记录错误

📝 待完善项v4

  • 成品文件需要写回 Obsidian 目录(目前只写到 n8n-files
  • 封面图搜索节点v4 已移除 v1 的 Unsplash 配图功能)
  • OpenClaw 回调通知v4 改为 Telegram 通知,需确认是否符合预期)
  • v4 激活前需完成联调测试

📝 后续扩展方向

  • 加入封面图搜索(恢复 Unsplash 节点)
  • 写回 Obsidian content-output 目录
  • 支持 X/Twitter API 自动发布
  • 支持抖音/YouTube 视频上传 API
  • 加入人工审核节点(审批后再发布)