{
  "name": "vector_manager",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -224,
        496
      ],
      "id": "05f23abc-6f60-4a0d-a88e-8c31edb3e184",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "vNdtv6ffWxydZcwX",
          "mode": "list",
          "cachedResultName": "concierge_sources",
          "cachedResultUrl": "/projects/uabU37OVTmcWS1JM/datatables/vNdtv6ffWxydZcwX"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "status",
              "keyValue": "notindexed"
            }
          ]
        },
        "returnAll": true
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        0,
        496
      ],
      "id": "b9b53a8e-411e-4384-b95a-8ff72a000001",
      "name": "concierge_sources"
    },
    {
      "parameters": {
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "value": "vNdtv6ffWxydZcwX",
          "mode": "list",
          "cachedResultName": "concierge_sources",
          "cachedResultUrl": "/projects/uabU37OVTmcWS1JM/datatables/vNdtv6ffWxydZcwX"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "url",
              "keyValue": "={{ $('iteration').isExecuted ? $('iteration').item.json.url : $('get_page').item.json.url }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "status": "indexed",
            "text": "={{ $('Basic LLM Chain').item.json.text }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "url",
              "displayName": "url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "type",
              "displayName": "type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "text",
              "displayName": "text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        1744,
        320
      ],
      "id": "d8ac0c50-68cb-49e5-932d-55cef6c0fcf9",
      "name": "update data"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        224,
        496
      ],
      "id": "89317d3e-be51-4802-8058-36fab6155c53",
      "name": "iteration"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1968,
        496
      ],
      "id": "379e6597-4392-428f-9e9e-16e3bf20978f",
      "name": "5s"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Tu es un extracteur de contenu. Ta t\u00e2che est de nettoyer et restructurer le contenu brut d'une page web, extrait automatiquement, pour qu'il devienne une base de connaissance exploitable par un agent conversationnel.\n\nR\u00c8GLES STRICTES :\n\n1. Ne jamais inventer, r\u00e9sumer, reformuler ou interpr\u00e9ter l'information. Le texte de sortie doit rester fid\u00e8le mot pour mot au contenu source pour tout ce qui est conserv\u00e9. Tu restructures et tu nettoies, tu ne r\u00e9\u00e9cris pas.\n\n2. Retire syst\u00e9matiquement :\n   - Menus de navigation, liens de header/footer\n   - Scripts, code JavaScript, JSON de configuration technique, balises de routing\n   - Badges d'interface, compteurs, statistiques de statut syst\u00e8me (ex: \"Uptime: 99.98%\", \"Tasks: 1,248\")\n   - \u00c9l\u00e9ments r\u00e9p\u00e9t\u00e9s plusieurs fois dans le texte (souvent des artefacts de composants dupliqu\u00e9s dans le rendu)\n   - Call-to-action g\u00e9n\u00e9riques sans contenu informatif (\"S'abonner\", \"R\u00e9server mon audit\" isol\u00e9s sans contexte)\n   - Mentions l\u00e9gales, copyright, liens r\u00e9seaux sociaux\n\n3. Conserve int\u00e9gralement :\n   - Toute description de service, tarif, m\u00e9thodologie, processus\n   - Tout texte biographique ou de positionnement\n   - Titres d'articles de blog et leurs r\u00e9sum\u00e9s/accroches si pr\u00e9sents\n   - Toute donn\u00e9e chiffr\u00e9e qui n'est pas un artefact d'interface (ex: \"1500\u20ac HT\", \"40h/mois\" sont \u00e0 garder, \"Uptime: 99.98%\" est \u00e0 jeter)\n\n4. Si un passage est ambigu (tu ne sais pas s'il s'agit de contenu r\u00e9el ou de bruit d'interface), conserve-le plut\u00f4t que de le supprimer. Un faux positif dans le nettoyage est pire qu'un peu de bruit r\u00e9siduel.\n\n5. Structure la sortie en texte clair, paragraphes coh\u00e9rents, sans markdown de mise en forme complexe (pas de tableaux, pas de liens). Des titres simples en majuscules ou entre ## sont accept\u00e9s pour s\u00e9parer les sections th\u00e9matiques si la page en contient plusieurs (ex: plusieurs services sur une m\u00eame page).\n\n6. Ne commente jamais ton propre travail. Ne dis jamais \"voici le contenu nettoy\u00e9\" ou \u00e9quivalent. Retourne uniquement le texte final.\n\nURL source de la page : {{ $('iteration').isExecuted ? $('iteration').item.json.url : $('get_page').item.json.url }}\n\nContenu brut \u00e0 traiter :\n{{ $json.data }}",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        896,
        64
      ],
      "id": "929e4df5-8b6d-4236-9208-6a4870b76dca",
      "name": "Basic LLM Chain",
      "retryOnFail": true,
      "maxTries": 5,
      "waitBetweenTries": 1500
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        976,
        288
      ],
      "id": "709b9c00-5d47-4f4e-8455-5302c1f98b74",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://r.jina.ai/{{ $json.url ?? $('get_page').item.json.url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        672,
        176
      ],
      "id": "3a4a7979-a0d8-4a02-aeb2-799b3be34371",
      "name": "jina.ai"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "concierge_documents",
          "mode": "list",
          "cachedResultName": "concierge_documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        1280,
        320
      ],
      "id": "f286391c-9297-419d-a582-d6be185e5e38",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "textSplittingMode": "custom",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "type",
                "value": "={{ $('iteration').isExecuted ? $('iteration').item.json.type : $('get_page').item.json.type }}"
              },
              {
                "name": "url",
                "value": "={{ $('iteration').isExecuted ? $('iteration').item.json.url : $('get_page').item.json.url }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        1376,
        544
      ],
      "id": "493f9c43-f1f0-430d-b0a1-f39c1755f963",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "chunkSize": 800,
        "chunkOverlap": 120,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        1456,
        752
      ],
      "id": "31ae6325-17d8-4164-b771-bc06d99094cf",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "typeVersion": 1,
      "position": [
        1248,
        544
      ],
      "id": "44a823d3-9fa0-444b-9ce9-1cc59d061e71",
      "name": "Embeddings Google Gemini",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "dataTableId": {
          "__rl": true,
          "value": "vNdtv6ffWxydZcwX",
          "mode": "list",
          "cachedResultName": "concierge_sources",
          "cachedResultUrl": "/projects/uabU37OVTmcWS1JM/datatables/vNdtv6ffWxydZcwX"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "status": "notindexed",
            "url": "={{ $('form trigger').item.json.Url }}",
            "type": "={{ $('form trigger').item.json.Type }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "url",
              "displayName": "url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "type",
              "displayName": "type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "text",
              "displayName": "text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        96,
        336
      ],
      "id": "752d9d7d-96c1-42e6-84c5-2b76f9f50f86",
      "name": "Insert row"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "9d716f2d-de51-4952-8963-07dccfe74dab",
              "leftValue": "={{ Object.keys($json).length }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -64,
        224
      ],
      "id": "2550d7cc-aa73-4f9e-bb20-c36d33f936e0",
      "name": "page exists ?"
    },
    {
      "parameters": {
        "formTitle": "Concierge",
        "formDescription": "Ajouter ou mettre \u00e0 jour une page",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Url",
              "requiredField": true
            },
            {
              "fieldLabel": "Type",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "page"
                  },
                  {
                    "option": "service"
                  },
                  {
                    "option": "article"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.6,
      "position": [
        -480,
        224
      ],
      "id": "9fdf0c28-852b-4454-bc98-9ce29df8f57f",
      "name": "form trigger"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "260041bd-7d23-4ce5-aa52-3938d10165ec",
              "leftValue": "={{ Object.keys($json).length }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        240,
        304
      ],
      "id": "97c506c4-515a-4193-95bb-e52f2623a5f4",
      "name": "inserted ?"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ (!$json.text || $json.text === \"\") && $('concierge_sources').isExecuted }}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "id": "89d15956-38ce-4a94-b7eb-f357743193c3"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "no content"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "16ca5bc7-03a1-4f4c-9086-1d12e6510e11",
                    "leftValue": "={{ ($json.text && $json.text !== \"\") && $('concierge_sources').isExecuted }}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "content"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "8767e7cc-8950-4fd2-83e3-d5d510afe721",
                    "leftValue": "={{ $('concierge_sources').isExecuted }}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "no iteraction"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        448,
        320
      ],
      "id": "aa1da40a-aa18-46d8-ac68-0699e20b80f2",
      "name": "Switch"
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "vNdtv6ffWxydZcwX",
          "mode": "list",
          "cachedResultName": "concierge_sources",
          "cachedResultUrl": "/projects/uabU37OVTmcWS1JM/datatables/vNdtv6ffWxydZcwX"
        },
        "filters": {
          "conditions": [
            {
              "keyName": "url",
              "keyValue": "={{ $json.Url }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        -272,
        224
      ],
      "id": "a4e15fea-3c7f-439d-935c-a84cd4ebbd0e",
      "name": "get_page",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "method": "DELETE",
        "url": "=https://YOUR_PROJECT_REF.supabase.co/rest/v1/concierge_documents?metadata->>url=eq.{{ encodeURIComponent($json.url) }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "supabaseApi",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        128,
        64
      ],
      "id": "7ecea7ed-c340-4912-9eb3-03ffdb4d740f",
      "name": "delete_vector",
      "alwaysOutputData": false,
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eec32d71-9839-4827-a3fe-efd6de831604",
              "name": "text",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        960,
        464
      ],
      "id": "ff31fb63-e5bf-44a3-896c-489eb15a7506",
      "name": "normalizer"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "concierge_sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "concierge_sources": {
      "main": [
        [
          {
            "node": "iteration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "update data": {
      "main": [
        [
          {
            "node": "5s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "iteration": {
      "main": [
        [],
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5s": {
      "main": [
        [
          {
            "node": "iteration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "jina.ai": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "main": [
        [
          {
            "node": "update data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        [
          {
            "node": "inserted ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "page exists ?": {
      "main": [
        [
          {
            "node": "delete_vector",
            "type": "main",
            "index": 0
          },
          {
            "node": "jina.ai",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "form trigger": {
      "main": [
        [
          {
            "node": "get_page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "inserted ?": {
      "main": [
        [
          {
            "node": "jina.ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "jina.ai",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "normalizer",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "get_page": {
      "main": [
        [
          {
            "node": "page exists ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "delete_vector": {
      "main": [
        []
      ]
    },
    "normalizer": {
      "main": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "903cd086-5a6c-43a1-8f3d-71fc3551a92a",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "YOUR_CREDENTIAL_ID",
  "tags": []
}