{
  "id": "GenE18",
  "name": "\u5bc4\u51fa\u6307\u5b9a\u540d\u55ae EDM",
  "nodes": [
    {
      "parameters": {
        "content": "\u26a0\ufe0f \u67b6\u69cb\u7bc4\u672c\uff08\u672a\u63a5 key\uff09\n\n\u9700 SMTP \u6191\u8b49 + \u6536\u4ef6\u540d\u55ae\u4f86\u6e90\uff08Sheets/CSV\uff09\u3002\n\u5167\u5bb9\u751f\u6210(Ollama)\u514d\u8cbb\u3002",
        "height": 320,
        "width": 380,
        "color": 4
      },
      "id": "n-note",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        180,
        100
      ]
    },
    {
      "parameters": {},
      "id": "n-manual",
      "name": "When clicking Execute",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const topic='\uff08\u63db\u6210\u4f60\u7684\u4e3b\u984c\u6216\u7d20\u6750\uff09';\nconst prompt='\u4f60\u662f EDM \u6587\u6848\u3002\u6839\u64da\u4e3b\u984c\u5beb\u4e00\u5c01\u884c\u92b7\u96fb\u5b50\u5831\uff08\u7e41\u4e2d\uff09\uff1a\\n\\n\u4e3b\u984c\uff1a'+topic;\nreturn [{json:{topic,prompt}}];"
      },
      "id": "n-input",
      "name": "Input (edit me)",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        460
      ]
    },
    {
      "parameters": {
        "options": {
          "timeout": 180000
        },
        "method": "POST",
        "url": "http://host.docker.internal:11434/api/chat",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'qwen2.5:latest', messages: [ { role: 'system', content: '\u4f60\u662f\u53f0\u7063\u4eba\uff0c\u4e00\u5f8b\u4f7f\u7528\u53f0\u7063\u7e41\u9ad4\u4e2d\u6587\u8207\u53f0\u7063\u6163\u7528\u8a9e\u56de\u8986\uff0c\u7d55\u5c0d\u4e0d\u8981\u51fa\u73fe\u4efb\u4f55\u7c21\u9ad4\u5b57\u6216\u4e2d\u570b\u7528\u8a9e\u3002' }, { role: 'user', content: $json.prompt } ], stream: false }) }}"
      },
      "id": "n-ollama",
      "name": "Generate with Ollama",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const data=$input.first().json;let postText='';try{postText=(data.message&&data.message.content)||'';}catch(e){}\nif(!postText)postText=JSON.stringify(data);return [{json:{postText}}];"
      },
      "id": "n-extract",
      "name": "Extract Text",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        460
      ]
    },
    {
      "parameters": {
        "options": {},
        "fromEmail": "you@example.com",
        "toEmail": "={{ $json.to || 'list@example.com' }}",
        "subject": "EDM",
        "emailFormat": "text",
        "text": "={{ $json.postText }}"
      },
      "id": "n-mail",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1120,
        460
      ]
    }
  ],
  "connections": {
    "When clicking Execute": {
      "main": [
        [
          {
            "node": "Input (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input (edit me)": {
      "main": [
        [
          {
            "node": "Generate with Ollama",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate with Ollama": {
      "main": [
        [
          {
            "node": "Extract Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}