{
  "name": "YT Processing UPDATED",
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb0d7330-0198-43fa-9a74-6d69d84635b8",
              "name": "channel_handle",
              "value": "",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        48,
        80
      ],
      "id": "daaac0a4-933a-4a07-bc2c-3586726f5d3c",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Video ID": "={{ $json.id }}",
            "Channel ID": "={{ $json.snippet.channelId }}",
            "Title": "={{ $json.snippet.title }}",
            "Publish Time": "={{ $json.snippet.publishedAt }}",
            "Channel": "={{ $('Edit Fields').item.json.channel_handle }}",
            "Thumbnail": "={{ $json.snippet.thumbnails.high.url }}",
            "Link": "=https://www.youtube.com/watch?v={{ $json.id }}",
            "View Count": "={{ $json.statistics.viewCount }}",
            "Like Count": "={{ $json.statistics.likeCount }}",
            "Comment Count": "={{ $json.statistics.commentCount }}",
            "Type": "={{ $json.isShort ? 'Short' : 'Video' }}",
            "Seconds": "={{ $json.totalSeconds }}"
          },
          "matchingColumns": [
            "Video ID"
          ],
          "schema": [
            {
              "id": "Video ID",
              "displayName": "Video ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Channel ID",
              "displayName": "Channel ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Channel",
              "displayName": "Channel",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "displayName": "Type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Seconds",
              "displayName": "Seconds",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Publish Time",
              "displayName": "Publish Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Link",
              "displayName": "Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Thumbnail",
              "displayName": "Thumbnail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "View Count",
              "displayName": "View Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Like Count",
              "displayName": "Like Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Comment Count",
              "displayName": "Comment Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Transcript File ID",
              "displayName": "Transcript File ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Transcript Link",
              "displayName": "Transcript Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Vector Status",
              "displayName": "Vector Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "useAppend": true
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1136,
        80
      ],
      "id": "f4d1fea1-73db-4a1d-b34b-a34252eb5537",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "video",
        "returnAll": true,
        "filters": {
          "channelId": "={{ $json.channelId }}"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.youTube",
      "typeVersion": 1,
      "position": [
        592,
        80
      ],
      "id": "e74077e1-23bf-4933-b5b8-0381862bafdc",
      "name": "Get many videos",
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "video",
        "operation": "get",
        "videoId": "={{ $json.id.videoId }}",
        "options": {}
      },
      "type": "n8n-nodes-base.youTube",
      "typeVersion": 1,
      "position": [
        784,
        80
      ],
      "id": "68ce5162-b663-4b6e-bb14-1f8f4d190567",
      "name": "Get a video",
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "function parseYouTubeDuration(duration) {\n  const match = duration.match(/PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?/);\n  const hours = parseInt(match[1] || 0);\n  const minutes = parseInt(match[2] || 0);\n  const seconds = parseInt(match[3] || 0);\n  return hours * 3600 + minutes * 60 + seconds;  // total seconds\n}\n\n\nfor (const item of $input.all()) {\n  const totalSeconds = parseYouTubeDuration(item.json.contentDetails.duration);\n\n  item.json.totalSeconds = totalSeconds;\n  item.json.isShort = totalSeconds <= 180;\n  \n}\n\nreturn $input.all()"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        80
      ],
      "id": "99fbfdc1-7443-41c3-9b4b-976346236998",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "content": "## Add Videos to Sheet",
        "height": 240,
        "width": 1360,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        16
      ],
      "typeVersion": 1,
      "id": "f3531b3e-9d81-4fa9-98a4-7e7e47467662",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Type",
              "lookupValue": "Video"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        48,
        416
      ],
      "id": "93d586c1-6895-4983-b593-9fa3fae76a0b",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://8e1278410a9a.ngrok-free.app/transcript/{{ $json[\"Video ID\"] }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        784,
        368
      ],
      "id": "c4390800-1313-47b1-972a-8ae8cae698c8",
      "name": "Transcribe"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Transcript File ID": "={{ $json.id }}",
            "Transcript Link": "=https://drive.google.com/file/d/{{ $json.id }}",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Video ID",
              "displayName": "Video ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Channel ID",
              "displayName": "Channel ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Channel",
              "displayName": "Channel",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Type",
              "displayName": "Type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Seconds",
              "displayName": "Seconds",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Publish Time",
              "displayName": "Publish Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Link",
              "displayName": "Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Thumbnail",
              "displayName": "Thumbnail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "View Count",
              "displayName": "View Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Like Count",
              "displayName": "Like Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Comment Count",
              "displayName": "Comment Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Transcript File ID",
              "displayName": "Transcript File ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Transcript Link",
              "displayName": "Transcript Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Vector Status",
              "displayName": "Vector Status",
              "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": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1360,
        368
      ],
      "id": "aff6906a-94f7-4d06-a53f-28bfb12b780d",
      "name": "Update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "https://youtube.com/results",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "search_query",
              "value": "={{ $json.channel_handle }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        224,
        80
      ],
      "id": "fb854d7c-1405-456c-938e-5f5fb4e1ff56",
      "name": "Get Channel Search HTML"
    },
    {
      "parameters": {
        "jsCode": "const html = $input.first().json.data;\n\nconst channelIdRegex = /\"channelId\":\"(UC[\\w-]+)\"/g;\nconst handleRegex = /\"canonicalBaseUrl\":\"(\\/@[\\w\\d._-]+)\"/g;\n\nconst channelIds = [...html.matchAll(channelIdRegex)].map(m => m[1]);\nconst handles = [...html.matchAll(handleRegex)].map(m => m[1]);\n\n// Zip the two arrays together (in case they align by order)\nconst results = [];\nconst length = Math.min(channelIds.length, handles.length);\nfor (let i = 0; i < length; i++) {\n  results.push({\n    channelId: channelIds[i],\n    handle: handles[i].replace(/^\\/?/, ''),\n  });\n}\n\nreturn results.map(channel => ({ json: channel }));"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        400,
        80
      ],
      "id": "57068782-052d-42e7-b020-a23a637c636e",
      "name": "Extract Channel ID"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "d7f6fdfc-c523-40d8-9e54-6e2e871649e8",
              "leftValue": "={{ $json[\"Transcript File ID\"] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        224,
        416
      ],
      "id": "72a89928-15a6-4374-a34e-2842f1451f37",
      "name": "Filter"
    },
    {
      "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
          "fileName": "={{ $json.videoId }}.json"
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        976,
        368
      ],
      "id": "036b9577-71f1-4201-995d-3cd586a40d76",
      "name": "Convert to File"
    },
    {
      "parameters": {
        "name": "=",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "1WhaQcNAPCZCp-KU8UubHZZ6zqN4VWuIb",
          "mode": "list",
          "cachedResultName": "my-video-transcripts",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1WhaQcNAPCZCp-KU8UubHZZ6zqN4VWuIb"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1168,
        368
      ],
      "id": "f80fab64-97d6-4b15-a917-8b712fdefce2",
      "name": "Upload file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        592,
        416
      ],
      "id": "818b303e-1b93-482d-952d-e758727a4386",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "content": "## Get Video Transcripts\nLong form videos only",
        "height": 272,
        "width": 1584,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        320
      ],
      "typeVersion": 1,
      "id": "20387739-8d5c-49c0-89f9-ef5bcb200ae0",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "yt_knowledge_v3",
          "mode": "list",
          "cachedResultName": "yt_knowledge_v3"
        },
        "options": {
          "queryName": "match_yt_knowledge_v3"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        1232,
        896
      ],
      "id": "3a32d28d-0ab2-40af-ba7d-cd6fafc97a96",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        1200,
        1088
      ],
      "id": "d00939cb-876a-4d1d-9b2a-7fa924de3a73",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json['Transcript File ID'] }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        736,
        992
      ],
      "id": "e567a928-82c0-4489-826b-14270dc2d17e",
      "name": "Download file1",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Type",
              "lookupValue": "Video"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -96,
        736
      ],
      "id": "8d55a254-c7ef-4d59-bce9-4549ecfa091f",
      "name": "Get row(s) in sheet2",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "5c44fac9-9ee6-4df3-9b54-5042b935241f",
              "leftValue": "={{ $json[\"Transcript File ID\"] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        112,
        736
      ],
      "id": "e280115c-2616-4e59-b03c-1d6433f36b8c",
      "name": "Filter2"
    },
    {
      "parameters": {
        "operation": "fromJson",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        880,
        992
      ],
      "id": "79306ee9-f8f9-4a0c-85fd-bbc3101cedd1",
      "name": "Extract from File1"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "=# Role\nYou are a specialized YouTube Content Analyst. Your sole purpose is to answer user queries based exclusively on two specific datasets. You do not use outside knowledge or general internet search.\n\n# Data Sources & Capabilities\n1. **Metadata Registry (Google Sheet):** - Contains: Video Titles, URLs, View Counts, Like Counts, Publish Dates.\n   - USE WHEN: The user asks about performance metrics, ranking (e.g., \"most popular,\" \"least viewed\"), sorting, dates, or retrieving specific URLs.\n\n2. **Transcript Knowledge Base (Vector Database):**\n   - Contains: Semantic chunks of video transcripts.\n   - USE WHEN: The user asks about specific topics, advice, \"how-to\" instructions, spoken quotes, or summaries of content.\n\n# Decision Logic\nYou must evaluate the user's intent to choose the correct workflow:\n\n- **Quantitative Queries:** If the user asks for \"the most viewed video\" or \"videos from 2023,\" query the **Google Sheet** first to identify the specific video(s).\n- **Qualitative Queries:** If the user asks \"What does he say about Python?\" or \"Summarize the cooking advice,\" query the **Vector Database**.\n- **Hybrid Queries:** If the user asks \"What is the advice in the most popular video?\", you must perform a two-step process:\n  1. Find the most popular video title in the **Google Sheet**.\n  2. Use that title to filter/search the transcript in the **Vector Database**.\n\n# Response Guidelines\n- **Citations:** Always reference the \"Video Title\" when providing information. If possible, provide the URL from the Google Sheet.\n- **Accuracy:** If the answer is not in the provided data sources, state clearly: \"I cannot find that information in the database.\" Do not hallucinate.\n- **Context:** When answering from the Vector Database, synthesize the chunks into a coherent answer rather than listing disjointed sentence fragments."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        608,
        1472
      ],
      "id": "2c7c08cf-1c5d-4dba-b2b6-c43c85ac3090",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-5.1",
          "mode": "list",
          "cachedResultName": "gpt-5.1"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        480,
        1680
      ],
      "id": "67f23813-6a9c-470d-85a4-09ce9e9ad644",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "This tool searches the Supabase vector database for the most relevant YouTube transcript sections and returns them for reference when generating new content.",
        "tableName": {
          "__rl": true,
          "value": "yt_knowledge_v3",
          "mode": "list",
          "cachedResultName": "yt_knowledge_v3"
        },
        "topK": 8,
        "options": {
          "queryName": "match_yt_knowledge_v3"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        1008,
        1680
      ],
      "id": "8c0c30b7-dd6d-46bf-b5dd-b08b8c507184",
      "name": "Supabase Vector Store1",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        624,
        1680
      ],
      "id": "4bef87cd-4692-4488-b117-73d46431095f",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "mode": "combine",
        "fieldsToMatchString": "Video ID",
        "joinMode": "keepNonMatches",
        "outputDataFrom": "input1",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        464,
        736
      ],
      "id": "20aedf80-57b1-4c9a-aa56-9515239f15d8",
      "name": "Merge"
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "yt_knowledge_v3",
        "returnAll": true,
        "filterType": "string",
        "filterString": "=metadata->>videoId=in.({{ $json.data.map(r => r['Video ID']) }})"
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        208,
        944
      ],
      "id": "c041135f-d68f-4395-96f1-c73982fba88b",
      "name": "Get many rows",
      "executeOnce": false,
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b7842dd9-69b4-4018-ab3b-72b55a4a9050",
              "name": "Video ID",
              "value": "={{ $json.metadata.videoId }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        336,
        944
      ],
      "id": "09fd4be2-87ad-45e8-b9e0-58c6986e8514",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Loop Over Items1').item.json.row_number }}",
            "Vector Status": "Added"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Video ID",
              "displayName": "Video ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Channel ID",
              "displayName": "Channel ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Channel",
              "displayName": "Channel",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Type",
              "displayName": "Type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Seconds",
              "displayName": "Seconds",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Publish Time",
              "displayName": "Publish Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Link",
              "displayName": "Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Thumbnail",
              "displayName": "Thumbnail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "View Count",
              "displayName": "View Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Like Count",
              "displayName": "Like Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Comment Count",
              "displayName": "Comment Count",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Transcript File ID",
              "displayName": "Transcript File ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Transcript Link",
              "displayName": "Transcript Link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Vector Status",
              "displayName": "Vector Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1376,
        704
      ],
      "id": "e2341c54-96ca-4892-ba21-a05713a8fa74",
      "name": "Update row in sheet2",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "tableId": "yt_knowledge_v3",
        "filterType": "string",
        "filterString": "=metadata->>videoId=eq.{{ $json['Video ID'] }}"
      },
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        336,
        1104
      ],
      "id": "620a0051-f51c-46f1-b3cd-137609cc9653",
      "name": "Delete a row",
      "alwaysOutputData": true,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "07edc120-507c-4d6e-99ae-d06af63081a4",
              "leftValue": "={{ $json['Vector Status'] }}",
              "rightValue": "Invalidate",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -96,
        992
      ],
      "id": "6a779e3a-d291-40c7-9625-0a73507a2cd3",
      "name": "If"
    },
    {
      "parameters": {
        "mode": "chooseBranch"
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1216,
        704
      ],
      "id": "e1ba927d-fd62-4460-bc78-8a26f89bfd22",
      "name": "Merge1"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        64,
        944
      ],
      "id": "dc24e068-6b3c-43fd-8ac1-4b383d9f7d22",
      "name": "Aggregate"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA",
          "mode": "list",
          "cachedResultName": "YT Processing",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 25357018,
          "mode": "list",
          "cachedResultName": "KyleFrielTech",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VXUBavv_9Ba6O3SZbTMdIjjE9xVdRfCcm0thJ-vvHnA/edit#gid=25357018"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Type",
              "lookupValue": "Video"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        768,
        1680
      ],
      "id": "ffb5aabb-cb53-4695-94a7-616eae10ee51",
      "name": "Get row(s) in sheet in Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "maxItems": 20
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        656,
        736
      ],
      "id": "6f37e32d-84f6-42c4-ae9b-598f4c58ee92",
      "name": "Limit1"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const segments = $json.data.segments;\nconst videoTitle = $('Loop Over Items1').item.json.Title;\n\n// --- CONFIGURATION ---\nconst TOTAL_FIXED_SIZE = 1000; // Exact total size (Header + Content)\nconst OVERLAP = 100;\n\n// 1. Calculate the fixed cost of the header\n// Template: \"Title: SOME TITLE\\n---\\n\"\nconst titleHeader = `Title: ${videoTitle}\\n---\\n`;\nconst titleCost = titleHeader.length;\n\n// 2. Calculate exactly how many content characters fit per chunk\nconst CONTENT_WINDOW = TOTAL_FIXED_SIZE - titleCost;\n\n// 3. Calculate how much we move forward each time (Window - Overlap)\nconst STEP_SIZE = CONTENT_WINDOW - OVERLAP;\n\nlet chunks = [];\nlet buffer = \"\"; // A running buffer of text\n\nfor (const segment of segments) {\n  // Add current segment to the buffer\n  // We add a space to ensure words don't merge, though this adds 1 char\n  buffer += segment.text + \" \";\n\n  // WHILE the buffer has enough text to fill a chunk...\n  // We use a while loop here because one long segment might create multiple chunks\n  while (buffer.length >= CONTENT_WINDOW) {\n    \n    // a. Slice exactly the amount we need to hit the limit\n    // Note: This is a \"Hard Cut\" (could split a word in half). \n    // This is necessary to guarantee EXACT character counts.\n    const chunkContent = buffer.slice(0, CONTENT_WINDOW);\n\n    // b. Create the final string\n    const formattedContent = `${titleHeader}${chunkContent}`;\n    chunks.push(formattedContent);\n\n    // c. Move the buffer forward\n    // We remove the text we used, but keep the overlap for the next chunk\n    // conceptually: buffer = buffer.substring(CONTENT_WINDOW - OVERLAP)\n    buffer = buffer.slice(STEP_SIZE);\n  }\n}\n\n// HANDLE LEFTOVERS\n// If there is anything left in the buffer (even if it's small), save it.\nif (buffer.length > 0) {\n    const formattedContent = `${titleHeader}${buffer.trim()}`;\n    chunks.push(formattedContent);\n}\n\nreturn {\n  fullText: chunks.join(\"||\")\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        992
      ],
      "id": "b3826ac3-5023-4b13-8d66-f08783fbd5a3",
      "name": "Code in JavaScript1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        560,
        976
      ],
      "id": "74fe7cee-538c-48dd-9c9c-395dd295d832",
      "name": "Loop Over Items1"
    },
    {
      "parameters": {
        "content": "## Upload Video Transcripts to Vector Database\n",
        "height": 688,
        "width": 1808,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        656
      ],
      "typeVersion": 1,
      "id": "81f5cbe8-f411-4735-a21a-f418db248fd5",
      "name": "Sticky Note2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -224,
        80
      ],
      "id": "44156178-2651-44f3-b52a-17da1f5c77c2",
      "name": "Trigger Manually"
    },
    {
      "parameters": {
        "maxItems": 20
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        400,
        416
      ],
      "id": "eb2a388c-2585-416f-a87d-491cf090ba3e",
      "name": "Limit"
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $json.fullText }}",
        "textSplittingMode": "custom",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "type",
                "value": "={{ $('Loop Over Items1').item.json.Type }}"
              },
              {
                "name": "title",
                "value": "={{ $('Loop Over Items1').item.json.Title }}"
              },
              {
                "name": "channel",
                "value": "={{ $('Loop Over Items1').item.json.Channel }}"
              },
              {
                "name": "videoId",
                "value": "={{ $('Loop Over Items1').item.json['Video ID'] }}"
              },
              {
                "name": "channelId",
                "value": "={{ $('Loop Over Items1').item.json['Channel ID'] }}"
              },
              {
                "name": "likeCount",
                "value": "={{ $('Loop Over Items1').item.json['Like Count'] }}"
              },
              {
                "name": "viewCount",
                "value": "={{ $('Loop Over Items1').item.json['View Count'] }}"
              },
              {
                "name": "publishedAt",
                "value": "={{ $('Loop Over Items1').item.json['Publish Time'] }}"
              },
              {
                "name": "commentCount",
                "value": "={{ $('Loop Over Items1').item.json['Comment Count'] }}"
              },
              {
                "name": "durationInSeconds",
                "value": "={{ $('Loop Over Items1').item.json.Seconds }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        1376,
        1104
      ],
      "id": "8ea41fee-3817-4436-b7c2-caf9c2906e3f",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "separator": "||"
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        1472,
        1312
      ],
      "id": "4999357c-f7ce-42a4-88b9-c1f98bb59aec",
      "name": "Character Text Splitter"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        336,
        1472
      ],
      "id": "23bf6f60-e100-4c32-a682-36e1779c945d",
      "name": "When chat message received"
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get Channel Search HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many videos": {
      "main": [
        [
          {
            "node": "Get a video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a video": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Search HTML": {
      "main": [
        [
          {
            "node": "Extract Channel ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Channel ID": {
      "main": [
        [
          {
            "node": "Get many videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Transcribe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "Supabase Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Download file1": {
      "main": [
        [
          {
            "node": "Extract from File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet2": {
      "main": [
        [
          {
            "node": "Filter2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Limit1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many rows": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Delete a row": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete a row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Update row in sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Get many rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Limit1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Download file1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet2": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Manually": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0c5e84a9-e1f0-40b7-b1ab-3a81bdd01285",
  "id": "huGhT0C0lBkt0mMo",
  "tags": []
}