8
n8n 中文网amn8n.com

AI系统提示生成器与优化器(n8n + OpenAI)

中级

这是一个自动化工作流,包含 8 个节点。主要使用 Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 等节点。 AI系统提示生成器与优化器(n8n + OpenAI)

前置要求
  • OpenAI API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "8f16c045-53e2-4405-9053-7dd634d6e82f",
      "name": "便签33",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2048,
        8448
      ],
      "parameters": {
        "width": 400,
        "height": 752,
        "content": "## ⚙️ 设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "1faa8374-59e4-4371-a7ed-c17301b8aca7",
      "name": "便签34",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1616,
        8448
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 752,
        "content": "# 🛠️ AI 系统提示生成器和优化器(n8n + OpenAI)"
      },
      "typeVersion": 1
    },
    {
      "id": "39899c3c-ec7e-4598-873a-0172a79db705",
      "name": "OpenAI 聊天模型10",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1040,
        9040
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "gpt-5"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b325fa59-0b59-4535-a0a9-7f3be237044f",
      "name": "便签35",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        8864
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 1️⃣ 设置 OpenAI 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "fae4be3e-f184-490e-bd98-4108ac657d5f",
      "name": "简单内存2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -688,
        9024
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "12da8616-e4ac-4a4d-8e3b-0387a4c3748f",
      "name": "AI 提示生成器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -976,
        8672
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a System Prompt Optimizer.  \nYour job is to take a user’s goal or draft prompt and return an optimized system prompt that is clear, specific, and actionable.  \n\n### Rules:\n- Always rewrite the input into a polished, professional **system prompt**.  \n- Ensure the system prompt includes explicit rules, roles, and constraints where useful.  \n- Make it concise but detailed enough to remove ambiguity.  \n- Recommend the **best OpenAI model** to use for this prompt, based on complexity, reasoning needs, and latency/cost tradeoffs.  \n"
        },
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "77d09a63-9b3c-47cf-a7a4-de76d4a84a07",
      "name": "便签36",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        8736
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 304,
        "content": "### 示例问题"
      },
      "typeVersion": 1
    },
    {
      "id": "a5c3ebce-f05b-4985-96ef-b98b8db66a22",
      "name": "聊天消息",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1440,
        8880
      ],
      "webhookId": "ccaca032-7964-4a83-9417-91a223bc1485",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    }
  ],
  "pinData": {},
  "connections": {
    "Chat Message": {
      "main": [
        [
          {
            "node": "AI Prompt Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory2": {
      "ai_memory": [
        [
          {
            "node": "AI Prompt Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AI Prompt Generator": {
      "main": [
        []
      ]
    },
    "OpenAI Chat Model10": {
      "ai_languageModel": [
        [
          {
            "node": "AI Prompt Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级

需要付费吗?

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

工作流信息
难度等级
中级
节点数量8
分类-
节点类型5
难度说明

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

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流