{
  "createdAt": "2025-09-23T03:56:12.735Z",
  "updatedAt": "2025-09-23T03:57:58.756Z",
  "id": "yDUoo2xMiPyl65Hp",
  "name": "d27-content-automation",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM",
          "mode": "list",
          "cachedResultName": "\u6587\u6848\u4e3b\u984c\u898f\u5283\u8868",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "\u5de5\u4f5c\u88681",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit#gid=0"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "\u751f\u6210\u8349\u7a3f"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -672,
        576
      ],
      "id": "88cc35ca-e998-4125-a4d3-90dde50c1bde",
      "name": "Get row(s) in sheet"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        -448,
        576
      ],
      "id": "99fc79e6-4308-47fd-80b5-8db5666ed30f",
      "name": "Loop Over Items"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -896,
        480
      ],
      "id": "c7125813-28d8-499f-8fb8-cb79e2f98780",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u8acb\u53c3\u8003 Retriever \u7684\u8cc7\u8a0a\u70ba\u57fa\u790e\uff0c\u4e26\u6839\u64da\u4ee5\u4e0b\u53c3\u6578\u751f\u6210\u7d50\u679c\uff1a\n\n\u4e3b\u984c\uff1a{{$json[\"\u4e3b\u984c\"]}}\n\u95dc\u9375\u5b57\uff1a{{$json[\"\u95dc\u9375\u5b57\"]}}\n\u6587\u6848\u98a8\u683c\uff1a{{$json[\"\u6587\u6848\u98a8\u683c\"]}}\n\u76ee\u6a19\u53d7\u773e\uff1a{{$json[\"\u76ee\u6a19\u53d7\u773e\"]}}\n\u5b57\u6578\u9650\u5236\uff1a{{$json[\"\u5b57\u6578\u9650\u5236\"]}}\n\u8f38\u51fa\u5e73\u53f0\uff1a{{$json[\"\u8f38\u51fa\u5e73\u53f0\"]}}\n\n\u8acb\u56b4\u683c\u8f38\u51fa\u70ba JSON \u683c\u5f0f\uff0c\u5167\u5bb9\u5982\u4e0b\uff1a\n{\n  \"\u6587\u6848\": \"\u8acb\u586b\u5165\u7b26\u5408\u4e0a\u8ff0\u689d\u4ef6\u7684\u6587\u6848\u5167\u5bb9\",\n  \"\u5716\u7247\u63cf\u8ff0\u5efa\u8b70\": \"\u8acb\u586b\u5165\u4e00\u6bb5\u5408\u9069\u7684 IG \u5716\u7247\u80cc\u666f\u8a2d\u8a08\u63cf\u8ff0\"\n}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "typeVersion": 1.6,
      "position": [
        -192,
        576
      ],
      "id": "af878e0a-e2ef-4c11-a5e8-709b5a3f8107",
      "name": "Question and Answer Chain"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "typeVersion": 1,
      "position": [
        -96,
        816
      ],
      "id": "f2d23b70-be32-4e0b-a449-df41b298c208",
      "name": "Vector Store Retriever"
    },
    {
      "parameters": {
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {
          "queryName": "match_documents"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        -96,
        1024
      ],
      "id": "1c636345-b356-4820-aea7-5c2491d025b1",
      "name": "Supabase Vector Store"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "typeVersion": 1,
      "position": [
        -16,
        1232
      ],
      "id": "2e5d7c5b-97bc-42db-8a14-1a16000855c4",
      "name": "Embeddings Google Gemini"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -224,
        816
      ],
      "id": "da27d7e6-607b-468a-8737-6472455b5f5c",
      "name": "Google Gemini Chat Model"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM",
          "mode": "list",
          "cachedResultName": "\u6587\u6848\u4e3b\u984c\u898f\u5283\u8868",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "\u5de5\u4f5c\u88681",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $('Get row(s) in sheet').item.json.ID }}",
            "\u751f\u6210\u8349\u7a3f": "={{ $json['\u6587\u6848'] }}",
            "\u5716\u7247\u98a8\u683c\u5efa\u8b70": "={{ $json['\u5716\u7247\u63cf\u8ff0\u5efa\u8b70'] }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u4e3b\u984c",
              "displayName": "\u4e3b\u984c",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u95dc\u9375\u5b57",
              "displayName": "\u95dc\u9375\u5b57",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u6587\u6848\u98a8\u683c",
              "displayName": "\u6587\u6848\u98a8\u683c",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u76ee\u6a19\u53d7\u773e",
              "displayName": "\u76ee\u6a19\u53d7\u773e",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u5b57\u6578\u9650\u5236",
              "displayName": "\u5b57\u6578\u9650\u5236",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u8f38\u51fa\u5e73\u53f0",
              "displayName": "\u8f38\u51fa\u5e73\u53f0",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u5099\u8a3b",
              "displayName": "\u5099\u8a3b",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u751f\u6210\u8349\u7a3f",
              "displayName": "\u751f\u6210\u8349\u7a3f",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "\u5716\u7247\u98a8\u683c\u5efa\u8b70",
              "displayName": "\u5716\u7247\u98a8\u683c\u5efa\u8b70",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "\u78ba\u8a8d\u4f7f\u7528\u6587\u5b57\u5716\u7247\u5efa\u8b70",
              "displayName": "\u78ba\u8a8d\u4f7f\u7528\u6587\u5b57\u5716\u7247\u5efa\u8b70",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u751f\u6210\u5716\u7247\u9023\u7d50",
              "displayName": "\u751f\u6210\u5716\u7247\u9023\u7d50",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "\u78ba\u8a8d\u4f7f\u7528\u5716\u6587",
              "displayName": "\u78ba\u8a8d\u4f7f\u7528\u5716\u6587",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "FB \u9023\u7d50",
              "displayName": "FB \u9023\u7d50",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        496,
        816
      ],
      "id": "ef02fc92-9a2b-457a-bf25-f00dbcb1d637",
      "name": "Update row in sheet"
    },
    {
      "parameters": {
        "jsCode": "return items.map(item => {\n  let raw = item.json.response;\n\n  // \u79fb\u9664 markdown \u683c\u5f0f\u7684\u5305\u88dd ```json ... ```\n  raw = raw.replace(/```json|```/g, '').trim();\n\n  // \u8f49\u6210 JSON\n  let parsed;\n  try {\n    parsed = JSON.parse(raw);\n  } catch (e) {\n    parsed = { error: \"JSON parse failed\", raw };\n  }\n\n  return { json: parsed };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        272,
        576
      ],
      "id": "e4e3bcdb-bb05-4d72-9f58-4352155f2fc6",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "value": "1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM",
          "mode": "list",
          "cachedResultName": "\u6587\u6848\u4e3b\u984c\u898f\u5283\u8868",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "\u5de5\u4f5c\u88681",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1L2aG1su8TDETxXvqAUpgKC_n0WWpaeyRETAwJP0eOUM/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "typeVersion": 1,
      "position": [
        -896,
        672
      ],
      "id": "257cf7a1-123e-42f5-9259-abbd35d7a221",
      "name": "Google Sheets Trigger"
    }
  ],
  "connections": {
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Question and Answer Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Question and Answer Chain": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Retriever": {
      "ai_retriever": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_retriever",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Retriever",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": null,
  "versionId": "c0333fdb-013c-41f1-aeac-58694b865ccc",
  "triggerCount": 0,
  "shared": [
    {
      "createdAt": "2025-09-23T03:56:12.735Z",
      "updatedAt": "2025-09-23T03:56:12.735Z",
      "role": "workflow:owner",
      "workflowId": "yDUoo2xMiPyl65Hp",
      "projectId": "6NV7foKyOeJG8Mz6"
    }
  ],
  "tags": [
    {
      "createdAt": "2025-09-14T06:27:04.834Z",
      "updatedAt": "2025-09-14T06:27:04.834Z",
      "id": "S14KyMmdLj6QsyYh",
      "name": "ithome"
    }
  ]
}