node-red-contrib-custom-chatgpt
Version:
A Node-RED node that interacts with OpenAI machine learning models to generate text and image outputs like 'ChatGPT', 'DALL·E 2', and 'DALL·E 3'.
1,308 lines • 36.5 kB
JSON
[
{
"id": "3fd7d9d5831b7682",
"type": "tab",
"label": "ChatGPT node generator",
"disabled": false,
"info": "",
"env": []
},
{
"id": "22855aff951286e8",
"type": "group",
"z": "3fd7d9d5831b7682",
"name": "Nodes made by a ChatGPT node using the gpt-3.5-turbo model",
"style": {
"label": true
},
"nodes": [
"615c6e787b0b8cf6",
"73afc4a92e0e28ce",
"a050c5ab1c9b8db4",
"f7530fba30273fae",
"62224bd45ec47eda",
"be7e208e0c801c59",
"127dbf6b6db7ada8",
"7b1923ed394e7f6a",
"40c90963b3b03ab7",
"41fc6e6c55b22d15"
],
"x": 674,
"y": 239,
"w": 402,
"h": 582
},
{
"id": "0f5454cfef59c42d",
"type": "group",
"z": "3fd7d9d5831b7682",
"name": "Node generator templates",
"style": {
"label": true
},
"nodes": [
"3255e27c1d746456",
"8abb2c1a0816738b",
"066f14ba28cf732b",
"580702fcddbcba8f",
"6b6b5995bb167409",
"7aa23b5f7aaf3948",
"db35b2f9dbc267e5",
"769eeabd6c0f8f1d",
"e7d7a636f5b79b16",
"492f869dd425cbb2",
"1a0b169db6687b16",
"66762c2a030a4558",
"1e45800e774dd00b",
"5fa384194f3bdb6d",
"171c332682955427",
"a9d3624877d8e3b9",
"340a742cc6423377",
"0412e5ed23135e45",
"8a4b91b9acc48071",
"e2f27f4f97bb4683",
"9e12fe8c808b34d0"
],
"x": 14,
"y": 239,
"w": 572,
"h": 582
},
{
"id": "c8e37a3d9111f98a",
"type": "group",
"z": "3fd7d9d5831b7682",
"name": "Auto-Importer (Windows + Mac)",
"style": {
"label": true
},
"nodes": [
"a19628a95e7bba2e",
"3af9a4ecd33dbe63",
"5bb12c197c742e48",
"4d271e7267c69360",
"b79eca37abc5fc99",
"bf9933a02c587876",
"dd94b3a222b6b0e8",
"15be7bea90f95a9c",
"4b47a2580b7dbb19",
"c76174fde7299813",
"771075e9ec4a6a87",
"04a9124c208fd84d",
"0edc6e7bb2ccad3f",
"cccf2076d83038fb"
],
"x": 674,
"y": 19,
"w": 872,
"h": 202
},
{
"id": "949469fbfcf72750",
"type": "junction",
"z": "3fd7d9d5831b7682",
"x": 620,
"y": 280,
"wires": [
[
"7ca25b19d1f77e0b"
]
]
},
{
"id": "43314e1f43e05663",
"type": "debug",
"z": "3fd7d9d5831b7682",
"name": "debug prompt inputs",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 400,
"y": 60,
"wires": []
},
{
"id": "3255e27c1d746456",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "switch node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"switch\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to route messages based on the following rules: ```{{{payload}}}```",
"output": "str",
"x": 460,
"y": 500,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "8abb2c1a0816738b",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "8-way switch",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "contains \"wind\", contains \"holy\", contains \"fire\", contains \"ice\", contains \"earth\", contains \"lightning\", contains \"posion\", otherwise",
"payloadType": "str",
"x": 130,
"y": 480,
"wires": [
[
"9e12fe8c808b34d0"
]
]
},
{
"id": "590312af5ccdc305",
"type": "switch",
"z": "3fd7d9d5831b7682",
"name": "gate",
"property": "gate",
"propertyType": "flow",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 510,
"y": 100,
"wires": [
[
"04a9124c208fd84d"
]
]
},
{
"id": "7ca25b19d1f77e0b",
"type": "change",
"z": "3fd7d9d5831b7682",
"name": "open gates",
"rules": [
{
"t": "set",
"p": "gate",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 190,
"y": 100,
"wires": [
[
"43314e1f43e05663",
"b775e23209198fad"
]
]
},
{
"id": "066f14ba28cf732b",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "3-way switch",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "greater than or equals to 100, less than 100, else",
"payloadType": "str",
"x": 130,
"y": 520,
"wires": [
[
"9e12fe8c808b34d0"
]
]
},
{
"id": "580702fcddbcba8f",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "debug node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"debug\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to: `{{{payload}}}`",
"output": "str",
"x": 460,
"y": 320,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "6b6b5995bb167409",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "debug",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "display the complete message object",
"payloadType": "str",
"x": 110,
"y": 320,
"wires": [
[
"580702fcddbcba8f"
]
]
},
{
"id": "7aa23b5f7aaf3948",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "http request node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"http request\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to: send a {{type}} request to {{url}}{{payload}}",
"output": "str",
"x": 440,
"y": 780,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "db35b2f9dbc267e5",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "http",
"props": [
{
"p": "payload"
},
{
"p": "type",
"v": "GET",
"vt": "str"
},
{
"p": "url",
"v": "reddit",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": " to view the front page",
"payloadType": "str",
"x": 110,
"y": 780,
"wires": [
[
"7aa23b5f7aaf3948"
]
]
},
{
"id": "615c6e787b0b8cf6",
"type": "switch",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "wind",
"vt": "str"
},
{
"t": "cont",
"v": "holy",
"vt": "str"
},
{
"t": "cont",
"v": "fire",
"vt": "str"
},
{
"t": "cont",
"v": "ice",
"vt": "str"
},
{
"t": "cont",
"v": "earth",
"vt": "str"
},
{
"t": "cont",
"v": "lightning",
"vt": "str"
},
{
"t": "cont",
"v": "poison",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 8,
"x": 750,
"y": 480,
"wires": [
[],
[],
[],
[],
[],
[],
[],
[]
]
},
{
"id": "73afc4a92e0e28ce",
"type": "switch",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "100",
"vt": "num"
},
{
"t": "lt",
"v": "100",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 750,
"y": 580,
"wires": [
[],
[],
[]
]
},
{
"id": "a050c5ab1c9b8db4",
"type": "http request",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://www.reddit.com/.json",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": false,
"headers": [],
"x": 770,
"y": 780,
"wires": [
[]
]
},
{
"id": "769eeabd6c0f8f1d",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "inject node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"inject\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to: send a message object with the following: {{{payload}}}\n",
"output": "str",
"x": 460,
"y": 280,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "e7d7a636f5b79b16",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "inject",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{ \"payload\": \"success\", \"topic\": \"turbo\" }",
"payloadType": "str",
"x": 110,
"y": 280,
"wires": [
[
"769eeabd6c0f8f1d"
]
]
},
{
"id": "f7530fba30273fae",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "turbo",
"payload": "success",
"payloadType": "str",
"x": 790,
"y": 280,
"wires": [
[]
]
},
{
"id": "62224bd45ec47eda",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 750,
"y": 320,
"wires": []
},
{
"id": "492f869dd425cbb2",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "comment node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"comment\" node named {{{name}}} that can be imported into the Node-RED editor. Do not add any additional comments or explanations. The node should contain the following info: ```{{{payload}}}```",
"output": "str",
"x": 450,
"y": 360,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "1a0b169db6687b16",
"type": "function",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "sanitize",
"func": "const x = msg.timestamp;\nmsg.timestamp = new Date(x).toLocaleString();\nmsg.name = `\"${msg.name} ${msg.timestamp}\"`\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 260,
"y": 360,
"wires": [
[
"492f869dd425cbb2"
]
]
},
{
"id": "66762c2a030a4558",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "comment",
"props": [
{
"p": "payload"
},
{
"p": "name",
"v": "comment made on",
"vt": "str"
},
{
"p": "timestamp",
"v": "",
"vt": "date"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[\"success\",true]",
"payloadType": "str",
"x": 120,
"y": 360,
"wires": [
[
"1a0b169db6687b16"
]
]
},
{
"id": "be7e208e0c801c59",
"type": "comment",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "comment made on 3/30/2023, 9:59:50 PM",
"info": "[\"success\",true]",
"x": 860,
"y": 360,
"wires": []
},
{
"id": "1e45800e774dd00b",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "function node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"function\" node that can be imported into the Node-RED editor. Do not add any additional comments or explanations. The node should contain the following JavaScript code: ```{{{payload}}}```",
"output": "str",
"x": 450,
"y": 400,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "5fa384194f3bdb6d",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "function",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "msg.payload = { \"result\": { \"success\": true }};msg.topic = \"Auto\";return msg;",
"payloadType": "str",
"x": 110,
"y": 400,
"wires": [
[
"1e45800e774dd00b"
]
]
},
{
"id": "127dbf6b6db7ada8",
"type": "function",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"func": "msg.payload = { \"result\": { \"success\": true }};\nmsg.topic = \"Auto\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 760,
"y": 400,
"wires": [
[]
]
},
{
"id": "171c332682955427",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "change node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"change\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured based on the following rules: ```{{{payload}}}```",
"output": "str",
"x": 450,
"y": 640,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "a9d3624877d8e3b9",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "change",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "set msg.element to \"fire\", set msg.topic to \"turbo\", move msg.payload to msg.saved",
"payloadType": "str",
"x": 110,
"y": 640,
"wires": [
[
"171c332682955427"
]
]
},
{
"id": "7b1923ed394e7f6a",
"type": "change",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "",
"rules": [
{
"t": "set",
"p": "element",
"pt": "msg",
"to": "fire",
"tot": "str"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "turbo",
"tot": "str"
},
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "saved",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 780,
"y": 640,
"wires": [
[]
]
},
{
"id": "340a742cc6423377",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "range node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"range\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to map the input range {{{input}}} to the output range of {{{output}}}, round: {{{round}}}",
"output": "str",
"x": 460,
"y": 680,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "0412e5ed23135e45",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "range",
"props": [
{
"p": "input",
"v": "0-20",
"vt": "str"
},
{
"p": "output",
"v": "0-100",
"vt": "str"
},
{
"p": "round",
"v": "true",
"vt": "bool"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 110,
"y": 680,
"wires": [
[
"340a742cc6423377"
]
]
},
{
"id": "40c90963b3b03ab7",
"type": "range",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"minin": "0",
"maxin": "20",
"minout": "0",
"maxout": "100",
"action": "scale",
"round": true,
"property": "payload",
"name": "",
"x": 760,
"y": 680,
"wires": [
[]
]
},
{
"id": "8a4b91b9acc48071",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "template node generator",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "Respond only with valid JSON syntax for a single Node-RED \"template\" node that can be imported into the Node-RED editor. Do not add any comments or explanations. The node should be configured to format: {{format}}, output as {{output}}, with the payload: {{{payload}}}",
"output": "str",
"x": 450,
"y": 720,
"wires": [
[
"949469fbfcf72750"
]
]
},
{
"id": "e2f27f4f97bb4683",
"type": "inject",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "template",
"props": [
{
"p": "payload"
},
{
"p": "format",
"v": "Mustache template",
"vt": "str"
},
{
"p": "output",
"v": "plain text",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "Node {{name}} created successfully",
"payloadType": "str",
"x": 120,
"y": 720,
"wires": [
[
"8a4b91b9acc48071"
]
]
},
{
"id": "41fc6e6c55b22d15",
"type": "template",
"z": "3fd7d9d5831b7682",
"g": "22855aff951286e8",
"name": "Success Message",
"field": "payload",
"fieldType": "msg",
"format": "mustache",
"syntax": "plain",
"template": "Node {{name}} created successfully",
"x": 790,
"y": 720,
"wires": [
[]
]
},
{
"id": "a19628a95e7bba2e",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "debug clipboard",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 100,
"wires": []
},
{
"id": "3af9a4ecd33dbe63",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "debug import",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1210,
"y": 180,
"wires": []
},
{
"id": "5bb12c197c742e48",
"type": "switch",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "gate",
"property": "gate",
"propertyType": "flow",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1030,
"y": 140,
"wires": [
[
"bf9933a02c587876"
]
]
},
{
"id": "4d271e7267c69360",
"type": "change",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "close gates",
"rules": [
{
"t": "set",
"p": "gate",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1010,
"y": 60,
"wires": [
[
"b79eca37abc5fc99"
]
]
},
{
"id": "b79eca37abc5fc99",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "debug errors",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1210,
"y": 60,
"wires": []
},
{
"id": "bf9933a02c587876",
"type": "function",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "auto-import-from-clipboard",
"func": "switch (os.platform()){\n case \"win32\":\n return {\n payload: `cmd.exe /c echo set WshShell = WScript.CreateObject(\"WScript.Shell\") > %temp%\\\\temp.vbs && echo WshShell.SendKeys \"^i\" >> %temp%\\\\temp.vbs && echo WScript.Sleep 250 >> %temp%\\\\temp.vbs && echo WshShell.SendKeys \"^v\" >> %temp%\\\\temp.vbs && echo WScript.Sleep 250 >> %temp%\\\\temp.vbs && echo WshShell.SendKeys \"{TAB}{TAB}{TAB}{TAB}{ENTER}\" >> %temp%\\\\temp.vbs && cscript //nologo %temp%\\\\temp.vbs && del %temp%\\\\temp.vbs`\n };\n case \"darwin\":\n return {\n payload: `osascript -e 'tell application \"System Events\" to keystroke \"i\" using {command down}' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke \"v\" using {command down}' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke tab' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke tab' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke tab' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke tab' -e 'delay 0.25' -e 'tell application \"System Events\" to keystroke return'`\n };\n default:\n throw new Error(`unsupported platform ${os.platform()}. Consider porting with gpt and submitting a PR!`) \n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "os",
"module": "os"
}
],
"x": 960,
"y": 180,
"wires": [
[
"3af9a4ecd33dbe63",
"dd94b3a222b6b0e8"
]
]
},
{
"id": "dd94b3a222b6b0e8",
"type": "exec",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"command": "",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "",
"x": 1250,
"y": 140,
"wires": [
[
"c76174fde7299813"
],
[
"4b47a2580b7dbb19"
],
[
"771075e9ec4a6a87"
]
]
},
{
"id": "15be7bea90f95a9c",
"type": "function",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "ctrl-c",
"func": "let clipboard = msg.payload;\n\nswitch (os.platform()) {\n case \"win32\":\n return {\n payload: `echo ${clipboard} | clip`\n };\n case \"darwin\":\n return {\n payload: `echo '${clipboard}' | pbcopy`\n };\n default:\n throw new Error(`unsupported platform ${os.platform()}. Consider porting with gpt and submitting a PR!`)\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "os",
"module": "os"
}
],
"x": 1030,
"y": 100,
"wires": [
[
"a19628a95e7bba2e",
"dd94b3a222b6b0e8",
"cccf2076d83038fb"
]
]
},
{
"id": "4b47a2580b7dbb19",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "stderr",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1410,
"y": 140,
"wires": []
},
{
"id": "c76174fde7299813",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "stdout",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1410,
"y": 100,
"wires": []
},
{
"id": "771075e9ec4a6a87",
"type": "debug",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "return code",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1430,
"y": 180,
"wires": []
},
{
"id": "04a9124c208fd84d",
"type": "function",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "response sanitizer and formatter",
"func": "msg.payload = msg.payload.trim();\n\nif (msg.payload.startsWith(\"```\") === true) {\n msg.payload = msg.payload.replace(/```/g, \"\").trim();\n}\n\nif (msg.payload.startsWith(\"json\") === true) {\n msg.payload = msg.payload.replace(\"json\", \"\").trim();\n}\n\nif (msg.payload.endsWith(\"```\") === true) {\n msg.payload = msg.payload.replace(/```/g, \"\").trim();\n}\n\nif (msg.payload.startsWith(\"[\") === false) {\n msg.payload = `[${msg.payload}`;\n}\n\nif (msg.payload.endsWith(\"]\") === false) {\n msg.payload = `${msg.payload}]`;\n}\nmsg.payload = msg.payload.replace(/[\\n]/g, '');\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 830,
"y": 100,
"wires": [
[
"15be7bea90f95a9c"
]
]
},
{
"id": "0edc6e7bb2ccad3f",
"type": "catch",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "",
"scope": [
"4bf10c243e6a6319",
"dd94b3a222b6b0e8",
"15be7bea90f95a9c",
"bf9933a02c587876"
],
"uncaught": false,
"x": 750,
"y": 60,
"wires": [
[
"4d271e7267c69360"
]
]
},
{
"id": "cccf2076d83038fb",
"type": "delay",
"z": "3fd7d9d5831b7682",
"g": "c8e37a3d9111f98a",
"name": "",
"pauseType": "delay",
"timeout": "500",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 890,
"y": 140,
"wires": [
[
"5bb12c197c742e48"
]
]
},
{
"id": "b775e23209198fad",
"type": "chatgpt",
"z": "3fd7d9d5831b7682",
"name": "",
"API_KEY": "",
"Organization": "",
"topic": "turbo",
"BaseUrl": "https://api.openai.com",
"x": 360,
"y": 100,
"wires": [
[
"590312af5ccdc305"
]
]
},
{
"id": "9e12fe8c808b34d0",
"type": "string",
"z": "3fd7d9d5831b7682",
"g": "0f5454cfef59c42d",
"name": "sanitize",
"methods": [
{
"name": "replaceAll",
"params": [
{
"type": "str",
"value": "otherwise"
},
{
"type": "str",
"value": "else"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 280,
"y": 500,
"wires": [
[
"3255e27c1d746456"
]
]
}
]