# @flowforge/node-red-function-gpt

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

Latest version **0.3.0** (published 2023-11-24) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @flowforge/node-red-function-gpt
pnpm add @flowforge/node-red-function-gpt
yarn add @flowforge/node-red-function-gpt
bun add @flowforge/node-red-function-gpt
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2023-11-24 |
| First published | 2023-05-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 94.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Author | Joe Pavitt |
| Maintainers | flowforge |
| Keywords | node-red |

## Links

- npm: https://www.npmjs.com/package/@flowforge/node-red-function-gpt
- Repository: https://github.com/flowforge/node-red-function-gpt
- Homepage: https://github.com/flowforge/node-red-function-gpt#readme
- Issues: https://github.com/flowforge/node-red-function-gpt/issues
- npm.io page: https://npm.io/package/@flowforge/node-red-function-gpt

## Dependencies (3)

- [acorn](https://npm.io/package/acorn.md) ^8.8.2
- [openai](https://npm.io/package/openai.md) ^4.17.4
- [acorn-walk](https://npm.io/package/acorn-walk.md) ^8.2.0

## Recent versions

- 0.3.0 (latest) — 2023-11-24
- 0.2.1 — 2023-05-17
- 0.2.0 — 2023-05-17
- 0.1.0 — 2023-05-02

## README

# Node-RED Function Node with integrated ChatGPT

A Node-RED node that adds an "Ask ChatGPT" input and button to a duplicate of the built-in function node.

<img width="1728" alt="Screenshot 2023-04-21 at 16 08 47" src="https://user-images.githubusercontent.com/99246719/233671631-fefa36c1-6db4-4392-a057-314c16fd91b7.png">


## Installation

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

1. Open the "Menu" inside Node-RED
1. Click "Manage palette"
1. Select the "Install" tab
1. Search "chatgpt"
1. Install the `node-red-function-gpt` node

You will need a [valid API Key from OpenAI](https://platform.openai.com/account/api-keys)

## How to Use

### Basic Example

<img width="652" alt="Screenshot 2023-05-17 at 12 45 08" src="https://github.com/flowforge/node-red-function-gpt/assets/99246719/3684d81a-1591-4fe2-a632-dfa8e3a3af93">

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".

### 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.:

```js
//$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.

<img width="266" alt="Screenshot 2023-05-17 at 12 43 51" src="https://github.com/flowforge/node-red-function-gpt/assets/99246719/cc16e946-ad78-4f68-99f2-ae35898c55c2">

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](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/nodes/core/function/10-function.js) that is copyright OpenJS Foundation and licensed under the Apache License, Version 2.0

---
_Source: https://npm.io/package/@flowforge/node-red-function-gpt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
