@supcon-international/node-red-function-gpt-with-memory 0.0.1

Variation of the standard Node-RED function node that includes an interface to ChatGPT with memory for writing into the function content.

npm install @supcon-international/node-red-function-gpt-with-memory

Node-RED Function Node with integrated ChatGPT With Memory, Multi-turn Conversations Support

The Code based on @flowfuse/node-red-function-gpt,Thanks for their contribution

A Node-RED node that adds an "Ask ChatGPT(With Memory)" input and button to a duplicate of the built-in function node. picture 1

Installation

To add the node to your own instance of Node-RED:

  1. Open the "Menu" inside Node-RED
  2. Click "Manage palette"
  3. Select the "Install" tab
  4. Search "chatgpt"
  5. Install the node-red-function-gpt-with-memory node

You will need a valid API Key from OpenAI

How to Use

Basic Example

picture 1

  1. Add the Function GPT nodes to your editor
  2. Configure your ChatGPT credentials
  3. Deploy your nodes
  4. Open the function-gpt node
  5. Type your prompt into the text input at the bottom of the editor panel and click "Ask ChatGPT(With Memory)".

New Features

Contributed by Zhou Xingyu

The node now includes several enhanced features:

  1. Memory Management: The node maintains conversation history for each instance
  2. Multi-turn Conversations: Support for multi-turn conversations with ChatGPT, enabling more complex and contextual interactions.
  3. Improved User Experience: After asking a question, the input field is automatically cleared for a smoother workflow.

Basic example for memory

picture 2 GPT can remember what I said before
picture 3

Inline Prompts

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(With Memory)" hyperlink above the inserted comment, that you can click to ask this to ChatGPT.

picture 5

You can have as many of these within the function node as you like.

Troubleshooting

After adding the node to the palette, you do currently need to "Deploy", before you can use the integrated ChatGPT prompt.

Copyright

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

Node Info

Version: 0.0.1
Updated 2 days ago
License: Apache-2.0
Rating: not yet rated

Categories

Actions

Rate:

Downloads

34 in the last week

Nodes

  • function-gpt
  • chatgpt-config

Keywords

  • node-red

Maintainers