311 lines
7.4 KiB
JSON
311 lines
7.4 KiB
JSON
{
|
|
"name": "74 IT helpdesk v2 (provided)",
|
|
"nodes": [
|
|
{
|
|
"name": "Question webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2,
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "rel-v2",
|
|
"responseMode": "responseNode",
|
|
"options": {}
|
|
},
|
|
"webhookId": "4dd9ca0d-6e35-58d9-afb9-36689beca2c7",
|
|
"position": [
|
|
0,
|
|
300
|
|
],
|
|
"id": "edf3da10-d647-5671-a906-292126b204df"
|
|
},
|
|
{
|
|
"name": "Has question?",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2.2,
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"caseSensitive": true,
|
|
"leftValue": "",
|
|
"typeValidation": "loose",
|
|
"version": 2
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "c1",
|
|
"leftValue": "={{ $json.body.question }}",
|
|
"rightValue": "",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "notEmpty",
|
|
"singleValue": true
|
|
}
|
|
}
|
|
],
|
|
"combinator": "and"
|
|
},
|
|
"options": {}
|
|
},
|
|
"position": [
|
|
220,
|
|
300
|
|
],
|
|
"id": "cf8a9038-ff3e-56a3-a17f-9c062bdd0391"
|
|
},
|
|
{
|
|
"name": "Reject empty",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1.1,
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "{ \"error\": \"question is required\" }",
|
|
"options": {
|
|
"responseCode": 400
|
|
}
|
|
},
|
|
"position": [
|
|
440,
|
|
560
|
|
],
|
|
"id": "3e81f84e-0040-52a4-80a2-e093464dea75"
|
|
},
|
|
{
|
|
"name": "Search FAQ",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"parameters": {
|
|
"url": "http://data-api:8800/faq",
|
|
"options": {},
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "q",
|
|
"value": "={{ $('Question webhook').first().json.body.question }}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"position": [
|
|
440,
|
|
300
|
|
],
|
|
"id": "7e858b12-8c3b-5b72-aa02-09276f0d63e0"
|
|
},
|
|
{
|
|
"name": "Get ticket",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"parameters": {
|
|
"url": "=http://data-api:8800/tickets/{{ (($('Question webhook').first().json.body.question.match(/T-?\\d{4}/i) || ['NONE'])[0]).toUpperCase().replace(/^T(\\d)/, 'T-$1') }}",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true
|
|
}
|
|
}
|
|
},
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "requester",
|
|
"value": "={{ $('Question webhook').first().json.body.user ?? '' }}"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"position": [
|
|
660,
|
|
300
|
|
],
|
|
"id": "9265daab-0313-5c12-aa77-7a596f23eae5"
|
|
},
|
|
{
|
|
"name": "Answer",
|
|
"type": "@n8n/n8n-nodes-langchain.agent",
|
|
"typeVersion": 3.1,
|
|
"parameters": {
|
|
"promptType": "define",
|
|
"text": "=질문: {{ $('Question webhook').first().json.body.question }}\nFAQ: {{ JSON.stringify($('Search FAQ').first().json.results ?? []) }}\n접수 건: {{ JSON.stringify($('Get ticket').first().json) }}",
|
|
"options": {
|
|
"systemMessage": "You are the company IT help desk. Answer in Korean in at most 3 sentences, using only the FAQ entries and the ticket record given. Never invent steps, dates or names. For a ticket, say its status and note. If the data does not answer the question, say \"찾지 못했습니다\" and that a staff member will help. Use 합니다체.\nWhen the answer comes from a FAQ entry, end with its id in brackets, for example [FAQ-003]. Keep answers short.",
|
|
"maxIterations": 1
|
|
}
|
|
},
|
|
"position": [
|
|
880,
|
|
300
|
|
],
|
|
"id": "027a9c55-9b22-5122-85e5-9f8e347fe189"
|
|
},
|
|
{
|
|
"name": "Answer model",
|
|
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
|
"typeVersion": 1.2,
|
|
"parameters": {
|
|
"model": {
|
|
"__rl": true,
|
|
"mode": "id",
|
|
"value": "gpt-5.4-nano"
|
|
},
|
|
"options": {
|
|
"temperature": 0
|
|
}
|
|
},
|
|
"credentials": {
|
|
"openAiApi": {
|
|
"id": "openAiCourse0001",
|
|
"name": "OpenAI (.env)"
|
|
}
|
|
},
|
|
"position": [
|
|
880,
|
|
520
|
|
],
|
|
"id": "bfe53f6e-ecec-5876-8943-03d0b6dad9a5"
|
|
},
|
|
{
|
|
"name": "Review check",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"parameters": {
|
|
"jsCode": "let answer = String($json.output ?? '').trim();\nif (answer.length > 400) answer = answer.slice(0, 400);\nreturn [{ json: { output: answer } }];"
|
|
},
|
|
"position": [
|
|
1100,
|
|
300
|
|
],
|
|
"id": "0d0c0486-e241-521a-83ca-66b725fd05d0"
|
|
},
|
|
{
|
|
"name": "Build result",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"parameters": {
|
|
"jsCode": "const results = $('Search FAQ').first().json.results ?? [];\nconst result = { route: '자동 답변', answer: String($json.output ?? '').trim(), sources: results.map((r) => r.id) };\nreturn [{ json: result }];"
|
|
},
|
|
"position": [
|
|
1320,
|
|
300
|
|
],
|
|
"id": "27c64881-2145-56c1-ab88-8f0a7515dbd2"
|
|
},
|
|
{
|
|
"name": "Send result",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1.1,
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ $json }}",
|
|
"options": {}
|
|
},
|
|
"position": [
|
|
1540,
|
|
300
|
|
],
|
|
"id": "5a7d65a6-3b4e-562d-bf7e-1be3756a8cde"
|
|
}
|
|
],
|
|
"connections": {
|
|
"Question webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Has question?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Has question?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Search FAQ",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Reject empty",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Search FAQ": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get ticket",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Get ticket": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Answer",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Answer model": {
|
|
"ai_languageModel": [
|
|
[
|
|
{
|
|
"node": "Answer",
|
|
"type": "ai_languageModel",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Answer": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Review check",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Review check": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Build result",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Build result": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Send result",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
}
|
|
}
|