207 lines
4.9 KiB
JSON
207 lines
4.9 KiB
JSON
{
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "generate-video",
|
|
"options": {}
|
|
},
|
|
"name": "Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
250,
|
|
300
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "=http://{{$node[\"Webhook\"].json[\"server_ip\"]}}/generate/",
|
|
"options": {
|
|
"formData": {
|
|
"values": {
|
|
"image": {
|
|
"property": "=data:application/octet-stream;base64,{{$node[\"Webhook\"].json[\"image_base64\"]}}",
|
|
"fileName": "=input.jpg"
|
|
},
|
|
"prompt": "={{$node[\"Webhook\"].json[\"prompt\"]}}",
|
|
"n_prompt": "={{$node[\"Webhook\"].json[\"n_prompt\"]}}",
|
|
"seed": "={{$node[\"Webhook\"].json[\"seed\"]}}",
|
|
"length": "={{$node[\"Webhook\"].json[\"length\"]}}",
|
|
"steps": "={{$node[\"Webhook\"].json[\"steps\"]}}",
|
|
"use_teacache": "={{$node[\"Webhook\"].json[\"use_teacache\"]}}",
|
|
"output_filename": "={{$node[\"Webhook\"].json[\"output_filename\"]}}"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"name": "HTTP Request",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.1,
|
|
"position": [
|
|
500,
|
|
300
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"rule": {
|
|
"interval": [
|
|
{
|
|
"field": "seconds",
|
|
"secondsInterval": 10
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"name": "Polling Trigger",
|
|
"type": "n8n-nodes-base.scheduleTrigger",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
250,
|
|
500
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "=http://{{$node[\"HTTP Request\"].json[\"job_id\"]}}/status/{{$node[\"HTTP Request\"].json[\"job_id\"]}}",
|
|
"options": {}
|
|
},
|
|
"name": "Check Status",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.1,
|
|
"position": [
|
|
500,
|
|
500
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"string": [
|
|
{
|
|
"value1": "={{$node[\"Check Status\"].json[\"status\"]}}",
|
|
"operation": "equals",
|
|
"value2": "completed"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"name": "IF",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
700,
|
|
500
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "=http://{{$node[\"Webhook\"].json[\"server_ip\"]}}/result/{{$node[\"HTTP Request\"].json[\"job_id\"]}}_{{$node[\"Webhook\"].json[\"output_filename\"]}}",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"fullResponse": true,
|
|
"responseFormat": "file"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"name": "Download Result",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.1,
|
|
"position": [
|
|
900,
|
|
450
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"values": {
|
|
"string": [
|
|
{
|
|
"name": "jobId",
|
|
"value": "={{$node[\"HTTP Request\"].json[\"job_id\"]}}"
|
|
},
|
|
{
|
|
"name": "status",
|
|
"value": "={{$node[\"Check Status\"].json[\"status\"]}}"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"name": "Continue Polling",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
900,
|
|
550
|
|
]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "HTTP Request",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"HTTP Request": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Polling Trigger",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Polling Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Check Status",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Check Status": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "IF",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"IF": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Download Result",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Continue Polling",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
} |