8
n8n 中文网amn8n.com

使用Google Gemini和人工参与学习的自动邮件支持

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 29 个节点。主要使用 If, Set, Gmail, Aggregate, GmailTrigger 等节点。 使用Google Gemini和人工参与学习的自动邮件支持

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "creator": "Lucas Peyrin",
    "instanceId": "e409ea34548a2afe2dffba31130cd1cf2e98ebe2afaeed2a63caf2a0582d1da0",
    "fingerprint": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdG9yIjoiIiwiaXNzIjoibjhuIiwiaWF0IjoxNzU4MzgwNzc3fQ.1x5AudcSMfOLmN3bOMOaoa0nYwTVqmUmsu48ZIwFgOQ",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "38a0c40a-710d-4571-9ff2-8775c4dc7d46",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        688,
        272
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "eb3871a5-141e-47e3-87a7-adac0ce08c90",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -768,
        128
      ],
      "parameters": {
        "autoFix": true,
        "jsonSchemaExample": "{\n  \"answerFound\": true,\n  \"responseEmailHtml\": \"AI-generated response or empty if not found\",\n  \"summarizedQuestion\": \"Standardized/summarized version of the customer question\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e4901bb9-08e4-4312-be91-c0e73cc8f563",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "找到支持答案",
      "type": "n8n-nodes-base.if",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -608,
        -80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f852c674-481e-4732-8eee-93e2fc1e37cc",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Find Answer with AI').last().json.output.answerFound }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c0df0cb1-4d45-4d48-b008-f2da5d0b54c0",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "这是支持请求吗?",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2144,
        -80
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $('On New Email Received').item.json.text }}",
        "categories": {
          "categories": [
            {
              "category": "support"
            },
            {
              "category": "other"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "03c489d0-75c3-442b-9e2b-2faaa2c858f4",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "为 AI 格式化问答对",
      "type": "n8n-nodes-base.set",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1504,
        -80
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"question\": {{ $json.Question.toJsonString() }},\n  \"answer\": {{ $json.Answer.toJsonString() }}\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "7c4f23a6-e3b1-44e6-a9d1-f8a62360c613",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "合并为知识上下文",
      "type": "n8n-nodes-base.aggregate",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1280,
        -80
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "e060cb71-e63b-4f61-aabb-c196b042d050",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "AI:创建可重用的问答",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        48,
        64
      ],
      "parameters": {
        "text": "=<inputs>\n<customer_question>\n{{ $('On New Email Received').item.json.text }}\n</customer_question>\n<expert_answer>\n{{ $('Ask Human for Help').last().json.data.text }}\n</expert_answer>\n</inputs>",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=<role>\nYou are an expert AI assistant specialized in knowledge base management. Your task is to distill human conversations into clean, reusable question-and-answer pairs for an automated support system. You must transform a specific customer query and an expert's ad-hoc reply into a generic, canonical entry that can be used to help many other users in the future.\n</role>\n\n<instructions>\n<goal>\nYour goal is to take an original customer question and the corresponding answer provided by a human expert, and transform them into a standardized, generic, and reusable Question/Answer pair. This new entry must be suitable for an automated system to use for future, similar inquiries.\n</goal>\n\n<context>\nThis task is part of a 'human-in-the-loop' automated customer support workflow. When the system cannot answer a customer's email using its existing knowledge base (a Google Sheet), the question is forwarded to a human expert. You are now receiving the original question and the expert's reply.\n\nYour generated Q&A pair will be added as a new row to the Google Sheet knowledge base. This will allow the system to answer this question automatically next time.\n\nKey principles to follow:\n1.  **Generalize the Question:** Rephrase the customer's question to be generic and universally applicable. Remove any personal information (names, specific order numbers, account details, etc.) and formulate it as a general query that other customers might ask.\n2.  **Refine the Answer:** Clean up the expert's reply. It should be a complete, well-formatted, and polite response that is ready to be sent directly to a customer without further editing. Remove conversational filler like \"Hi John,\" or \"Hope this helps!\".\n3.  **Capture the Essence:** The final Q&A pair should accurately represent the core problem and its solution.\n</context>\n\n<examples>\n<example_1>\n<inputs>\n<customer_question>\nHi, my name is Jane Doe and I ordered a blue widget last Tuesday (order #12345). I haven't received a shipping confirmation yet. Can you tell me how long shipping usually takes to California? Thanks, Jane\n</customer_question>\n<expert_answer>\nHey Jane, I checked your order. It's currently being processed. For future reference, our standard shipping to the US West Coast is typically 5-7 business days. Cheers.\n</expert_answer>\n</inputs>\n<output>\n{\n  \"question\": \"What are the standard shipping times to the US West Coast?\",\n  \"answer\": \"Standard shipping to the US West Coast typically takes 5-7 business days after your order has been processed. You will receive a shipping confirmation email with a tracking number as soon as your order is dispatched.\"\n}\n</output>\n</example_1>\n\n<example_2>\n<inputs>\n<customer_question>\nI can't find where to reset my API key on my dashboard. I looked in the settings but it's not there. Help!\n</customer_question>\n<expert_answer>\nNo problem. To do that, you need to go to the 'Developer' section, not 'Settings'. From there, you'll see a 'Revoke Key' button. Click that and a new one will be generated for you.\n</expert_answer>\n</inputs>\n<output>\n{\n  \"question\": \"How do I reset my API key?\",\n  \"answer\": \"You can reset your API key by following these steps:\\n1. Log in to your account and navigate to the 'Developer' section in your dashboard.\\n2. Click on the 'Revoke Key' button.\\n3. A new API key will be automatically generated for you.\"\n}\n</output>\n</example_2>\n\n<example_3>\n<inputs>\n<customer_question>\nmy bill is higher this month?? i dont understand why\n</customer_question>\n<expert_answer>\nHi, we recently updated our pricing for the Pro plan from $49/month to $55/month to reflect new features we've added. We sent out an email about this last month. This is the first billing cycle with the new price.\n</expert_answer>\n</inputs>\n<output>\n{\n  \"question\": \"Why did my monthly subscription price increase?\",\n  \"answer\": \"We recently updated our pricing to reflect the addition of new features to our plans. If you have noticed an increase in your monthly bill, it is likely due to this planned pricing adjustment. All users were notified via email prior to the change.\"\n}\n</output>\n</example_3>\n</examples>\n\n\n<output_format>\nYou must provide your response as a single, valid JSON object. The object should contain two keys: \"question\" and \"answer\". Do not include any other text, explanations, or markdown formatting around the JSON object.\n\n{\n  \"question\": \"The generated generic question.\",\n  \"answer\": \"The clean, customer-ready answer.\"\n}\n</output_format>\n</instructions>\n\n<inputs>\n<customer_question>\n[The original, verbatim email or question from the customer.]\n</customer_question>\n<expert_answer>\n[The verbatim reply provided by the human expert.]\n</expert_answer>\n</inputs>"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "038bc2f0-0f96-4bff-9831-ef1a4b2e91e8",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "收到新邮件时",
      "type": "n8n-nodes-base.gmailTrigger",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2368,
        -80
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "osqDjY9L6cIaDOYh",
          "name": "Franck"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "be228b52-d891-481d-a3e9-1ac995321f0d",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "发送 AI 答案",
      "type": "n8n-nodes-base.gmail",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -304,
        -224
      ],
      "webhookId": "0680d84b-44f4-4b36-be51-c6a4b794221d",
      "parameters": {
        "sendTo": "={{ $('On New Email Received').item.json.from.value[0].address }}",
        "message": "={{ $json.output.responseEmailHtml }}",
        "options": {},
        "subject": "=Re: {{ $('On New Email Received').item.json.subject }} - Automated Response"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "osqDjY9L6cIaDOYh",
          "name": "Franck"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a5a7d86b-4567-43d8-aa69-ba3b3a7b831c",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "向人类寻求帮助",
      "type": "n8n-nodes-base.gmail",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -304,
        64
      ],
      "webhookId": "7e4bb191-4314-4bd0-9dd9-fdda8f64e8e5",
      "parameters": {
        "sendTo": "franckramarojohn+expert@gmail.com",
        "message": "=Hello,\n\nOur automated support system has received a question for which we don't yet have an answer in our knowledge base.\n\n**ORIGINAL CUSTOMER QUESTION:** {{ $('Find Answer with AI').last().json.output.summarizedQuestion }}\n---\nFrom: {{ $('On New Email Received').item.json.from.value[0].address }}\nSubject: {{ $('On New Email Received').item.json.subject }}\n\n{{ $('On New Email Received').item.json.text }}\n---\n\n**ACTION REQUIRED:**\nPlease reply to this email with:\n1. The complete answer to provide to the customer\n2. Any additional information that might be useful for similar questions\n\nYour response will automatically be:\n- Sent to the customer ({{ $('On New Email Received').item.json.from.value[0].address }})\n- Added to our knowledge base for future similar questions\n\nBest regards,\nAutomated Support System",
        "options": {
          "responseFormTitle": "New Support Question",
          "messageButtonLabel": "Submit Answer",
          "responseFormDescription": "=**QUESTION:** {{ $('Find Answer with AI').last().json.output.summarizedQuestion }}\\n\\n**CUSTOMER DETAILS:**\\nFrom: {{ $('On New Email Received').item.json.from.value[0].address }}\\nSubject: {{ $('On New Email Received').item.json.subject }}\\n\\n**ORIGINAL MESSAGE:**\\n{{ $('On New Email Received').item.json.text }}\\n\\n---\\n\\nPlease provide your complete response below. Your answer will be automatically sent to the customer and added to our knowledge base for future similar questions."
        },
        "subject": "[AUTO SUPPORT] New question requiring your expertise",
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "osqDjY9L6cIaDOYh",
          "name": "Franck"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b1da195b-0232-438f-a516-5006b2c5e872",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "添加到知识库",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        448,
        64
      ],
      "parameters": {
        "columns": {
          "value": {
            "Answer": "={{ $json.output.answer }}",
            "Question": "={{ $json.output.question }}"
          },
          "schema": [
            {
              "id": "Question",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Question",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Answer",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Answer",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Question"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit#gid=0",
          "cachedResultName": "QA Database"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit?usp=drivesdk",
          "cachedResultName": "Knowledge Base"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Jm5AZF6bLFU5GPhZ",
          "name": "Franck"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "930fd9c5-7601-4dbc-88ed-a15b77605588",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "获取知识库",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1744,
        -80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit#gid=0",
          "cachedResultName": "QA Database"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LOpNIXzAy0cng1xSqAi2gNfzXfRGNhC6UQb8etlHSbE/edit?usp=drivesdk",
          "cachedResultName": "Knowledge Base"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Jm5AZF6bLFU5GPhZ",
          "name": "Franck"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "598ea1ca-f3c7-44ec-84d9-68eaab365ca7",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -720,
        -336
      ],
      "parameters": {
        "color": 5,
        "width": 336,
        "height": 304,
        "content": "### 工作原理"
      },
      "typeVersion": 1
    },
    {
      "id": "b681744b-3571-4999-bda1-f92590bd7d9c",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "使用 AI 查找答案",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1056,
        -80
      ],
      "parameters": {
        "text": "=<inputs>\n<customer_email_body>\n{{ $('On New Email Received').item.json.text }}\n</customer_email_body>\n<knowledge_base>\n{{ $('Combine into Knowledge Context').last().json.data.toJsonString() }}\n</knowledge_base>\n</inputs>",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=<role>\nYou are an expert AI Customer Support Agent. Your specialty is to analyze incoming customer inquiries and determine with high confidence if they can be answered using a provided knowledge base. You are a critical part of an automated workflow that decides whether to send an automated reply or escalate the issue to a human expert.\n</role>\n\n<instructions>\n<goal>\nYour goal is to analyze the customer's email and compare it against the entire knowledge base. Based on your analysis, you will perform one of two actions:\n1.  **If a highly relevant answer is found:** You will draft a complete, polite, and helpful email response in HTML format.\n2.  **If no relevant answer is found (or if you have low confidence):** You will summarize the customer's core question into a concise sentence for escalation to a human expert. It is better to escalate than to provide a wrong answer.\n</goal>\n\n<context>\n- The knowledge base is a list of pre-existing \"Question\" and \"Answer\" pairs.\n- You must evaluate the semantic meaning of the customer's question, not just keyword matching.\n- The customer's email might contain greetings, signatures, and other non-essential text. You must focus on the actual question or problem.\n- Your output will be parsed by a machine, so it must strictly follow the specified JSON format.\n- If you find an answer, the `response_email_html` should be a complete email, ready to be sent, including a polite greeting and closing.\n</context>\n\n<examples>\n<example_1>\n<inputs>\n<customer_email_body>\nHello,\n\nI can't seem to find where I can reset my password on your platform. Can you help me?\n\nThanks,\nJohn Doe\n</customer_email_body>\n<knowledge_base>\n[\n  {\"Question\": \"How to update my billing information?\", \"Answer\": \"You can update your billing information in the 'Account > Billing' section of your dashboard.\"},\n  {\"Question\": \"How do I reset my password?\", \"Answer\": \"To reset your password, please go to the login page and click the 'Forgot Password?' link. You will receive an email with instructions.\"},\n  {\"Question\": \"What are your opening hours?\", \"Answer\": \"Our support team is available from 9 AM to 5 PM, Monday to Friday.\"}\n]\n</knowledge_base>\n</inputs>\n<output>\n{\n  \"answerFound\": true,\n  \"responseEmailHtml\": \"<html><body><p>Hello,</p><p>Thank you for contacting us.</p><p>To reset your password, please go to the login page and click the 'Forgot Password?' link. You will receive an email with instructions to set a new one.</p><p>If you need further assistance, please let us know.</p><p>Best regards,<br>The Support Team</p></body></html>\",\n  \"summarizedQuestion\": null\n}\n</output>\n</example_1>\n\n<example_2>\n<inputs>\n<customer_email_body>\nHi there,\n\nMy latest invoice (INV-2023-12-45) seems to have a calculation error on the VAT for the 'Pro Plan' line item. It's showing 20% but my company is VAT exempt. Can you check this?\n\nBest,\nJane Smith\n</customer_email_body>\n<knowledge_base>\n[\n  {\"Question\": \"How to update my billing information?\", \"Answer\": \"You can update your billing information in the 'Account > Billing' section of your dashboard.\"},\n  {\"Question\": \"Where can I find my invoices?\", \"Answer\": \"All your past invoices are available for download in the 'Account > Billing > Invoices' section.\"},\n  {\"Question\": \"How do I reset my password?\", \"Answer\": \"To reset your password, please go to the login page and click the 'Forgot Password?' link.\"}\n]\n</knowledge_base>\n</inputs>\n<output>\n{\n  \"answerFound\": false,\n  \"responseEmailHtml\": null,\n  \"summarizedQuestion\": \"Customer is reporting a specific VAT calculation error on their latest invoice.\"\n}\n</output>\n</example_2>\n</examples>\n\n\n<output_format>\nYou MUST provide your response as a single, valid JSON object. Do not add any text before or after the JSON object. The JSON object must have the following structure:\n\n```json\n{\n  \"answerFound\": <boolean>,\n  \"responseEmailHtml\": <string | null>,\n  \"summarizedQuestion\": <string | null>\n}\n```\n\n- `answerFound`: (boolean) Set to `true` ONLY if you found a highly relevant answer in the knowledge base with high confidence. Otherwise, set to `false`.\n- `responseEmailHtml`: (string or null) If `answer_found` is `true`, this field must contain the full HTML content of the email to be sent to the customer. If `answer_found` is `false`, this field must be `null`.\n- `summarizedQuestion`: (string or null) If `answer_found` is `false`, this field must contain a concise, one-sentence summary of the customer's problem for a human expert. If `answer_found` is `true`, this field must be `null`.\n</output_format>\n</instructions>\n\n<inputs>\n<customer_email_body>\n[The full, raw text content of the incoming customer email will be placed here.]\n</customer_email_body>\n<knowledge_base>\n[A JSON array of objects, where each object has a \"Question\" and \"Answer\" key, representing the entire knowledge base from the Google Sheet, will be placed here.]\n</knowledge_base>\n</inputs>"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "b27cf69f-ea3b-412f-8d38-53a48930c76e",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Google Gemini 2.5 Pro",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1088,
        128
      ],
      "parameters": {
        "options": {
          "temperature": 0
        },
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "e4fac013-1b3a-4f6d-80b6-09fb74cf9684",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Google Gemini 2.5 Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        32,
        288
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "8dcecb5a-918d-436d-8b1d-7e400cd4b631",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Gemma",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -912,
        128
      ],
      "parameters": {
        "options": {
          "temperature": 0
        },
        "modelName": "models/gemma-3-27b-it"
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "05ae50cd-2b0b-4edc-96b4-56ff900ea105",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Google Gemini 2.5 Flash Lite",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2080,
        64
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-lite"
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "e70bad34-7e23-4eb9-9bf2-65a1caec85aa",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "结构化输出解析器 (1)",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        208,
        288
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"question\": \"The generated generic question.\",\n  \"answer\": \"The clean, customer-ready answer.\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1b9f2c45-f15a-4331-9ebd-c6c2325d5226",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (0)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -3056,
        -320
      ],
      "parameters": {
        "color": 0,
        "width": 416,
        "height": 616,
        "content": "## 🤖 带有人工介入的自我改进邮件 AI 支持"
      },
      "typeVersion": 1
    },
    {
      "id": "cdd8f3df-5421-479f-a3fc-c4c937209b46",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (3)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2144,
        0
      ],
      "parameters": {
        "color": "3",
        "width": 224,
        "height": 508,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0d85f239-3c58-442b-8214-341e69c8c3f9",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (4)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1744,
        -320
      ],
      "parameters": {
        "color": 3,
        "width": 334,
        "height": 286,
        "content": "此工作流使用 Google Sheet 作为其知识库。"
      },
      "typeVersion": 1
    },
    {
      "id": "9a43057d-44a3-48ea-9bef-35549006f365",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (5)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -304,
        -48
      ],
      "parameters": {
        "color": "6",
        "width": 300,
        "height": 154,
        "content": "设置您的人类专家的**收件人**邮件地址。这是 AI 无法回答的问题将被转发的地方。"
      },
      "typeVersion": 1
    },
    {
      "id": "3da661f7-886e-414e-baa6-0a3d7c7ebac7",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (6)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -1056,
        -272
      ],
      "parameters": {
        "color": "7",
        "width": 222,
        "height": 252,
        "content": "这是核心 AI,尝试在您的知识库中查找答案。"
      },
      "typeVersion": 1
    },
    {
      "id": "ef38413d-2c41-4654-9fea-3b0ba79becb8",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (7)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        48,
        -48
      ],
      "parameters": {
        "color": "7",
        "width": 350,
        "height": 156,
        "content": "此 AI 节点是'学习'组件。在人类专家回复后,此 AI 处理他们的答案和原始问题,为您的知识库创建一个新的、可重用的问答对。"
      },
      "typeVersion": 1
    },
    {
      "id": "3531d240-1348-4162-88d4-2136fe5738ca",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (8)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -944,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 446,
        "height": 218,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "fb646660-1854-42bf-96a8-5cadabbdeb0d",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (9)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2144,
        -208
      ],
      "parameters": {
        "color": "7",
        "width": 220,
        "height": 168,
        "content": "此节点使用 AI 对收到的邮件进行分类,确保只有相关的支持请求通过工作流处理。"
      },
      "typeVersion": 1
    },
    {
      "id": "d7513dd8-2136-4ea3-a1b3-9b547b1069f4",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (10)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -2576,
        -144
      ],
      "parameters": {
        "color": "7",
        "width": 300,
        "height": 136,
        "content": "💡 配置完成后,激活此工作流以开始自动处理收到的邮件!"
      },
      "typeVersion": 1
    },
    {
      "id": "2f5d1f07-fc15-4a7b-aac9-5c10d8c07913",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 (11)",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        448,
        -48
      ],
      "parameters": {
        "color": "7",
        "width": 300,
        "height": 168,
        "content": "检查您的 Google Sheet!由 AI 生成的新问答对(来自人类专家回复)将添加到这里。"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "On New Email Received": [
      {
        "id": "198f2243190870a1",
        "to": {
          "html": "<span class=\"mp_address_group\"><a href=\"mailto:support@monentreprise.com\" class=\"mp_address_email\">support@monentreprise.com</a></span>",
          "text": "franckramarojohn@gmail.com",
          "value": [
            {
              "name": "",
              "address": "support@monentreprise.com"
            }
          ]
        },
        "date": "2025-08-28T19:25:14.000Z",
        "from": {
          "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">CoinTracker</span> &lt;<a href=\"mailto:hello@mail.cointracker.io\" class=\"mp_address_email\">hello@mail.cointracker.io</a>&gt;</span>",
          "text": "\"CoinTracker\" <hello@mail.cointracker.io>",
          "value": [
            {
              "name": "Marie Dupont",
              "address": "marie.dupont@email.com"
            }
          ]
        },
        "html": "",
        "text": "Hello, How do I backup my data? I want to make sure I don't lose anything important. Thanks, Marie Dupont",
        "headers": {
          "to": "To: support@monentreprise.com",
          "date": "Date: Thu, 28 Aug 2025 19:25:14 +0000",
          "from": "From: Marie Dupont <marie.dupont@email.com>",
          "sender": "Sender: hello@mail.cointracker.io",
          "subject": "Subject: Data backup question",
          "arc-seal": "ARC-Seal: i=1; a=rsa-sha256; t=1756409114; cv=none;\r\n        d=google.com; s=arc-20240605;\r\n        b=kz8hDF0g66yFEwsm/B5xbeEXDYOZ09+LzwUAcmoYfaDvm2NOG1brrUpxsneCi2NdAa\r\n         UPufJrfLE3QpvKUN2D/7ESBqnvtC4kAsWMjt8113O6Cs/Hyf0mlJ3o6KMreWRHNtQcU1\r\n         VGry8wVyBqRJHDv+8+bbuD0GOy4ZkY0+SCDOFDwLVSnnn4wzWjJoWjDh7vK/h9nNUcsf\r\n         gq0vJQDEUCoPGI6gPEVE96qP94r/1jZrUU3enJiKZgGtmqkxieqVzZD/JsWnB18vOCvm\r\n         VePC7GqCw8yJ4eS0bVJEAfRSqpu3noMMFfdaB5DhZMFeHKGaivTe5XuMTrYmVAJVNozO\r\n         nqrg==",
          "received": "Received: by 2812c4974c74e5b88a66540f689aacee554e1769a0dba49bb2f7e5165f24690e with HTTP\r\n id 68b0ad1a9504e1e4d5e5d3d4; Thu, 28 Aug 2025 19:25:14 GMT",
          "reply-to": "Reply-To: hello@mail.cointracker.io",
          "message-id": "Message-Id: <20250828192514.5d2dd0507925e3e5@mail.cointracker.io>",
          "x-received": "X-Received: by 2002:a05:6214:2a45:b0:70b:7076:cd13 with SMTP id 6a1803df08f44-70d970c4cd1mr316854346d6.2.1756409114999;\r\n        Thu, 28 Aug 2025 12:25:14 -0700 (PDT)",
          "feedback-id": "Feedback-ID: 13010910:9854831:77108:iterable",
          "return-path": "Return-Path: bounces@mail.cointracker.io",
          "content-type": "Content-Type: multipart/alternative;\r\n boundary=\"7fbdbbd48cc085d0f6ffc1f0a6bc5675cac442225d1247d6f54a4799ee77\"",
          "delivered-to": "Delivered-To: franckramarojohn@gmail.com",
          "mime-version": "Mime-Version: 1.0",
          "received-spf": "Received-SPF: pass (google.com: domain of bounce+12f7e6.74a072-franckramarojohn=gmail.com@mail.cointracker.io designates 159.112.240.15 as permitted sender) client-ip=159.112.240.15;",
          "x-message-id": "X-Message-ID: f42747250a9b4d00abff0e4213880fe9",
          "x-campaign-id": "X-Campaign-ID: 9854831",
          "x-feedback-id": "X-Feedback-ID: 13010910:9854831:77108:iterable",
          "x-mailgun-sid": "X-Mailgun-Sid: WyIwYTg3MyIsImZyYW5ja3JhbWFyb2pvaG5AZ21haWwuY29tIiwiNzRhMDcyIl0=",
          "dkim-signature": "DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mailgun.org; q=dns/txt; s=mg; t=1756409114; x=1756416314;\r\n h=Message-Id: X-Feedback-ID: Reply-To: To: To: From: From: Subject: Subject: Content-Type: Mime-Version: Date: Sender: Sender: X-Feedback-Id;\r\n bh=wgXfZa5XGKpP9Gr3fj3z8NsMHezBHd8a/Tw2wwnXUuU=;\r\n b=Q2X1hxDf1ntwGnHyAXA7srjAqtcyTGbb13j5WTBrAiffIEmuBj5lC74Ds8maq/80viiVJZeXX8Ky/3+AeTBf4LqmSIqTv/hbe7EQ3/wUH8iik3urCSXSMZC/o6I6WlTQTV/XolS8nJBdybdaI/7FlJsGYUzN3vlQLOHSZMmRCe4=",
          "x-mailgun-variables": "X-Mailgun-Variables: {\"metadata\":\r\n \"{\\\"messageId\\\":\\\"f42747250a9b4d00abff0e4213880fe9\\\",\\\"templateId\\\":13010910,\\\"projectId\\\":18171,\\\"campaignId\\\":9854831}\"}",
          "x-google-smtp-source": "X-Google-Smtp-Source: AGHT+IHPYGWAOLAO6xALxv3qzQd8OAFIm8wMnt4tHt4OEyFVCMUyWfmRGWK8MrpjBUq6C/5ebpyA",
          "x-mailgun-sending-ip": "X-Mailgun-Sending-Ip: 159.112.240.15",
          "arc-message-signature": "ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;\r\n        h=message-id:reply-to:feedback-id:to:from:subject:mime-version:date\r\n         :sender:dkim-signature:dkim-signature;\r\n        bh=wgXfZa5XGKpP9Gr3fj3z8NsMHezBHd8a/Tw2wwnXUuU=;\r\n        fh=cgh1SkFQ2s/tfAJS7oQg7FzOSrcJO1192dnKmnYvnhY=;\r\n        b=kPOq3DqKQDUrbBPWLnNJXDLvIuXQeof/SuDSQCxBQNKpNp7KzIWWzzZAEevETVhHg/\r\n         OTLHly1EtRKKVvgGon43tGS+CmUEIEUMErok1FuDh1ibrsQi9Twdc2yB182uq13GCXGa\r\n         nKgOFqKltnljictwz/ynEs8PT87qD8Gmm7lZ7PGapmAVfAoxwrivEIY/U5Ld7Tzw4CjC\r\n         KcJJd96h1trolVSom4pboMZViQO3ulTFZjTrLMtVc10ekAUPiBYncQEeFfDREcGaDyPW\r\n         uTlJCZfL9apQ3CHhbwCX7qWQ5rBpHadXZn9csTy+eb7tW9BpHyd5dbgGSN3RlOMxCkqL\r\n         QywA==;\r\n        dara=google.com",
          "authentication-results": "Authentication-Results: mx.google.com;\r\n       dkim=pass header.i=@mail.cointracker.io header.s=pic header.b=jHcmnbeI;\r\n       dkim=pass header.i=@mailgun.org header.s=mg header.b=Q2X1hxDf;\r\n       spf=pass (google.com: domain of bounce+12f7e6.74a072-franckramarojohn=gmail.com@mail.cointracker.io designates 159.112.240.15 as permitted sender) smtp.mailfrom=\"bounce+12f7e6.74a072-franckramarojohn=gmail.com@mail.cointracker.io\";\r\n       dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cointracker.io",
          "x-mailgun-sending-ip-pool": "X-Mailgun-Sending-Ip-Pool: 63c9c37bf8e6a9a11ba8b937",
          "arc-authentication-results": "ARC-Authentication-Results: i=1; mx.google.com;\r\n       dkim=pass header.i=@mail.cointracker.io header.s=pic header.b=jHcmnbeI;\r\n       dkim=pass header.i=@mailgun.org header.s=mg header.b=Q2X1hxDf;\r\n       spf=pass (google.com: domain of bounce+12f7e6.74a072-franckramarojohn=gmail.com@mail.cointracker.io designates 159.112.240.15 as permitted sender) smtp.mailfrom=\"bounce+12f7e6.74a072-franckramarojohn=gmail.com@mail.cointracker.io\";\r\n       dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cointracker.io",
          "x-mailgun-sending-ip-pool-name": "X-Mailgun-Sending-Ip-Pool-Name: Cointracker_mktg"
        },
        "replyTo": {
          "html": "<span class=\"mp_address_group\"><a href=\"mailto:marie.dupont@email.com\" class=\"mp_address_email\">marie.dupont@email.com</a></span>",
          "text": "marie.dupont@email.com",
          "value": [
            {
              "name": "",
              "address": "marie.dupont@email.com"
            }
          ]
        },
        "subject": "Data backup question",
        "labelIds": [
          "UNREAD",
          "CATEGORY_UPDATES",
          "INBOX"
        ],
        "threadId": "198f2243190870a1",
        "messageId": "<20250828192514.5d2dd0507925e3e5@mail.cointracker.io>",
        "sizeEstimate": 53535
      }
    ]
  },
  "connections": {
    "Gemma": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Ask Human for Help": {
      "main": [
        [
          {
            "node": "AI: Create Reusable Q&A",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Knowledge Base": {
      "main": [
        [
          {
            "node": "Format Q&A Pairs for AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Answer with AI": {
      "main": [
        [
          {
            "node": "Support Answer Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Support Answer Found": {
      "main": [
        [
          {
            "node": " Send AI Answer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ask Human for Help",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add to Knowledge Base": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 2.5 Pro": {
      "ai_languageModel": [
        [
          {
            "node": "Find Answer with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On New Email Received": {
      "main": [
        [
          {
            "node": "Is it a Support Request?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Create Reusable Q&A": {
      "main": [
        [
          {
            "node": "Add to Knowledge Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Q&A Pairs for AI": {
      "main": [
        [
          {
            "node": "Combine into Knowledge Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 2.5 Flash": {
      "ai_languageModel": [
        [
          {
            "node": "AI: Create Reusable Q&A",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Is it a Support Request?": {
      "main": [
        [
          {
            "node": "Get Knowledge Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Get Knowledge Base",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Find Answer with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini 2.5 Flash Lite": {
      "ai_languageModel": [
        [
          {
            "node": "Is it a Support Request?",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser (1)": {
      "ai_outputParser": [
        [
          {
            "node": "AI: Create Reusable Q&A",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Combine into Knowledge Context": {
      "main": [
        [
          {
            "node": "Find Answer with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Lucas Peyrin

Lucas Peyrin

@lucaspeyrin

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline. Join the N8N Academy:

外部链接
在 n8n.io 查看

分享此工作流