# N8N 内容转化流水线工作流设计(v4 → v5 升级) > 用于:AI 英文文章 → 中文公众号/X/视频 内容转化 > 工作流ID:`iOf32aOKvTjfTDSM`(v4基础) > 触发方式:OpenClaw 通过 Webhook 调用 > 管理平台:Mac mini 上的 n8n (`https://n8n.ishenwei.online`) --- ## 📋 核心需求更新(v5) ### 输出要求(重要!) **必须同时输出两个版本:** | 输出文件 | 路径 | 格式 | 用途 | |---------|------|------|------| | **Markdown 源文件** | `content-output/{原文件名}.md` | 中文 Markdown | Obsidian 留存、溯源 | | **公众号 HTML** | `content-output/{原文件名}.html` | 带样式的 HTML | 直接复制到公众号编辑器 | ### Obsidian 目录结构 ``` ~/Workspace/nexus/openclaw/ ├── content-queue/ # 原始英文文章(输入) │ └── 2026-03-29-ai-solopreneur.md │ └── content-output/ # 成品(输出) ├── 2026-03-29-ai-solopreneur.md # 翻译后 Markdown └── 2026-03-29-ai-solopreneur.html # 公众号 HTML(新增) ``` --- ## 📋 工作流概述 ``` OpenClaw (发现文章) ↓ (保存文件到 n8n-files 目录) ↓ (触发 Webhook) ┌─────────────────────────────────────────────────────────────┐ │ N8N 工作流 (v5): content-translation-pipeline-v5 │ │ │ │ [Webhook] → [Read File] → [Extract Text] → [AI Agent] │ │ ↓ ↑ (DeepSeek) │ │ [Build Markdown] → [Write .md] → [Build HTML] → [Write .html] │ │ ↓ │ │ [Send Telegram] │ └─────────────────────────────────────────────────────────────┘ ``` --- ## 🔌 节点详细设计(v5) ### 节点 1️⃣:Webhook Trigger **类型:** Webhook **名称:** `Webhook Trigger` **Path:** `/content-translation-v5`(新建 path) **Method:** POST **接收数据格式:** ```json { "note_name": "2026-03-29-ai-solopreneur.md", "source_path": "/Users/weishen/Workspace/nexus/openclaw/content-queue/2026-03-29-ai-solopreneur.md", "callback_url": "http://192.168.3.189:18789/webhook/yunce" } ``` --- ### 节点 2️⃣:Read Obsidian Note **类型:** Read Binary File **名称:** `Read Obsidian Note` **配置:** - File Path: `=/home/node/.n8n-files/{{ $json.body.note_name }}` --- ### 节点 3️⃣:Extract from File **类型:** Extract from File **名称:** `Extract from File` **Operation:** `text` **输出:** ```json { "original_content": "...", "note_name": "2026-03-29-ai-solopreneur.md", "source_path": "/Users/weishen/Workspace/nexus/openclaw/content-queue/..." } ``` --- ### 节点 4️⃣:AI Agent(翻译+改写) **类型:** LangChain Agent **名称:** `AI Agent` **Version:** 3.1 **Model:** DeepSeek Chat Model **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 }} ``` --- ### 节点 5️⃣:Build Markdown(新增) **类型:** Code **名称:** `Build Markdown` **功能:** 将 AI 输出组装成 Markdown 文件 ```javascript const aiResult = $input.first().json.message; const data = typeof aiResult === 'string' ? JSON.parse(aiResult) : aiResult; const noteName = $('Webhook Trigger').first().json.body.note_name; // 去掉 .md 后缀,输出到 content-output const outputName = noteName.replace('.md', '.md'); const outputPath = '/Users/weishen/Workspace/nexus/openclaw/content-output/' + outputName; const markdown = `# ${data.wechat_title} ${data.wechat_content} --- ## X/Twitter 文案 ${data.twitter_copy} --- ## 视频信息 **标题:** ${data.video_title} **口播脚本:** ${data.video_script} --- *封面图关键词:${data.cover_keywords?.join(', ')}* `; return { json: { output_path: outputPath, output_content: markdown, source_path: $('Webhook Trigger').first().json.body.source_path } }; ``` --- ### 节点 6️⃣:Write .md File(新增) **类型:** Write Binary File / ReadWriteFile **名称:** `Write Markdown Note` **配置:** - Operation: `write` - File Path: `={{ $json.output_path }}` - Content: `={{ $json.output_content }}` --- ### 节点 7️⃣:Build HTML(新增,核心) **类型:** Code **名称:** `Build WeChat HTML` **功能:** 将 Markdown 转为带样式的公众号 HTML ```javascript const aiResult = $input.first().json.message; const data = typeof aiResult === 'string' ? JSON.parse(aiResult) : aiResult; const noteName = $('Webhook Trigger').first().json.body.note_name; const htmlPath = '/Users/weishen/Workspace/nexus/openclaw/content-output/' + noteName.replace('.md', '.html'); // 公众号 HTML 模板 const html = `
${line}
`; }).join('\n')}