213 lines
4.9 KiB
JSON
213 lines
4.9 KiB
JSON
{
|
||
"name": "knaster: Anfrage ausführen",
|
||
"nodes": [
|
||
{
|
||
"parameters": {
|
||
"httpMethod": "POST",
|
||
"path": "knaster/run",
|
||
"responseMode": "responseNode",
|
||
"options": {},
|
||
"authentication": "headerAuth"
|
||
},
|
||
"id": "9463206f-d1cb-52fc-98ba-01370b80290b",
|
||
"name": "Anfrage",
|
||
"type": "n8n-nodes-base.webhook",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
0,
|
||
300
|
||
],
|
||
"webhookId": "bba18b52-dcd1-5231-a132-0434e5f27505",
|
||
"credentials": {
|
||
"httpHeaderAuth": {
|
||
"id": "",
|
||
"name": "knaster-webhook"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "b65c35b7-cf8b-5067-8c3c-d90533ad04dd",
|
||
"name": "router_url",
|
||
"value": "http://router:8080",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "4ccf1d69-7b78-5ad7-9d1a-40ae77e7b3d1",
|
||
"name": "Konfiguration",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.4,
|
||
"position": [
|
||
220,
|
||
300
|
||
],
|
||
"notes": "Nach dem Import anpassen. Credential 'knaster-router' = Header Auth: Authorization / Bearer <KNASTER_API_TOKEN>"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Konfiguration').item.json.router_url }}/v1/run",
|
||
"authentication": "genericCredentialType",
|
||
"genericAuthType": "httpHeaderAuth",
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={{ JSON.stringify({ input: $('Anfrage').item.json.body.input, skill: $('Anfrage').item.json.body.skill || null }) }}",
|
||
"options": {
|
||
"timeout": 180000
|
||
}
|
||
},
|
||
"id": "d6f5c10d-2a30-598a-af5e-3f8040098cb4",
|
||
"name": "Router /v1/run",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
440,
|
||
300
|
||
],
|
||
"credentials": {
|
||
"httpHeaderAuth": {
|
||
"id": "",
|
||
"name": "knaster-router"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "loose"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "3fc7e0c8-fd00-5368-819c-dff9572baf12",
|
||
"leftValue": "={{ $json.status }}",
|
||
"rightValue": "ok",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "01605cd8-f4e0-53c6-acfe-32c389d6cbe6",
|
||
"name": "Erfolgreich?",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
660,
|
||
300
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"respondWith": "json",
|
||
"responseBody": "={{ JSON.stringify({ output: $json.output, stage: $json.stage, skill: $json.skill, escalations: $json.escalations, run_id: $json.run_id }) }}",
|
||
"options": {
|
||
"responseCode": 200
|
||
}
|
||
},
|
||
"id": "9ca6279a-dfb6-525e-aa18-8385bed2f448",
|
||
"name": "Antwort",
|
||
"type": "n8n-nodes-base.respondToWebhook",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
880,
|
||
200
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"respondWith": "json",
|
||
"responseBody": "={{ JSON.stringify({ status: $json.status, run_id: $json.run_id, reasons: $json.attempts[$json.attempts.length-1].decision.reasons }) }}",
|
||
"options": {
|
||
"responseCode": 422
|
||
}
|
||
},
|
||
"id": "8728502e-e051-5259-a2bd-57646e3b1c5e",
|
||
"name": "Fehler",
|
||
"type": "n8n-nodes-base.respondToWebhook",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
880,
|
||
420
|
||
]
|
||
}
|
||
],
|
||
"connections": {
|
||
"Anfrage": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Konfiguration",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Konfiguration": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Router /v1/run",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Router /v1/run": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Erfolgreich?",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Erfolgreich?": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Antwort",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Fehler",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
}
|
||
},
|
||
"active": false,
|
||
"settings": {
|
||
"executionOrder": "v1"
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "knaster"
|
||
}
|
||
],
|
||
"meta": {
|
||
"description": "cluster-knaster – siehe docs/spec. Import inaktiv, Credentials setzen."
|
||
}
|
||
}
|