{
  "name": "Add Domain",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "add-domain",
        "responseMode": "responseNode"
      },
      "id": "webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [
        50,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://host.docker.internal:11434/api/embeddings",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { model: 'all-minilm', prompt: $json.body.domain } }}",
        "options": {}
      },
      "id": "generate-embedding",
      "name": "Generate Embedding",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "method": "PUT",
        "url": "=http://host.docker.internal:6333/collections/successful_schemas/points",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ {\n  points: [\n    {\n      id: Date.now() + Math.floor(Math.random() * 1000),\n      vector: $json.embedding,\n      payload: {\n        user_prompt: $('Webhook Trigger').item.json.body.domain,\n        schema: $('Webhook Trigger').item.json.body.schema,\n        rating: 'thumbs_up',\n        timestamp: new Date().toISOString(),\n        created: true\n      }\n    }\n  ]\n} }}",
        "options": {}
      },
      "id": "add-to-qdrant",
      "name": "Add to Qdrant",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      success: true,\n      message: 'Domain added successfully',\n      domain: $('Webhook Trigger').item.json.body.domain,\n      fieldsCount: $('Webhook Trigger').item.json.body.schema.length\n    }\n  }\n];"
      },
      "id": "summary",
      "name": "Summary",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $('Summary').item.json }}",
        "options": {}
      },
      "id": "respond-to-webhook",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Generate Embedding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Embedding": {
      "main": [
        [
          {
            "node": "Add to Qdrant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add to Qdrant": {
      "main": [
        [
          {
            "node": "Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summary": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "1"
}