{
  "name": "EE-Solver + RAG \ud30c\uc774\ud504\ub77c\uc778",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ee-solve-rag",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "trigger",
      "name": "Webhook \ud2b8\ub9ac\uac70",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        200,
        300
      ],
      "notes": "\uc785\ub825: { question: str, image?: str(base64), mime_type?: str }"
    },
    {
      "parameters": {
        "mode": "retrieve",
        "note_placeholder": "\uc5ec\uae30\uc5d0 \ubca1\ud130 \uc2a4\ud1a0\uc5b4 \ub178\ub4dc\ub97c \uc5f0\uacb0\ud558\uc138\uc694 (Pinecone, Qdrant, Supabase \ub4f1). question\uc744 \ucffc\ub9ac\ub85c \uc0ac\uc6a9\ud558\uc5ec \uad00\ub828 \uac15\uc758\uc790\ub8cc \uccad\ud06c\ub97c \uac80\uc0c9\ud569\ub2c8\ub2e4."
      },
      "id": "rag-placeholder",
      "name": "RAG \uac80\uc0c9 (\uc124\uc815 \ud544\uc694)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        440,
        300
      ],
      "notes": "\uc774 \ub178\ub4dc\ub97c \ubca1\ud130DB \uac80\uc0c9 \ub178\ub4dc\ub85c \uad50\uccb4\ud558\uc138\uc694. \ucd9c\ub825\uc5d0 rag_context \ubc30\uc5f4\uc744 \ud3ec\ud568\ud574\uc57c \ud569\ub2c8\ub2e4."
    },
    {
      "parameters": {
        "jsCode": "// RAG \uac80\uc0c9 \uacb0\uacfc\ub97c rag_context \ubc30\uc5f4\ub85c \ubcc0\ud658\n// \ubca1\ud130DB \ub178\ub4dc\uc758 \ucd9c\ub825 \ud615\uc2dd\uc5d0 \ub9de\uac8c \uc218\uc815 \ud544\uc694\n\nconst input = $input.first().json;\nconst trigger = $('Webhook \ud2b8\ub9ac\uac70').first().json;\n\n// \ubca1\ud130DB \uac80\uc0c9 \uacb0\uacfc\uc5d0\uc11c \ud14d\uc2a4\ud2b8 \ucd94\ucd9c (\ud615\uc2dd\uc5d0 \ub9de\uac8c \uc218\uc815)\nconst ragResults = input.documents || input.matches || [input];\nconst ragContext = ragResults.map(doc => \n  doc.pageContent || doc.text || doc.content || JSON.stringify(doc)\n).filter(Boolean);\n\nreturn [{\n  json: {\n    question: trigger.body.question,\n    image: trigger.body.image || null,\n    mime_type: trigger.body.mime_type || 'image/png',\n    rag_context: ragContext,\n    rag_enabled: true\n  }\n}];"
      },
      "id": "prepare",
      "name": "\uc694\uccad \uc870\ub9bd",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        300
      ],
      "notes": "RAG \uacb0\uacfc + \uc6d0\ubcf8 \uc9c8\ubb38\uc744 ee-solver \uc785\ub825 \ud615\uc2dd\uc73c\ub85c \uc870\ub9bd"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://localhost:8100/solve",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}",
        "options": {
          "timeout": 120000
        }
      },
      "id": "ee-solver",
      "name": "EE-Solver API \ud638\ucd9c",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json) }}",
        "options": {}
      },
      "id": "response",
      "name": "\uc751\ub2f5 \ubc18\ud658",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1100,
        300
      ]
    }
  ],
  "connections": {
    "Webhook \ud2b8\ub9ac\uac70": {
      "main": [
        [
          {
            "node": "RAG \uac80\uc0c9 (\uc124\uc815 \ud544\uc694)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RAG \uac80\uc0c9 (\uc124\uc815 \ud544\uc694)": {
      "main": [
        [
          {
            "node": "\uc694\uccad \uc870\ub9bd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uc694\uccad \uc870\ub9bd": {
      "main": [
        [
          {
            "node": "EE-Solver API \ud638\ucd9c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EE-Solver API \ud638\ucd9c": {
      "main": [
        [
          {
            "node": "\uc751\ub2f5 \ubc18\ud658",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}