{
  "name": "名片 OCR",
  "nodes": [
    {
      "parameters": {
        "options": {
          "allowFileUploads": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -180,
        0
      ],
      "id": "3d41a831-de84-438e-a513-02dfb42537e6",
      "name": "When chat message received",
      "webhookId": "0785196c-942b-4edd-97bc-cdbf66ddd3fb",
      "notesInFlow": true
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "附上的圖片是一張名片，請你透過這張名片上的訊息，列出這張名片擁有者的：\n姓名、公司名稱、電話號碼、地址、E-mail，\n\n並輸出成這樣的格式：\n\n{\n\t\"1005414\": \"姓名\",\n\t\"1005415\": \"公司名稱\",\n\t\"1005416\": \"電話號碼\",\n\t\"1005417\": \"地址\",\n\t\"1005418\": \"E-mail\"\n}",
        "options": {
          "systemMessage": "**IMPORTANT**：The response should only include the content between { and }, do not include any kind of notes or control characters such like \"```\" or \"json\". If any information is not able to be find in the image, simply output as \"null\". "
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        220,
        0
      ],
      "id": "bda2b84b-b26d-4efc-a5f0-80200218d9fc",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-1.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        220,
        220
      ],
      "id": "ce7f8d0b-e03c-49ea-9b97-8053bc7f3081",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "PjcpFVnJdJOfrxd6",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "content": "## 觸發端\n在 n8n 的聊天窗上傳名片時",
        "height": 80,
        "width": 200
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -180,
        -100
      ],
      "id": "f57c83d1-12db-403e-99f8-e22b340cb1c3",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## AI\n透過 Gemini 分析名片上的姓名、公司、電話、地址、E-mail 等\n輸出到指定的欄位",
        "height": 100,
        "width": 420
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        140,
        360
      ],
      "id": "49ad26c4-7a94-4247-820e-a0ceb7d1ca69",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "action": "createNewData",
        "method": "fieldMode",
        "form": "jaykeeRagic/n8n/3",
        "entries": {
          "fieldMode_map": [
            {
              "entries_field": "1005414",
              "entries_value": "={{ $json['1005414'] }}"
            },
            {
              "entries_field": "1005415",
              "entries_value": "={{ $json['1005415'] }}"
            },
            {
              "entries_field": "1005416",
              "entries_value": "={{ $json['1005416'] }}"
            },
            {
              "entries_field": "1005417",
              "entries_value": "={{ $json['1005417'] }}"
            },
            {
              "entries_field": "1005418",
              "entries_value": "={{ $json['1005418'] }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-ragic.ragic",
      "typeVersion": 1,
      "position": [
        940,
        0
      ],
      "id": "f9f60853-ce1a-4840-ac2d-5634a2666b3c",
      "name": "Ragic",
      "credentials": {
        "ragicApi": {
          "id": "pt1mwghbNfrCX1TX",
          "name": "Ragic account"
        }
      }
    },
    {
      "parameters": {
        "content": "## 寫入 Ragic\n\n在指定的表單建檔",
        "height": 120,
        "width": 220
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        940,
        180
      ],
      "id": "57a516fa-a2a2-4fdf-8ed9-cf93ab78438a",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ $json.output }}",
        "options": {
          "dotNotation": false
        }
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        640,
        0
      ],
      "id": "a1e96bdc-c7f2-4524-a98e-e68748271a98",
      "name": "Edit Fields",
      "alwaysOutputData": false
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ragic": {
      "main": [
        []
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Ragic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f9c080dd-c68e-4fd6-918b-50cfd3644756",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "fbfca0660bcf0e8b7388d2ddcfc9eae88e97c39282817fb567eeb6c2801a5111"
  },
  "id": "EXKJ3X4rNMS48P1X",
  "tags": []
}