8
n8n 中文网amn8n.com

基于GPT-4o和Telegram的交互式俄语辅导机器人

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 Set, Switch, Telegram, AimlApi, TelegramTrigger 等节点。 基于GPT-4o和Telegram的交互式俄语辅导机器人

前置要求
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e95138f4feafe21ee6a9aac976bfd8e9187993130e7b713ed219f955c1b8837d"
  },
  "nodes": [
    {
      "id": "5c259a9b-75bc-4873-bbc2-34a913c46e21",
      "name": "开始:在 Telegram 上接收消息",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -368,
        848
      ],
      "webhookId": "b04097ef-4484-4648-aee4-d3652537c8c3",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "30a57d49-8269-48ac-ac31-7873341c3afa",
      "name": "按输入类型路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        80,
        816
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Vocabulary",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "71a70192-b1c2-44fc-9e0b-cad9cc5eaac4",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
                    "rightValue": "#vocabulary"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Grammar",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1b5b1c7e-99e9-4e6d-a050-2d3c1c22c236",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
                    "rightValue": "#grammar"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Quiz",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a9ad78e2-623b-4d1b-b0b8-bdaebf8bd71c",
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
                    "rightValue": "#quiz"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Any other",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6f3a36ca-2348-4573-bbd7-4aa8088ec296",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Start: Receive Message on Telegram').item.json.message.text }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "notesInFlow": false,
      "typeVersion": 3.2
    },
    {
      "id": "9f15049b-d560-4d93-b71c-f378ddb76abc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 572,
        "height": 356,
        "content": "## 📖 4步快速入门"
      },
      "typeVersion": 1
    },
    {
      "id": "acfa62af-19ff-42a9-8b27-c59b46a6937d",
      "name": "所有其他消息的主提示",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        1104
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"prompt\": \"You are an AI Russian language tutor. The user can choose a mode using hashtags: #vocabulary, #grammar, #quiz. Adapt your response format depending on the mode. The user decides how many items (words, rules, or questions) they want. Your task is to structure the response in the correct style, not to set limits. Always explain clearly in English with Russian examples. Always give feedback and encouragement in Russian at the end. Modes: #vocabulary — teach the requested number of words with pronunciation, examples, and a task. #grammar — explain the requested grammar topic with examples and practice. #quiz — create exactly the number of quiz questions requested, formatted properly, then give answers and feedback. If no hashtag is provided, ask the student to choose a mode. create good looking formatting for telegram. use ** for bold text, instead ###.\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "eececf03-0441-47a3-b5ed-fba1bef88d0f",
      "name": "生成个性化回答",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        688,
        848
      ],
      "parameters": {
        "model": "openai/gpt-4o",
        "prompt": "={{ $json.prompt }}\n\nMessage:\n{{ $('Start: Receive Message on Telegram').item.json.message.text }}",
        "options": {},
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7c387949-7b74-47fc-9150-c65e464283f2",
      "name": "发送消息到 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        912,
        848
      ],
      "webhookId": "fa689c4d-4c59-49c8-bbd6-0ab170d2f659",
      "parameters": {
        "text": "={{ $json.content }}",
        "chatId": "={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2a17ec7d-31bf-4508-8302-39751e8059b1",
      "name": "显示输入指示器",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -144,
        848
      ],
      "webhookId": "fa689c4d-4c59-49c8-bbd6-0ab170d2f659",
      "parameters": {
        "chatId": "={{ $('Start: Receive Message on Telegram').item.json.message.chat.id }}",
        "operation": "sendChatAction"
      },
      "typeVersion": 1.2
    },
    {
      "id": "a4c67a53-9300-429f-a81c-a7c9c6a0c901",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        688
      ],
      "parameters": {
        "height": 368,
        "content": "### 检查 message.text 中的 #vocabulary、#grammar、#quiz,或回退"
      },
      "typeVersion": 1
    },
    {
      "id": "b32afd82-8c14-46f1-a028-ce6b6d69c7d7",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -144
      ],
      "parameters": {
        "color": 4,
        "width": 368,
        "height": 352,
        "content": "## 🔍 节点概览"
      },
      "typeVersion": 1
    },
    {
      "id": "9024416b-fdee-49d0-95f9-098cc08b12da",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        560
      ],
      "parameters": {
        "width": 288,
        "height": 720,
        "content": "## 从给定提示中选择"
      },
      "typeVersion": 1
    },
    {
      "id": "1971bb3f-fe43-4244-915e-825b254a9a8d",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        752
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 272,
        "content": "## 生成并发送回答到 Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "c696bb62-4e7d-454d-b2a9-c0684127b7ac",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        224
      ],
      "parameters": {
        "color": 6,
        "width": 960,
        "height": 272,
        "content": "## 🟡 **示例:**"
      },
      "typeVersion": 1
    },
    {
      "id": "6983ce9e-0209-4928-9884-c9ed3c2c5dc7",
      "name": "词汇提示",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        656
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"prompt\": \"You are a Russian language tutor focused on expanding the student's vocabulary. The student will specify how many words they want to learn. Provide exactly that number of Russian words with English translations. Show pronunciation in Latin transcription. Use each word in a simple Russian sentence with English translation. At the end, give a small interactive task where the student can practice using some of the new words. create good looking formatting for telegram. use ** for bold text, instead ###. #vocabulary\"\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "0934b8df-9b9c-41d9-8a86-88b252fc7c73",
      "name": "语法提示",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        800
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"prompt\": \"You are a Russian grammar tutor. The student may ask about a specific grammar rule or request an explanation of a topic. Provide a clear explanation in English with Russian examples. Adjust the depth and number of examples based on the student's request. Ask the student to practice by forming their own sentences. Provide gentle corrections and explanations. create good looking formatting for telegram.  use ** for bold text, instead ###. #grammar\"\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "a6c5ca38-12d4-4dfa-b002-30ffe4af8123",
      "name": "测验提示",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        960
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"prompt\": \"You are a Russian language tutor creating quizzes or exercises. The student decides how many questions they want. Format all tasks in a quiz-friendly style (multiple-choice, translation, or fill-in-the-blank). After the student answers, provide correct solutions and short explanations. End with positive feedback in Russian. create good looking formatting for telegram.  use ** for bold text, instead ###.#quiz\"\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "46003c53-9ef7-4b53-88c2-06bce360209b",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        768
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 272,
        "content": "### 检查消息并模拟输入状态"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Quiz prompt": {
      "main": [
        [
          {
            "node": "Generate personalised answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Grammar prompt": {
      "main": [
        [
          {
            "node": "Generate personalised answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vocabulary prompt": {
      "main": [
        [
          {
            "node": "Generate personalised answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Input Type": {
      "main": [
        [
          {
            "node": "Vocabulary prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Grammar prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Quiz prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Main prompt for all other messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Show Typing Indicator": {
      "main": [
        [
          {
            "node": "Route by Input Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate personalised answer": {
      "main": [
        [
          {
            "node": "Send message to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Main prompt for all other messages": {
      "main": [
        [
          {
            "node": "Generate personalised answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start: Receive Message on Telegram": {
      "main": [
        [
          {
            "node": "Show Typing Indicator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

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

分享此工作流