8
n8n 中文网amn8n.com

使用Super RAG和GPT-5从知识源创建基于事实的文章

高级

这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Set, SplitOut, Aggregate, FormTrigger, HttpRequest 等节点。 使用Super RAG和GPT-5从知识源创建基于事实的文章

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "nodes": [
    {
      "id": "9a0f0715-0f7f-4779-8f3a-c35bcf2ca175",
      "name": "新内容 - 生成研究问题",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1008,
        528
      ],
      "parameters": {
        "text": "=Content title:  {{ $json.Title }}\n\nArticle guidelines: {{ $json.Guidelines }}\n\n",
        "messages": {
          "messageValues": [
            {
              "message": "=You will receive a content title and an angle. Return 5–8 non-overlapping questions in JSON array format that cover everything needed to write excellent content as it breaks down the topic into sub-questions.\n\nGuidelines:  \n- Start with simple, short broad questions for example to define the terms (e.g., What is X?, Why is X important?, How to do X?).  \n- Then move into more specific, advanced, or analytical questions.  \n- Ensure questions together form a complete coverage of the topic.   \n\n## Output format:\n\nYou'll return the questions in such a JSON ARRAY:\n\n[\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, ut enim ad minim veniam?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur?\"\n  }\n]"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "97aa9da3-f03f-4ef5-8645-6ca9a941dfd4",
      "name": "格式化问题和答案",
      "type": "n8n-nodes-base.set",
      "position": [
        320,
        768
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1e33a1f4-a1a2-4962-ac72-cc518d7ff043",
              "name": "Question",
              "type": "string",
              "value": "={{ $('Loop Over Questions').item.json.question }}"
            },
            {
              "id": "903bcf38-13dd-48fb-8eb3-83f7a232aa53",
              "name": "Answer",
              "type": "string",
              "value": "={{ $json.answer.replace(/\\{\\[(\\d+)\\]\\((.*?)\\)\\}/g, '([source]($2))') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8ce76a1b-d79b-43e7-8b47-c61b6167b1af",
      "name": "新内容 - 生成 AI 输出",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        144,
        -48
      ],
      "parameters": {
        "text": "=Article title:\n\n{{ $('Prepare form values').first().json.Title }}\n\nArticle guidelines:\n\n{{ $('Prepare form values').first().json.Guidelines }}\n\n\nContent to leverage:\n\nThis Q&A research provides high-quality knowledge, insights, and sources for your content. Be sure to include source links in your output whenever a source was used.\n\n{{ JSON.stringify($json['questions and answers'], null, 2) }}\n",
        "messages": {
          "messageValues": [
            {
              "message": "=# Role\n\nYour role is to write an article based on the request in the user message.\n\n# What the user message contains\n\nThe user message includes the article title, any guidelines to follow, and comprehensive research material. This research is the sole basis for your article — do not invent information beyond it. When the research includes source links, integrate them smoothly as hyperlinks in the article.\n\n# How to write good articles\n\nYou excel at writing articles by making sure that they deliver value, are concise, seem like they are human-written, not using typical AI useless sentence formulations.\n\n# Your output format\n\nOutput only the full article.\n\n* Begin with a `# H1` title.\n* Use subheadings throughout the article."
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "97939f7a-faf8-4b86-a566-ac55a1f3272a",
      "name": "新文章表单",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1568,
        528
      ],
      "webhookId": "61cdfeab-f3ce-4b9a-925b-63f813c267f9",
      "parameters": {
        "options": {},
        "formTitle": "New article",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Article title",
              "placeholder": "10 ways to do Influencer Marketing in 2025",
              "requiredField": true
            },
            {
              "fieldLabel": "Article guidelines",
              "placeholder": "Promote xyz and write in British English...",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Fill in this form to trigger the generation of a new article."
      },
      "typeVersion": 2.3
    },
    {
      "id": "dda874a4-b51e-46f1-b99b-a181beaae73c",
      "name": "准备表单值",
      "type": "n8n-nodes-base.set",
      "position": [
        -1312,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ec4734ed-654f-478a-ab90-91bfcee1e208",
              "name": "Title",
              "type": "string",
              "value": "={{ $json['Article title'] }}"
            },
            {
              "id": "c034402e-a7b9-4c91-aaed-f24a838c3d91",
              "name": "Guidelines",
              "type": "string",
              "value": "={{ $json['Article guidelines'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "86265d5e-ad97-429c-af6b-3876b8d14a83",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -880,
        752
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, ut enim ad minim veniam?\"\n  },\n  {\n    \"question\": \"Lorem ipsum dolor sit amet, consectetur?\"\n  }\n]"
      },
      "typeVersion": 1.2
    },
    {
      "id": "41053ca5-776c-4f11-84ee-9799a44546f6",
      "name": "GPT 5 mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1008,
        752
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "a41214eb-8650-43ab-9a29-26709c89e838",
      "name": "拆分问题",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -608,
        528
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output"
      },
      "typeVersion": 1
    },
    {
      "id": "fe8a86db-6972-4416-8223-ae7b9bc3c90f",
      "name": "循环处理问题",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -352,
        512
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "d6d46dbf-c20f-4c0d-a9f8-c3d3059d0678",
      "name": "查询 Super Assistant",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        544
      ],
      "parameters": {
        "url": "https://api.super.work/v1/super",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "question",
              "value": "={{ $json.question }}"
            },
            {
              "name": "assistantId",
              "value": "YOUR-ASSISTANT-ID"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1e6c7b70-60e0-44f9-a418-82b806b8d9ae",
      "name": "GPT 5 chat",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        224,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-chat-latest",
          "cachedResultName": "gpt-5-chat-latest"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "8b34795b-bc61-4c27-88dd-8a942c50a44a",
      "name": "文章结果",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d3b8c4bc-27d9-4d57-b8d6-3a40b84d7b7d",
              "name": "Article",
              "type": "string",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5afd58d4-99f9-48c2-9d34-3d353cbbfc6f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 320,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5429c604-cf0e-4635-b47e-7f436a5399c7",
      "name": "聚合研究内容",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -112,
        160
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "Content to leverage"
      },
      "typeVersion": 1
    },
    {
      "id": "b86d6f11-dd1a-4b65-8342-6420b8ee4b61",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        -256
      ],
      "parameters": {
        "width": 832,
        "height": 560,
        "content": "# 基于您知识库的 AI 文章撰写器"
      },
      "typeVersion": 1
    },
    {
      "id": "615bc59d-5d05-4986-9bee-5a8ac089a390",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        384
      ],
      "parameters": {
        "color": 6,
        "width": 976,
        "height": 608,
        "content": "## 使用 Super 逐一回答每个子问题"
      },
      "typeVersion": 1
    },
    {
      "id": "a256f168-dbac-4a99-9617-32641916fae2",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 368,
        "height": 512,
        "content": "## AI 步骤:基于研究和初始请求撰写最终文章"
      },
      "typeVersion": 1
    },
    {
      "id": "b909335e-7b65-41e8-b716-65605a278d29",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        384
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 608,
        "content": "## 将主题分解为子问题"
      },
      "typeVersion": 1
    },
    {
      "id": "b0e02f1f-73b2-4834-8a0e-2251ac1f53e1",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1648,
        400
      ],
      "parameters": {
        "color": 4,
        "width": 272,
        "height": 304,
        "content": "## 填写此表单以请求新文章"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "GPT 5 chat": {
      "ai_languageModel": [
        [
          {
            "node": "New content - Generate the AI output",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "GPT 5 mini": {
      "ai_languageModel": [
        [
          {
            "node": "New content - generate research questions",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "New article form": {
      "main": [
        [
          {
            "node": "Prepare form values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Questions": {
      "main": [
        [
          {
            "node": "Aggregate research content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Query Super Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare form values": {
      "main": [
        [
          {
            "node": "New content - generate research questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Questions": {
      "main": [
        [
          {
            "node": "Loop Over Questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Super Assistant": {
      "main": [
        [
          {
            "node": "Format question and answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "New content - generate research questions",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate research content": {
      "main": [
        [
          {
            "node": "New content - Generate the AI output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format question and answer": {
      "main": [
        [
          {
            "node": "Loop Over Questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New content - Generate the AI output": {
      "main": [
        [
          {
            "node": "Article result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New content - generate research questions": {
      "main": [
        [
          {
            "node": "Split Out Questions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI RAG 检索增强, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量19
分类2
节点类型10
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Guillaume Duvernay

Guillaume Duvernay

@duv

AI and automation expert

外部链接
在 n8n.io 查看

分享此工作流