A Node-RED node that adds an "Ask ChatGPT" input and button to a duplicate of the built-in function node.
To add the node to your own instance of Node-RED:
- Open the "Menu" inside Node-RED
- Click "Manage palette"
- Select the "Install" tab
- Search "chatgpt"
- Install the
node-red-function-gpt
node
You will need a valid API Key from OpenAI
- Add the Function GPT nodes to your editor
- Configure your ChatGPT credentials
- Deploy your nodes
- Open the function-gpt node
- Type your prompt into the text input at the bottom of the editor panel and click "Ask ChatGPT".
If you want to inject code into already written content, you can write an inline prompt. These prompts are written as comments, e.g.:
//$PROMPT: Double the input
If you've configured Node-RED to use the "Monaco" editor, this will then show an "Ask ChatGPT" hyperlink above the inserted comment, that you can click to ask this to ChatGPT.
You can have as many of these within the function node as you like.
After adding the node to the palette, you do currently need to "Deploy", before you can use the integrated ChatGPT prompt.
This code is derived from the core Node-RED Function node that is copyright OpenJS Foundation and licensed under the Apache License, Version 2.0