{
  "name": "VietlinhAI | Trợ lý AI tra cứu dữ liệu khách hàng",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -784,
        112
      ],
      "id": "5fd6e986-2282-4eea-b66f-66bd3cf403f5",
      "name": "When chat message received",
      "webhookId": "b8e2b8f6-41ad-484b-8e82-931d8589d5b3"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "Bạn là người quản lý cơ sở dữ liệu khách hàng, nhiệm vụ của bạn là lấy thông tin trong vector Data để cung cấp cho người quản lý khi có câu hỏi liên quan đến Khách hàng, tuyệt đối không tự bịa thông tin hay lấy thông tin từ Internet."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -128,
        112
      ],
      "id": "5db2267a-17b1-4329-9f4c-87869f5db491",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        -288,
        368
      ],
      "id": "b807c8e6-7fcf-4f12-a54e-2748547db386",
      "name": "Google Gemini Chat Model"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.4,
      "position": [
        -32,
        368
      ],
      "id": "73cf9aa4-09bd-415f-a35d-b4eeaea0efe4",
      "name": "Postgres Chat Memory"
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "Use this tool to get information",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        240,
        224
      ],
      "id": "056171ea-4bb8-4fa1-a74c-15cdd1cef241",
      "name": "Supabase Vector Store"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "list",
          "cachedResultName": "-- Chọn file của bạn --",
          "cachedResultUrl": ""
        },
        "sheetName": {
          "__rl": true,
          "value": "",
          "mode": "list",
          "cachedResultName": "-- Chọn trang tính chứa dữ liệu khách hàng --",
          "cachedResultUrl": ""
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -992,
        -352
      ],
      "id": "2a332528-099c-4d93-a699-9c6faa075daa",
      "name": "Get row(s) in sheet"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.3,
      "position": [
        -128,
        -352
      ],
      "id": "5a356fac-7fd9-4f8b-9fef-7db2596ed5c1",
      "name": "Supabase Vector Store1"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "typeVersion": 1,
      "position": [
        -160,
        -144
      ],
      "id": "2ab133fc-4776-48e0-ac8b-d5d8024a379c",
      "name": "Embeddings Google Gemini"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        32,
        -144
      ],
      "id": "10aae990-90b2-4c4a-8964-cd52711080b3",
      "name": "Default Data Loader"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "typeVersion": 1,
      "position": [
        240,
        384
      ],
      "id": "264a6866-ae9e-4822-ad1d-9fa7535b36d6",
      "name": "Embeddings Google Gemini1"
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        -784,
        -352
      ],
      "id": "dc9c0423-db22-469c-98bb-4c9078f897b6",
      "name": "Aggregate"
    },
    {
      "parameters": {
        "fieldsToSummarize": {
          "values": [
            {
              "aggregation": "concatenate",
              "field": "data"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.summarize",
      "typeVersion": 1.1,
      "position": [
        -576,
        -352
      ],
      "id": "cf5bf756-f36e-4f94-9656-74e03141c208",
      "name": "Summarize"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1200,
        -352
      ],
      "id": "e2a52686-0fab-483f-a8b3-48e71fbaf3e5",
      "name": "Bấm để nạp dữ liệu vào Supabase"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Supabase Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini1": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Summarize",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize": {
      "main": [
        [
          {
            "node": "Supabase Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bấm để nạp dữ liệu vào Supabase": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "nodeGroups": [],
  "tags": []
}