8
n8n 中文网amn8n.com

中文翻译器

中级

这是一个AI领域的自动化工作流,包含 9 个节点。主要使用 Webhook, HttpRequest 等节点,结合人工智能技术实现智能自动化。 通过Line和OpenRouter进行中文翻译

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证

使用的节点 (9)

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "iFkGAiVn3yBlykIG",
  "meta": {
    "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a"
  },
  "name": "中文翻译器",
  "tags": [
    {
      "id": "IhTa6egt1w8uqn9Z",
      "name": "_ACTIVE",
      "createdAt": "2025-03-12T05:07:05.060Z",
      "updatedAt": "2025-03-12T05:07:05.060Z"
    },
    {
      "id": "0xpEHcJjNRRRMtEj",
      "name": "lin",
      "createdAt": "2025-03-12T05:06:24.112Z",
      "updatedAt": "2025-03-12T05:06:24.112Z"
    }
  ],
  "nodes": [
    {
      "id": "3ebfb7f1-b655-405b-8bde-0219fa92d09c",
      "name": "Line Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -260,
        -20
      ],
      "webhookId": "b2b119e6-6de5-4684-9a51-4706a1c20caf",
      "parameters": {
        "path": "cn",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "b7fc7675-f8d7-4e7e-bec3-f9c626ba1728",
      "name": "使用 OpenRouter",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        -20
      ],
      "parameters": {
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"qwen/qwen-max\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"please provide chinese character, pinyin and translation in english. if the input is in english, you will translate and also provide chinese character, pinyin and translation in english for each word\"\n    },\n     {\n      \"role\": \"user\",\n      \"content\": \"{{ $('Line Webhook').item.json.body.events[0].message.text }}\"\n    }\n  ]\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "7Y8q0dS2Y1fcvzTl",
          "name": "OpenRouter.ai"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fed14d64-d3ea-4a17-98d5-28d889ac4ffa",
      "name": "Line 回复",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        -20
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"replyToken\": \"{{ $('Line Webhook').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"{{ $json.choices[0].message.content.replaceAll(\"\\n\",\"\\\\n\").replaceAll(\"\\n\",\"\").removeMarkdown().removeTags().replaceAll('\"',\"\") }}\"\n    }\n  ]\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3IEOzxKOUr6OEXyU",
          "name": "Line @405jtfqs LazyChinese"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "63ae844f-dfc3-4e8f-97d0-c0ec4be7858f",
      "name": "Line 加载动画",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        120,
        -20
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/chat/loading/start",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"chatId\": \"{{ $json.body.events[0].source.userId }}\",\n    \"loadingSeconds\": 60\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "3IEOzxKOUr6OEXyU",
          "name": "Line @405jtfqs LazyChinese"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7e4cc2a0-958c-4111-909c-fba75a428d5e",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 560,
        "content": "**来自 Line 的 Webhook**"
      },
      "typeVersion": 1
    },
    {
      "id": "767827b2-fbca-4dbb-b392-749c25a56c93",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 560,
        "content": "**Line 加载动画**"
      },
      "typeVersion": 1
    },
    {
      "id": "8cdafc15-3bf8-45e9-8081-901d5c5a7880",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -100
      ],
      "parameters": {
        "color": 2,
        "width": 360,
        "height": 560,
        "content": "**OpenRouter.ai**"
      },
      "typeVersion": 1
    },
    {
      "id": "3e2f4acf-771c-4d55-a13e-b4c874136574",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -100
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 560,
        "content": "**Line 回复**"
      },
      "typeVersion": 1
    },
    {
      "id": "b17eddaf-da3e-4e21-ab33-9e71f385d734",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -200
      ],
      "parameters": {
        "color": 5,
        "width": 780,
        "height": 80,
        "content": "## 您可以通过添加 Line @405jtfqs 来测试此工作流"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "timezone": "Asia/Bangkok",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "A8HoJ5iCrAMPbsLh",
    "executionOrder": "v1"
  },
  "versionId": "aba1f2dc-81ea-4144-b88e-5fd37ee6b247",
  "connections": {
    "Line Webhook": {
      "main": [
        [
          {
            "node": "Line Loading Animation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use OpenRouter": {
      "main": [
        [
          {
            "node": "Line Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Line Loading Animation": {
      "main": [
        [
          {
            "node": "Use OpenRouter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量9
分类1
节点类型3
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流