8
n8n 中文网amn8n.com

AI无法回答时寻求人工帮助

高级

这是一个Support, AI领域的自动化工作流,包含 17 个节点。主要使用 If, Code, Slack, Agent, ChatTrigger 等节点,结合人工智能技术实现智能自动化。 AI无法回答时寻求人工帮助

前置要求
  • Slack Bot Token 或 Webhook URL
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e12611f4-37d2-48f9-8a60-ddcf4ff34cfc",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        380
      ],
      "parameters": {
        "color": 7,
        "width": 1118.3459011229047,
        "height": 775.3931210698682,
        "content": "### 子工作流:自定义工具"
      },
      "typeVersion": 1
    },
    {
      "id": "72dbee3e-fe3b-4354-9b02-2fe52af23035",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -180
      ],
      "parameters": {
        "color": 7,
        "width": 927.5,
        "height": 486.5625,
        "content": "### 主工作流:使用自定义工具的 AI 智能体"
      },
      "typeVersion": 1
    },
    {
      "id": "a1c9660d-84b1-418a-bbb3-88d79cdd79d3",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        60
      ],
      "parameters": {
        "color": 5,
        "width": 197.45572294791873,
        "height": 179.21380662202682,
        "content": "**此工具调用下方的子工作流**"
      },
      "typeVersion": 1
    },
    {
      "id": "b4ffb76d-c44f-46d6-b2d9-4e5d551adee1",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        40
      ],
      "parameters": {
        "color": 2,
        "width": 150,
        "height": 213.44323866265472,
        "content": "**设置您的凭据**"
      },
      "typeVersion": 1
    },
    {
      "id": "8a9187f1-3cf9-479f-aa7f-5581880394d0",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        540
      ],
      "parameters": {
        "color": 2,
        "width": 178.0499248677781,
        "height": 250.57252651663197,
        "content": "**设置您的凭据和 Slack 详细信息**"
      },
      "typeVersion": 1
    },
    {
      "id": "3f72d117-e07a-4af4-aa1b-92ce04bf0b3c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 185.9375,
        "height": 214.8397420554627,
        "content": "## 尝试使用"
      },
      "typeVersion": 1
    },
    {
      "id": "b85eff07-ee3c-4aeb-871e-b25a131a7afb",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        900
      ],
      "parameters": {
        "height": 145,
        "content": "## 后续步骤"
      },
      "typeVersion": 1
    },
    {
      "id": "feb1e50d-5044-4ea6-8719-72e176581e27",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -400,
        -120
      ],
      "webhookId": "e0e69202-32e8-41b5-963b-50905dd93e88",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "6af81471-7cd4-4517-9677-b634b59620b4",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -240,
        120
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8gccIjcuf3gvaoEr",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "37604c8d-5c70-4a81-a1d0-eafe42ce612d",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -60,
        120
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "fd404bb5-0703-4d08-8b9b-4a8b01fd2bff",
      "name": "当被另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -380,
        740
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "chatInput"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a807ca29-65bf-4d97-b89f-5ce16cd05347",
      "name": "检查用户是否提供了电子邮件",
      "type": "n8n-nodes-base.if",
      "position": [
        -200,
        740
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e6dce436-5e85-4722-a7e4-0ceb940a5477",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $('When Executed by Another Workflow').item.json.chatInput }}",
              "rightValue": "=/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.[a-zA-Z0-9_-]+)/gi"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b9c552ce-4c58-48dd-b168-5e277de89954",
      "name": "向 Slack 发送求助信息",
      "type": "n8n-nodes-base.slack",
      "position": [
        80,
        620
      ],
      "webhookId": "c54bea4c-bdb6-4f42-9f82-525857df5a9a",
      "parameters": {
        "text": "={{ \"A user had a question the bot couldn't answer. Here's their message: \" + $('When Executed by Another Workflow').first().json.chatInput }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#general"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "VfK3js0YdqBdQLGP",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "644a05fc-ac7e-4ea9-ab03-3b6fbf7a3654",
      "name": "确认已联系人工客服",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        620
      ],
      "parameters": {
        "jsCode": "const response = {\"response\": \"Thank you for getting in touch. I've messaged a human to help.\"}\nreturn response;"
      },
      "typeVersion": 2
    },
    {
      "id": "38e81aa5-30b3-48f9-88e8-1039f607f3e7",
      "name": "提示用户提供电子邮件",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        860
      ],
      "parameters": {
        "jsCode": "const response = {\"response\":\"I'm sorry I don't know the answer. Please repeat your question and include your email address so I can request help.\"};\nreturn response;"
      },
      "typeVersion": 2
    },
    {
      "id": "61ddb25a-f7f2-4691-94d5-3f32c183ec46",
      "name": "不确定?",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        140,
        120
      ],
      "parameters": {
        "name": "dont_know_tool",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "如果您不知道用户问题的答案,或对自己的回答不太确定,请使用此工具。",
        "workflowInputs": {
          "value": {
            "chatInput": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('chatInput', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "chatInput",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "chatInput",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2
    },
    {
      "id": "395349d1-1715-4550-a0c8-1388d17b4386",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -180,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.8
    }
  ],
  "pinData": {},
  "connections": {
    "Not sure?": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Message Slack for help": {
      "main": [
        [
          {
            "node": "Confirm that we've messaged a human",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if user has provided email": {
      "main": [
        [
          {
            "node": "Message Slack for help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prompt the user to provide an email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Check if user has provided email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户支持, 人工智能

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 查看

分享此工作流