{ "name": "robeing-rag-companyx-grounding-pipeline", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "rag/companyx/grounding", "responseMode": "responseNode", "options": {} }, "id": "cx-rag-001", "name": "Webhook In", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [200, 240] }, { "parameters": { "jsCode": "const body = $json.body || {};\nreturn {\n query: body.query || '',\n user_uuid: body.user_id || '',\n team_id: '79441171-3951-4870-beb8-916d07fe8be5', // Company X Team ID\n limit: body.limit || 5\n};" }, "id": "cx-rag-002", "name": "Set Context (Company X)", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [440, 240] }, { "parameters": { "method": "POST", "url": "=http://192.168.219.52:8508/api/search", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"query\": \"{{ $json.query }}\",\n \"team_id\": \"{{ $json.team_id }}\",\n \"limit\": {{ $json.limit }}\n}", "options": {} }, "id": "cx-rag-003", "name": "Search Internal Docs", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [680, 240] }, { "parameters": { "jsCode": "const results = $json.body || [];\nconst context = results.map(r => `[출처: ${r.filename}]\\n${r.text}`).join('\\n---\\n');\nconst original = $('Set Context (Company X)').item.json;\nreturn {\n message: original.query,\n grounding_context: context,\n user_id: original.user_uuid,\n robeing_id: 'rb8001'\n};" }, "id": "cx-rag-004", "name": "Prepare LLM Prompt", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [940, 240] }, { "parameters": { "method": "POST", "url": "=http://192.168.219.52:8001/api/chat", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "X-User-Id", "value": "={{ $json.user_id }}" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"message\": \"{{ $json.message }}\",\n \"context\": \"아래의 컴퍼니엑스 내부 문서 내용을 바탕으로 답변하세요:\\n{{ $json.grounding_context }}\",\n \"source\": \"n8n-grounding\"\n}", "options": {} }, "id": "cx-rag-005", "name": "Call rb8001 with Context", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1200, 240] }, { "parameters": { "respondWith": "json", "responseBody": "={{ $json.body }}", "options": {} }, "id": "cx-rag-006", "name": "Return Grounded Answer", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [1460, 240] } ], "connections": { "Webhook In": { "main": [[{ "node": "Set Context (Company X)", "type": "main", "index": 0 }]] }, "Set Context (Company X)": { "main": [[{ "node": "Search Internal Docs", "type": "main", "index": 0 }]] }, "Search Internal Docs": { "main": [[{ "node": "Prepare LLM Prompt", "type": "main", "index": 0 }]] }, "Prepare LLM Prompt": { "main": [[{ "node": "Call rb8001 with Context", "type": "main", "index": 0 }]] }, "Call rb8001 with Context": { "main": [[{ "node": "Return Grounded Answer", "type": "main", "index": 0 }]] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "robeing-rag" } }