8
n8n 中文网amn8n.com

海豚

中级

这是一个Engineering, AI Chatbot领域的自动化工作流,包含 6 个节点。主要使用 Set, HttpRequest, ChatTrigger 等节点。 使用Novita AI与无审查的Dolphin Mixtral 8x22B对话

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "k4dOhz5YNYLVPUs1",
  "meta": {
    "instanceId": "9219ebc7795bea866f70aa3d977d54417fdf06c41944be95e20cfb60f992db19",
    "templateCredsSetupCompleted": true
  },
  "name": "海豚",
  "tags": [],
  "nodes": [
    {
      "id": "15298662-69ee-4458-a792-9f4878b5fcbd",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -272,
        0
      ],
      "webhookId": "147714d9-629d-4a94-9e62-02f45886c7b6",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "db22e3ea-e88c-463f-bfc8-5897765e10c9",
      "name": "生成聊天补全",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        176,
        0
      ],
      "parameters": {
        "url": "https://api.novita.ai/v3/openai/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"cognitivecomputations/dolphin-mixtral-8x22b\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"{{ $json.systemPrompt }}\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"{{ $('When chat message received').item.json.chatInput }}\"\n    }\n  ],\n  \"max_tokens\": {{ $json.MaxTokens }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.NovitaKey }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "301be5e4-8b78-44c6-83d2-c5a62f6074ef",
      "name": "返回输出",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        0
      ],
      "parameters": {
        "options": {
          "ignoreConversionErrors": false
        },
        "assignments": {
          "assignments": [
            {
              "id": "a497c430-1449-48dd-915b-6c922ec0d56d",
              "name": "output",
              "type": "string",
              "value": "={{ $json.choices[0].message.content.trim() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0fead77e-12d8-40d5-a305-0dec2ea6663a",
      "name": "设置字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fef0c4b6-9451-4848-b681-7ed11461637e",
              "name": "NovitaKey",
              "type": "string",
              "value": "yourNovitakey"
            },
            {
              "id": "215393bd-94bf-4de1-8915-89ccb38f531e",
              "name": "MaxTokens",
              "type": "number",
              "value": 500
            },
            {
              "id": "f987e35d-b291-47b6-b9de-1e5a0d16d468",
              "name": "systemPrompt",
              "type": "string",
              "value": "you are a professional AI helper."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3fb3452f-0d2a-4da8-9306-f2ca6de2cf0c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        208
      ],
      "parameters": {
        "width": 800,
        "height": 240,
        "content": "## 要求"
      },
      "typeVersion": 1
    },
    {
      "id": "f0781099-1e79-47e0-997e-fa34593406df",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -128
      ],
      "parameters": {
        "color": 4,
        "width": 224,
        "height": 320,
        "content": "## 配置"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9bd09b4b-66e4-472c-b7ff-410e7ff59f2f",
  "connections": {
    "Set fields": {
      "main": [
        [
          {
            "node": "Generate Chat Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Chat Completion": {
      "main": [
        [
          {
            "node": "Return output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Set fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 工程, AI 聊天机器人

需要付费吗?

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

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

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

作者
Aitor | 1Node

Aitor | 1Node

@aitoralonso

Hi, I’m Aitor. At 1Node, we help businesses save up to 5 figures annually by deploying private AI infrastructure instead of relying on expensive Cloud Enterprise solutions. As n8n enthusiasts, we love exploring its possibilities and sharing free basic workflows.

外部链接
在 n8n.io 查看

分享此工作流