8
n8n 中文网amn8n.com

🧑‍🎓 基于AI的语言教师(Telegram、Google表格和GPT-4o)

中级

这是一个AI领域的自动化工作流,包含 9 个节点。主要使用 Telegram, Aggregate, GoogleSheets, Agent, TelegramTrigger 等节点,结合人工智能技术实现智能自动化。 🧑‍🎓 基于AI的语言教师(Telegram、Google表格和GPT-4o)

前置要求
  • Telegram Bot Token
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "6a5e68bcca67c4cdb3e0b698d01739aea084e1ec06e551db64aeff43d174cb23",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "bc49829b-45f2-4910-9c37-907271982f14",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1500,
        -520
      ],
      "parameters": {
        "width": 780,
        "height": 540,
        "content": "### 3. 需要更多详细信息吗?"
      },
      "typeVersion": 1
    },
    {
      "id": "80af5237-9046-4b40-ac7c-167d8e0a490f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "Pinyin + Example",
      "position": [
        -2140,
        -140
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "=# Context\nYou are an AI-powered language tutor designed to help {{ $('Telegram Trigger').item.json.message.chat.first_name }} practice Chinese vocabulary efficiently. \n\n# Role\nYour primary role is to generate interactive Multiple-Choice Questions (MCQs) and evaluate the user's responses.\n\n# Types of Exercises\n- MCQ: Provide an English word and four Chinese answer choices, one correct and three incorrect.\n\n# Rules for MCQ Generation\n1. Select a random **Chinese word** from this list {{ $json.targetLanguage }}\n2. Randomly select **three incorrect Chinese options** from the list or outside the list.\n3. **Do NOT mark the correct answer with ✅** in the question.\n4. Present the question in the following format:\nExample Question Format:\nWhat is the correct translation for \"Warehouse\"?\nA) 运输\nB) 仓库 \nC) 合同\nD) 投标\n5. Ask the user to respond with **A, B, C, or D**.\n\n# Evaluating User Responses:\n1. **Wait for the user's answer. Do NOT assume correctness before checking.**\n2. If the user selects the correct answer:\n- Respond positively: \"Great job! ✅ [Correct Answer] [Correct Answer's Pinyin] means [English Meaning].\"\n3. If the user selects the wrong answer:\n- Provide corrective feedback: \"Oops! ❌ The correct answer was [Correct Answer] ([English Meaning]).\"\n4. If the user provides an **invalid response** (e.g., \"Hello\"), ask them to respond with **A, B, C, or D**.\n\n# Post-Evaluation:\n- After giving feedback, always generate another question. Do not ask the user if he wants another question\n\n# Behavior & Tone\n- Be engaging and encouraging.\n- Ensure clarity in feedback.\n- Guide the user patiently if they provide invalid inputs."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": true,
      "typeVersion": 1.7
    },
    {
      "id": "8b35027e-ec5b-4c3e-9a5b-2780b6c40223",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2180,
        100
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "688d6882-4930-407d-bf58-5f6add8eb159",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -2000,
        140
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "33f4a062-73f9-4a99-abca-1184ef2c2a41",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -2960,
        -140
      ],
      "webhookId": "88179da7-9927-4bdc-8bd7-78022810b48e",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "af385807-d024-477e-9a42-c195043e95da",
      "name": "获取词汇表",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2700,
        -140
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 0,
          "cachedResultUrl": "=",
          "cachedResultName": "="
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "=",
          "cachedResultUrl": "=",
          "cachedResultName": "="
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "id": "3ab67ca5-9839-4fa6-bfc1-4dbbaf5593fc",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3000,
        -520
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 540,
        "content": "### 1. 使用 Telegram 消息触发工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "740a2d04-46fe-41f1-b887-f88f3e23c50d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2300,
        -520
      ],
      "parameters": {
        "color": 7,
        "width": 760,
        "height": 780,
        "content": "### 2. 对话式 AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "e92a55dc-6d9d-4008-bb40-72a7f2dd470c",
      "name": "聚合词汇列表",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -2460,
        -140
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "initialLanguage",
              "fieldToAggregate": "initialText"
            },
            {
              "renameField": true,
              "outputFieldName": "targetLanguage",
              "fieldToAggregate": "translatedText"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "18b29677-cfc0-4817-9321-35090a3fda2e",
      "name": "回复用户",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1740,
        -140
      ],
      "webhookId": "=",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    }
  ],
  "pinData": {},
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Answer to the User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Retrive Vocabulary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Retrive Vocabulary": {
      "main": [
        [
          {
            "node": "Aggregate Vocabulary Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Vocabulary Lists": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能

需要付费吗?

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

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

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

作者
Samir Saci

Samir Saci

@samirsaci

Automation, AI and Analytics for Supply Chain & Business Optimization Helping businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and sustainability. Linkedin: www.linkedin.com/in/samir-saci

外部链接
在 n8n.io 查看

分享此工作流