8
n8n 中文网amn8n.com

使用 Gemini 和 Discord 的财务分析报告聊天机器人代理

高级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Set, Code, Discord, Agent, ChatTrigger 等节点。 基于 Gemini 2.5 Flash 和 Discord 的财务分析报告聊天机器人代理

前置要求
  • Discord Bot Token 或 Webhook
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MeoXTIa3v9fjyJEy",
  "meta": {
    "instanceId": "dc6502f6723706f89d6fafb74f8b1c9e62669bc4f6e7235a97b3670f95fa0dfd",
    "templateId": "6270",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Gemini 和 Discord 的财务分析报告聊天机器人代理",
  "tags": [
    {
      "id": "7P7402AT8fl1UgKy",
      "name": "discord",
      "createdAt": "2025-08-24T21:42:42.394Z",
      "updatedAt": "2025-08-24T21:42:42.394Z"
    },
    {
      "id": "TiwQjTi7BRE6rBjx",
      "name": "gemini",
      "createdAt": "2025-08-24T21:42:35.574Z",
      "updatedAt": "2025-08-24T21:42:35.574Z"
    },
    {
      "id": "YXKQkUYk2OAFiNjz",
      "name": "agent",
      "createdAt": "2025-08-24T21:42:51.754Z",
      "updatedAt": "2025-08-24T21:42:51.754Z"
    },
    {
      "id": "izuNj2v182Li85ja",
      "name": "financial",
      "createdAt": "2025-08-24T21:42:48.732Z",
      "updatedAt": "2025-08-24T21:42:48.732Z"
    },
    {
      "id": "luHmOkpwxgGHf47m",
      "name": "ai",
      "createdAt": "2025-08-24T21:42:39.803Z",
      "updatedAt": "2025-08-24T21:42:39.803Z"
    }
  ],
  "nodes": [
    {
      "id": "779e852e-a0b5-4cb7-b385-f9ac277f07a5",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "介绍说明",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        -672,
        224
      ],
      "parameters": {
        "width": 552,
        "height": 908,
        "content": "# 工作原理!"
      },
      "typeVersion": 1
    },
    {
      "id": "cd66718e-e76a-4bc4-9d4b-70f2aba4f0c3",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签12",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        848,
        336
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 252,
        "content": "### 聊天触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "f6cf061b-c11e-49d7-a8fc-e6752e98e14a",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1232,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 396,
        "height": 476,
        "content": "### 代理指令"
      },
      "typeVersion": 1
    },
    {
      "id": "a524c281-bb72-45e9-912e-89e0f0946031",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "示例聊天",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "creator": "Aditya Vadaganadam",
      "position": [
        944,
        432
      ],
      "webhookId": "c4469360-faae-415c-86e2-58c6877acd85",
      "parameters": {
        "public": true,
        "options": {
          "title": "Your Financial AI Agent 🚀",
          "subtitle": "This is for demo purposes. Try me out !",
          "responseMode": "lastNode",
          "inputPlaceholder": "Type your message here...",
          "showWelcomeScreen": false
        },
        "initialMessages": "Hi there! 👋"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0cf8cad8-a2d6-4ff2-aafd-70875e2c127a",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "creator": "Aditya Vadaganadam",
      "position": [
        1344,
        720
      ],
      "parameters": {
        "contextWindowLength": 30
      },
      "typeVersion": 1.3
    },
    {
      "id": "a1d663d0-bc10-4a1a-8807-e7f89453d386",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "连接 Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "adihere",
      "creator": "Aditya Vadaganadam",
      "position": [
        944,
        720
      ],
      "parameters": {
        "options": {
          "temperature": 0,
          "maxOutputTokens": 2048
        },
        "modelName": "models/gemini-2.5-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "iHcmOfLEX7ID1xMU",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "e393c50c-c09e-4687-a5b1-db1fcd3e0c81",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        848,
        672
      ],
      "parameters": {
        "color": 3,
        "width": 294,
        "height": 316,
        "content": "1. [在 Google AI Studio 中](https://aistudio.google.com/app/apikey) 点击 **\"在新项目中创建 API 密钥\"** 并复制它。"
      },
      "typeVersion": 1
    },
    {
      "id": "6d633d90-6de1-4abd-b61f-acd1747f82f5",
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "notes": "The message is via AI agent - DYOR",
      "position": [
        2320,
        416
      ],
      "webhookId": "f5222651-b196-428e-86c9-7df56d46dfea",
      "parameters": {
        "content": "=Welcome to your AI powered financial analyst - {{ $json.$workflow.name }}\n\nYou asked -  {{ $('Example Chat').item.json.chatInput }}\n\nExecutive Summary - {{ $('agent1').item.json.output.idea }}\n\nA bit more of details {{ $json.clean }}\n\nDisclaimer:\nThis application uses generative artificial intelligence (AI) to provide financial insights and analyses. The content generated is for informational purposes only and should not be considered as professional financial advice or a recommendation to buy or sell any securities. Users are strongly encouraged to conduct their own independent research and consult with qualified financial advisors before making any investment decisions.\n\nThe information provided by this AI-powered tool is experimental and may contain errors, inaccuracies, or outdated information. We expressly disclaim any liability for losses or damages resulting from reliance on the content generated by this application. Use at your own risk.",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "id": "Xnz9dVPJXoYm4TIZ",
          "name": "Discord Webhook account"
        }
      },
      "notesInFlow": false,
      "typeVersion": 2
    },
    {
      "id": "fdd3c5fe-c96e-48e3-9880-94204fd7c783",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1312,
        432
      ],
      "parameters": {
        "options": {
          "systemMessage": "=<context>\n### Input\nThe user's query is provided from the previous node:\n\"{{$json[\"query\"]}}\"\n\n### Instructions\n- Analyze the query strictly from a financial analysis perspective. \n- Provide structured insights (such as risks, revenue potential, cost implications, investment outlook, etc.).\n- Be conversational, sarcastic, and bitey, but still educational.\n- Keep the tone frank and truth-focused, not sugar-coated.  \n- Finish with a short but clear takeaway for the user.\n\n### Output\nGenerate the output in markdown format without any special characters  \n</context>"
        },
        "hasOutputParser": true
      },
      "executeOnce": false,
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "5329ee1f-839f-4f1b-b7f2-e82d1f337942",
      "name": "多表:您可以连接多个表以实现有组织的数据结构",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1584,
        656
      ],
      "parameters": {
        "autoFix": "=",
        "jsonSchemaExample": "{\n\t\"idea\": \"One liner title or idea\",\n\t\"analysis\": \"Analysis of the title \"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1ad975d2-ae80-40e6-93c3-f37ef20cd885",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        1760,
        448
      ],
      "parameters": {
        "jsCode": "let str = $input.first().json.output.analysis\n\n// Remove all special characters except letters, numbers, and spaces\nstr = str.replace(/[^a-zA-Z0-9 ]/g, '');\n\nreturn [{ json: { clean: str } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "3b2b60fd-5051-4731-b652-31d73ac0b337",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        1984,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "955d43bb-46f9-4189-9124-6d22b83c1834",
              "name": "clean",
              "type": "string",
              "value": "={{ $json.clean }}"
            },
            {
              "id": "8b267b8c-76ba-48cc-96f3-01abcd1f15df",
              "name": "output.idea",
              "type": "string",
              "value": "={{ $('agent1').item.json.output.idea }}"
            },
            {
              "id": "c88a0009-7c7f-4ffa-b8c8-3c63937ece3b",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $('Example Chat').item.json.chatInput }}"
            },
            {
              "id": "948d9bd5-d0dd-48af-871c-0258bfa33d03",
              "name": "$workflow.name",
              "type": "string",
              "value": "={{ $workflow.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4dc108f0-6a49-4c02-9b99-bb3ece8f59a7",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2288,
        560
      ],
      "parameters": {
        "color": 4,
        "height": 400,
        "content": "为 Discord 上的频道获取 webhook"
      },
      "typeVersion": 1
    },
    {
      "id": "40b4259b-45ff-4d08-b6a6-715e1450a60c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -240
      ],
      "parameters": {
        "width": 528,
        "height": 384,
        "content": "# 研究代理概述"
      },
      "typeVersion": 1
    },
    {
      "id": "01448704-9c52-4684-878c-67b41d27bf08",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -320
      ],
      "parameters": {
        "width": 672,
        "height": 1360,
        "content": "# 自定义"
      },
      "typeVersion": 1
    },
    {
      "id": "4ea4fa42-cda6-45cd-a158-c9e00ffbdbf5",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1232,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 500,
        "content": "### 对话记忆 — 保持分析主题一致"
      },
      "typeVersion": 1
    },
    {
      "id": "6e895d59-ad8f-4fcf-8db2-bd048ca35e58",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签 16",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1520,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 500,
        "content": "### 结构化输出解析器"
      },
      "typeVersion": 1
    },
    {
      "id": "613964aa-5378-4061-a5fa-3f8ab65c0990",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签17",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1664,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 308,
        "height": 468,
        "content": "### 格式化 Discord 消息 — 最终报告"
      },
      "typeVersion": 1
    },
    {
      "id": "1bfd73d2-1c78-48b4-9f69-55db0e079e58",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "便签18",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "© 2025 Aditya Vadaganadam",
      "creator": "Aditya Vadaganadam",
      "position": [
        1920,
        624
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 436,
        "content": "### 编辑字段 — 将数据映射到 Discord"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6ffd90e1-754d-482b-8af9-c9acb78491df",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "agent1": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Example Chat": {
      "main": [
        [
          {
            "node": "agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Connect Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI 聊天机器人, 多模态 AI

需要付费吗?

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

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

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

作者
aditya vadaganadam

aditya vadaganadam

@adihere

I help technology and business teams evolve through Agile, DevOps, cloud, and modern engineering practices—leveraging generative AI to build smarter, automated solutions. With 20+ years across global markets, I am leading an AI-powered transformations in finance, enabling teams to deliver faster and safer. I hold a Computer Engineering degree and an MBA, and remain hands-on with emerging GenAI, cloud, and DevOps technologies.

外部链接
在 n8n.io 查看

分享此工作流