8
n8n 中文网amn8n.com

使用Groq AI和Pinecone的自动邮件分类与回复系统

高级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 38 个节点。主要使用 Code, Switch, Twitter, EmailSend, HttpRequest 等节点。 使用Groq AI和Pinecone的自动邮件分类与回复系统

前置要求
  • Twitter API 凭证
  • 可能需要目标 API 的认证凭证
  • Pinecone API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "4ec72f345837e652f6ec393f7f7457d09446df2a23a7c6ffddff8265d46e2be9"
  },
  "nodes": [
    {
      "id": "8befe960-178d-4983-b962-7487817baed4",
      "name": "邮件触发器(IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -1900,
        1100
      ],
      "parameters": {
        "options": {},
        "downloadAttachments": true
      },
      "typeVersion": 2
    },
    {
      "id": "29a32c21-8f26-4d64-9a43-875ddd566c72",
      "name": "开关1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1460,
        1016
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "hr",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bb988e36-c702-4b83-8ec1-f4f585f3b411",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "hr"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "billing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "06afe4de-1542-46e9-9d57-7775b3b2d185",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "billing"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "complaint",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "069fdd96-983f-46a7-a709-863cdbc6384d",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "complaint"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "feedback",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f3e821fa-8b78-427e-abe4-38ae628624e1",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "feedback"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "inquiry",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4a46eaa4-e960-4f3b-b23c-b04d9dbb61e0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "inquiry"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "sales",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f4a3c28e-ca9f-4c7c-aa04-010832d7dab5",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[\"subject\"] }}",
                    "rightValue": "sales"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "unknown",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "263fd3c7-1e12-4b2e-96b2-0b99e713632d",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json[\"category\"]}}",
                    "rightValue": "unknown"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "054ce674-7ec3-472c-aece-239291db890c",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        -1680,
        1100
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const subject = $json.subject ? $json.subject.toLowerCase() : \"\";\n\nlet category = \"unknown\";\n\nif (/resume|cv|job/.test(subject)) {\n  category = \"hr\";\n} else if (/invoice|bill/.test(subject)) {\n  category = \"billing\";\n} else if (/complaint|problem|issue/.test(subject)) {\n  category = \"complaint\";\n} else if (/feedback|suggestion/.test(subject)) {\n  category = \"feedback\";\n} else if (/inquiry|open|working|tomorrow|holiday/.test(subject)) {\n  category = \"inquiry\";\n} else if (/sales|offer|quotation/.test(subject)) {\n  category = \"sales\";\n\n}\n\nreturn {\n  json: {\n    ...$json,\n    category\n  }\n};\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2d3a2fa0-db9c-44e1-89da-0b7a98626bd8",
      "name": "基础LLM链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -860,
        1400
      ],
      "parameters": {
        "text": "=##role\nYou are an email classifier. Given an email's subject and body, return one of these exact categories: [\"hr\", \"billing\", \"complaint\", \"feedback\", \"inquiry\", \"sales\", \"client\"].\n\nOnly return one word from this list. If the email is a bill or invoice, return \"billing\". If it's a job application, return \"hr\". If unsure, return \"inquiry\".\n\nSubject: {{ $json[\"subject\"] }}\nBody: {{ $json[\"body\"] }}\n",
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "2b0efec2-3508-4a37-945c-2085439d05fd",
      "name": "Groq 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -760,
        1620
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "700feb4d-f5f7-4a64-80cc-e95db99716fc",
      "name": "Groq 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -660,
        1040
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "ce29423e-ea17-4cdd-81cc-16172776bdb9",
      "name": "X",
      "type": "n8n-nodes-base.twitter",
      "position": [
        -140,
        760
      ],
      "parameters": {
        "text": "=Another happy customer said: \" {{ $json.textPlain }}\"\n",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "ff416773-6aa0-468a-895b-5970caaf371c",
      "name": "Groq 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        340,
        1280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "cbe51847-bddb-4169-a9b2-545005416936",
      "name": "基础 LLM 链1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -980,
        180
      ],
      "parameters": {
        "text": "=You are an HR assistant.\n\nHere is the job description for the role:\n\n[Insert role details here, e.g., \"Looking for a Python Developer with experience in Django, REST APIs, and SQL.\"]\n\nNow, read the following candidate's email/resume and evaluate if they are a good fit for this role.\n\nIf suitable, respond with:\nACCEPT - and a brief explanation why.\n\nIf not suitable, respond with:\nREJECT - and a brief explanation why.\n\nCandidate's email/resume:\n{{ $json[\"emailText\"] }}\n",
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "be7d4f6d-64a0-4be0-b70c-e60abfa610f7",
      "name": "Groq 聊天模型3",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -900,
        400
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "d69d1118-5fd7-4e7f-a2c2-8e66d8d40c19",
      "name": "代码2",
      "type": "n8n-nodes-base.code",
      "position": [
        -540,
        280
      ],
      "parameters": {
        "jsCode": "const aiResponse = $json[\"text\"] || \"\";  // Adjust key if different\nconst isAccepted = aiResponse.toLowerCase().startsWith(\"accept\");\n\nreturn [{\n  json: {\n    decision: isAccepted ? \"accept\" : \"reject\",\n    aiResponse: aiResponse,\n    candidateEmail: $json[\"candidateEmail\"] || \"\", // get candidate email from previous nodes\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ecd67230-4807-48bf-acf7-70092f4476fd",
      "name": "切换",
      "type": "n8n-nodes-base.switch",
      "position": [
        -320,
        280
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "accept",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "366a42b8-a4eb-4488-9872-6f1aa097fc48",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[decision] }}",
                    "rightValue": "accept"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "reject",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6146a9fb-3988-4078-af40-4c87840816a9",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json[decision] }}",
                    "rightValue": "reject"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ff741958-dfd7-4c46-945d-10cfe521bd7d",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        460,
        1240
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "toolName": "knowlagebase",
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "demokb",
          "cachedResultName": "demokb"
        },
        "toolDescription": "company dock"
      },
      "typeVersion": 1.1
    },
    {
      "id": "97811059-7058-4b93-b62b-d65ac30da74e",
      "name": "Cohere 嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "position": [
        600,
        1400
      ],
      "parameters": {
        "modelName": "embed-english-v3.0"
      },
      "typeVersion": 1
    },
    {
      "id": "8fd67212-0a9d-4783-acc1-93c7d86c820b",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1580,
        2060
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d4b781d1-fe8b-414c-b374-c42d97549763",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        2060
      ],
      "parameters": {
        "url": "https://www.dropbox.com/scl/fo/p05bb9t8o6ech9d1joj7s/AKJmlI3mlt3O8qSjGbroMLc?rlkey=m1h852ks0y2o1gmdmbk3uda1d&st=pk0pq820&dl=1",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0341b254-3ece-450b-aa3b-de531cbfb1f1",
      "name": "从文件提取",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1140,
        2060
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "ffbc75c1-b3ed-4fa6-8cd5-3bbed81c60d1",
      "name": "代码3",
      "type": "n8n-nodes-base.code",
      "position": [
        -920,
        2060
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "\nconst text = $json.extractedText || $json.text || '';\n\n\nconst cleanedText = text.replace(/\\s+/g, ' ').trim();\n\nreturn {\n  json: {\n    original: text,\n    cleaned: cleanedText\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "1c00d468-87ec-433c-939e-48049c133130",
      "name": "Pinecone向量存储1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -700,
        2060
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "demokb",
          "cachedResultName": "demokb"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "404e80ef-fb17-4cbd-9198-23b951b36edf",
      "name": "Cohere 嵌入1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "position": [
        -700,
        2280
      ],
      "parameters": {
        "modelName": "embed-multilingual-v3.0"
      },
      "typeVersion": 1
    },
    {
      "id": "761ca395-d8d9-4ad4-a8de-b741dc8ddef0",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -580,
        2300
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "41b8a97b-7350-4b87-8586-8f558394df54",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        -500,
        2480
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "05cfdbad-4dc1-45de-8a25-22762dbf07b7",
      "name": "发送邮件给团队",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        80,
        860
      ],
      "webhookId": "408004d1-ebdb-4776-a9f8-6a470db658a0",
      "parameters": {
        "text": "=New feedback received:\n\nSubject: {{$json[\"subject\"]}}\n\nContent: {{$json[\"emailContent\"]}}\n\nSentiment: {{$json[\"sentiment\"]}}\n",
        "options": {},
        "subject": "negative feedback",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "42abb326-e9b3-41eb-9840-704b83d3821c",
      "name": "发送回复给客户",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        620,
        980
      ],
      "webhookId": "bf79c357-f57f-4851-a8bc-c95602e4c069",
      "parameters": {
        "text": "={{ $json.output }}",
        "options": {},
        "subject": "inqury reply",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7cc49a03-c131-4064-a603-1264b9602060",
      "name": "发送给支持团队",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -400,
        600
      ],
      "webhookId": "211a9ca3-9768-486e-aad6-fbb52f6d3b2b",
      "parameters": {
        "text": "=\nA new complaint has been received from {{ $json[\"userName\"] || \"a customer\" }}:\n\n\"{{ $json[\"complaintText\"] }}\"\n\nPlease investigate and resolve this\n",
        "options": {},
        "subject": "New Customer Complaint Received",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "9b4d7b7e-6a0d-4ba3-bd02-fa86422f7a56",
      "name": "发送给客户",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -640,
        600
      ],
      "webhookId": "1ef34921-41bc-4a94-ab3e-2553e5c1758c",
      "parameters": {
        "text": "=We Received Your Complaint\n\nThank you for reaching out to us. We have received your complaint:\n\n\"{{ $json[\"complaintText\"] }}\"\n\nOur team is currently reviewing it and will get back to you as soon as possible.\n\nWe apologize for any inconvenience caused.\n\nFrom , \nCustomer Support Team\n",
        "options": {},
        "subject": "Complaint Received",
        "toEmail": "={{ $json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "9a536c97-b395-4466-8181-c1569e340a3c",
      "name": "拒绝邮件",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -100,
        380
      ],
      "webhookId": "ea634c6c-305a-499e-8773-d539e8489310",
      "parameters": {
        "text": "=Dear Candidate,\n\nThank you for applying. After review, we regret to inform you that you do not fit the requirements at this time.\n\nDetails: {{$json[\"aiResponse\"]}}\n\nBest regards,\nHR Team",
        "options": {},
        "subject": "Job Application Status: Not selected",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b782474f-4abe-43e5-8e8b-6f9a4c8bc223",
      "name": "发送给人力资源",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        120,
        180
      ],
      "webhookId": "1794df4d-7feb-47d6-a8a0-910197e6df62",
      "parameters": {
        "text": "=Hello HR Team,\n\nCandidate {{$json[\"candidate\"]}} has been accepted with a score of {{$json[\"score\"]}}.\n\nPlease proceed with the next steps.",
        "options": {},
        "subject": "=New Candidate Accepted:",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "150f211e-d5f5-4bd3-bc96-fcf662a00f2f",
      "name": "发送录用确认给候选人",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -100,
        180
      ],
      "webhookId": "bc4ad05b-966f-4bf2-bb80-23f996862711",
      "parameters": {
        "text": "=Dear Candidate,\n\nCongratulations! You have been accepted for the role.\n\nDetails: {{$json[\"aiResponse\"]}}\n\nBest regards,\nHR Team\n",
        "options": {},
        "subject": "Job Application Status: Accepted",
        "toEmail": "={{ $('Email Trigger (IMAP)').item.json.from }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "fd02b064-4431-486f-bea3-cb0fd161d7d5",
      "name": "发送账单给团队",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -960,
        540
      ],
      "webhookId": "91eaac98-671d-4e51-9a36-70a567908385",
      "parameters": {
        "text": "=\n\nA new billing email has been received.\n\nFrom: {{$json[\"from\"]}}\nSubject: {{$json[\"subject\"]}}\n\nEmail content:\n{{$json[\"body\"]}}\n\n",
        "options": {},
        "subject": "NEW BILL",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "{{ demo_from_email }",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "88d4ca68-2a8f-4fac-a327-5d34d4cffaf7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        724
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 620,
        "content": "使用 SWITCH 的邮件分类器"
      },
      "typeVersion": 1
    },
    {
      "id": "cf112be5-e068-4186-b087-8b8c5f684022",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1020,
        1360
      ],
      "parameters": {
        "width": 600,
        "height": 200,
        "content": "当 SWITCH 失败时用于 AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "51599770-8db8-48d9-aea1-a8866118277b",
      "name": "发送给销售团队",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -500,
        1140
      ],
      "webhookId": "d0fbd1fe-eafc-4915-a9d0-699a5676f218",
      "parameters": {
        "text": "= Sales Team\n\nFrom: {{$json[\"from\"]}}\nSubject: {{$json[\"subject\"]}}\n\nEmail content:\n{{$json[\"body\"]}}\n\n",
        "options": {},
        "subject": "sales",
        "toEmail": "={{ demo_to_email }}",
        "fromEmail": "={{ demo_from_email }}",
        "emailFormat": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "eb7bf4f3-b4c1-4a00-99ce-4da22a607f28",
      "name": "清理 AI Agent 输出",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        1520
      ],
      "parameters": {
        "jsCode": "const knownCategories = [\n  \"hr\",\n  \"billing\",\n  \"complaint\",\n  \"feedback\",\n  \"inquiry\",\n  \"sales\",\n  \"client\"\n];\n\nconst response = $json[\"category\"] || $json[\"output\"] || $json[\"text\"] || \"\";  // adapt this based on how your LLM responds\n\nconst normalized = response.trim().toLowerCase();\n\nif (knownCategories.includes(normalized)) {\n  return [{ json: { category: normalized } }];\n} else {\n  return [{ json: { category: \"unknown\" } }];\n}\n\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "7686a043-a6a1-4766-b44c-68cd17dd19e4",
      "name": "RAG 查询回复",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        300,
        980
      ],
      "parameters": {
        "text": "=You are a helpful assistant replying to a customer inquiry via email.\n\nUse the following information retrieved from our documents to generate a clear, professional response.\n\nContext:\n{{ $json[\"vectors\"].map(v => v.metadata.text).join(\"\\n\\n\") || \"No context available.\" }}\n\nCustomer's Question:\n{{ $json[\"emailText\"] }}\n\nRespond with a structured and informative email. Summarize any important points about products, services, or team details. Keep the tone polite and helpful.\n\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "52d15753-d3bd-40bf-b003-17d55ddb5769",
      "name": "反馈情感分析",
      "type": "@n8n/n8n-nodes-langchain.sentimentAnalysis",
      "position": [
        -720,
        860
      ],
      "parameters": {
        "options": {
          "categories": "Positive, Neutral, Negative"
        },
        "inputText": "=\n {{ $json.textPlain }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "a35ed1ad-bbce-4b6d-82e9-a745a54f90e8",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        820
      ],
      "parameters": {
        "width": 500,
        "height": 200,
        "content": "检查反馈是正面还是负面"
      },
      "typeVersion": 1
    },
    {
      "id": "fada6c17-587e-4b4c-8ff4-6df0e51f747c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        1960
      ],
      "parameters": {
        "width": 1500,
        "height": 460,
        "content": "将业务详情以 PDF 形式存入向量数据库"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code3": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "accepted confirm to candidate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "rejection email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "bill send to team",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send to customer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sentiment Analysis of feedback",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RAG INQURY REPLY",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "TO SALES TEAM",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "CLEAN AI AGENT OUTPUT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain1": {
      "main": [
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Sentiment Analysis of feedback",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "RAG INQURY REPLY",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "RAG INQURY REPLY": {
      "main": [
        [
          {
            "node": "send reply to customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to customer": {
      "main": [
        [
          {
            "node": "send to support team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Cohere": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Code3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Cohere1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CLEAN AI AGENT OUTPUT": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_tool": [
        [
          {
            "node": "RAG INQURY REPLY",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "accepted confirm to candidate": {
      "main": [
        [
          {
            "node": "to hr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sentiment Analysis of feedback": {
      "main": [
        [
          {
            "node": "X",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "send email to team",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "send email to team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工单管理, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流