├── .env.example
├── .gitignore
├── README.md
├── config.js
├── extension
├── background.js
├── content.js
├── icon.png
└── manifest.json
├── package-lock.json
├── package.json
├── plugins
├── Default.js
├── Gangster.js
└── Image.js
└── server.js
/.env.example:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY=
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | extension.crx
3 | extension.pem
4 | .env
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ChatGPT Chrome Extension 🤖 ✨
2 |
3 | A Chrome extension that adds [ChatGPT](https://chat.openai.com) to every text box on the internet! Use it to write tweets, revise emails, fix coding bugs, or whatever else you need, all without leaving the site you're on. Includes a plugin system for greater control over ChatGPT behavior and ability to interact with 3rd party APIs.
4 |
5 | 
6 |
7 | ## Install
8 |
9 | First clone this repo on your local machine
10 |
11 | Then install dependencies
12 |
13 | ```bash
14 | npm install
15 | ```
16 |
17 | Copy `.env-example` into a new file named `.env` and add your ChatGPT API Key.
18 |
19 | Run the server so the extension can communicate with ChatGPT.
20 |
21 | ```bash
22 | node server.js
23 | ```
24 |
25 | This will automate interaction with ChatGPT through OpenAI's API, thanks to the [chatgpt-api](https://github.com/transitive-bullshit/chatgpt-api) library.
26 |
27 | Add the extension
28 |
29 | 1. Go to chrome://extensions in your Google Chrome browser
30 | 2. Check the Developer mode checkbox in the top right-hand corner
31 | 3. Click "Load Unpacked" to see a file-selection dialog
32 | 4. Select your local `chatgpt-chrome-extension/extension` directory
33 |
34 | You'll now see "Ask ChatGPT" if you right click in any text input or content editable area.
35 |
36 | ## Troubleshooting
37 |
38 | If ChatGPT is taking a very long time to respond or not responding at all then it could mean that their servers are currently overloaded. You can confirm this by going to [chat.openai.com/chat](https://chat.openai.com/chat) and seeing whether their website works directly.
39 |
40 | ## Plugins
41 |
42 | Plugins have the ability to inform ChatGPT of specific conversation rules and parse replies from ChatGPT before they are sent to the browser.
43 |
44 | [Default](/plugins/Default.js) - Sets some default conversation rules 🧑🏫
45 |
46 | [Image](/plugins/Image.js) - Tells ChatGPT to describe things visually when asked for an image and then replaces the description with a matching AI generated image from [Lexica](http://lexica.art) 📸
47 |
48 | Your really cool plugin - Go make a plugin, do a pull-request and I'll add it the list 🤝
49 |
50 | ## Related
51 |
52 | Huge thanks to Travis Fischer for creating [chatgpt-api](https://github.com/transitive-bullshit/chatgpt-api)
53 |
54 | ## License
55 |
56 | MIT © Gabe Ragland (follow me on Twitter)
57 |
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | import Default from "./plugins/Default.js";
2 | import Image from "./plugins/Image.js";
3 | import Gangster from "./plugins/Gangster.js";
4 |
5 | const config = {
6 | plugins: [
7 | // Stop telling me you can't browse the internet, etc
8 | Default,
9 | // Add image generation ability
10 | //Image,
11 | // Talk like a 1940's gangster
12 | //Gangster,
13 | ],
14 | };
15 |
16 | export default config;
17 |
--------------------------------------------------------------------------------
/extension/background.js:
--------------------------------------------------------------------------------
1 | // Create a context menu item
2 | chrome.contextMenus.create({
3 | id: "ask-chatgpt",
4 | title: "Ask ChatGPT",
5 | contexts: ["all"],
6 | });
7 |
8 | // Listen for when the user clicks on the context menu item
9 | chrome.contextMenus.onClicked.addListener((info, tab) => {
10 | if (info.menuItemId === "ask-chatgpt") {
11 | // Send a message to the content script
12 | chrome.tabs.sendMessage(tab.id, { type: "ASK_CHATGPT" });
13 | }
14 | });
15 |
--------------------------------------------------------------------------------
/extension/content.js:
--------------------------------------------------------------------------------
1 | // Listen for messages from the background script
2 | chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
3 | if (message.type === "ASK_CHATGPT") {
4 | let originalActiveElement;
5 | let text;
6 |
7 | // If there's an active text input
8 | if (
9 | document.activeElement &&
10 | (document.activeElement.isContentEditable ||
11 | document.activeElement.nodeName.toUpperCase() === "TEXTAREA" ||
12 | document.activeElement.nodeName.toUpperCase() === "INPUT")
13 | ) {
14 | // Set as original for later
15 | originalActiveElement = document.activeElement;
16 | // Use selected text or all text in the input
17 | text =
18 | document.getSelection().toString().trim() ||
19 | document.activeElement.textContent.trim();
20 | } else {
21 | // If no active text input use any selected text on page
22 | text = document.getSelection().toString().trim();
23 | }
24 |
25 | if (!text) {
26 | alert(
27 | "No text found. Select this option after right clicking on a textarea that contains text or on a selected portion of text."
28 | );
29 | return;
30 | }
31 |
32 | showLoadingCursor();
33 |
34 | // Send the text to the API endpoint
35 | fetch("http://localhost:3000", {
36 | method: "POST",
37 | headers: {
38 | "Content-Type": "application/json",
39 | },
40 | body: JSON.stringify({ message: text }),
41 | })
42 | .then((response) => response.json())
43 | .then(async (data) => {
44 | // Use original text element and fallback to current active text element
45 | const activeElement =
46 | originalActiveElement ||
47 | (document.activeElement.isContentEditable && document.activeElement);
48 |
49 | if (activeElement) {
50 | if (
51 | activeElement.nodeName.toUpperCase() === "TEXTAREA" ||
52 | activeElement.nodeName.toUpperCase() === "INPUT"
53 | ) {
54 | // Insert after selection
55 | activeElement.value =
56 | activeElement.value.slice(0, activeElement.selectionEnd) +
57 | `\n\n${data.reply}` +
58 | activeElement.value.slice(
59 | activeElement.selectionEnd,
60 | activeElement.length
61 | );
62 | } else {
63 | // Special handling for contenteditable
64 | const replyNode = document.createTextNode(`\n\n${data.reply}`);
65 | const selection = window.getSelection();
66 |
67 | if (selection.rangeCount === 0) {
68 | selection.addRange(document.createRange());
69 | selection.getRangeAt(0).collapse(activeElement, 1);
70 | }
71 |
72 | const range = selection.getRangeAt(0);
73 | range.collapse(false);
74 |
75 | // Insert reply
76 | range.insertNode(replyNode);
77 |
78 | // Move the cursor to the end
79 | selection.collapse(replyNode, replyNode.length);
80 | }
81 | } else {
82 | // Alert reply since no active text area
83 | alert(`ChatGPT says: ${data.reply}`);
84 | }
85 |
86 | restoreCursor();
87 | })
88 | .catch((error) => {
89 | restoreCursor();
90 | alert(
91 | "Error. Make sure you're running the server by following the instructions on https://github.com/gragland/chatgpt-chrome-extension. Also make sure you don't have an adblocker preventing requests to localhost:3000."
92 | );
93 | throw new Error(error);
94 | });
95 | }
96 | });
97 |
98 | const showLoadingCursor = () => {
99 | const style = document.createElement("style");
100 | style.id = "cursor_wait";
101 | style.innerHTML = `* {cursor: wait;}`;
102 | document.head.insertBefore(style, null);
103 | };
104 |
105 | const restoreCursor = () => {
106 | document.getElementById("cursor_wait").remove();
107 | };
108 |
--------------------------------------------------------------------------------
/extension/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gragland/chatgpt-chrome-extension/5b1bd2ad31ed92ed8eb08b4e144dbf70b0d50db2/extension/icon.png
--------------------------------------------------------------------------------
/extension/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "name": "Ask ChatGPT",
4 | "version": "1.0.0",
5 | "permissions": ["contextMenus"],
6 | "icons": {
7 | "16": "icon.png",
8 | "48": "icon.png",
9 | "128": "icon.png"
10 | },
11 | "background": {
12 | "service_worker": "background.js"
13 | },
14 | "content_scripts": [
15 | {
16 | "matches": [""],
17 | "js": ["content.js"]
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-chrome-extension",
3 | "lockfileVersion": 3,
4 | "requires": true,
5 | "packages": {
6 | "": {
7 | "dependencies": {
8 | "body-parser": "^1.20.1",
9 | "chatgpt": "^4.0.0",
10 | "cors": "^2.8.5",
11 | "dotenv": "^16.0.3",
12 | "dotenv-safe": "^8.2.0",
13 | "express": "^4.18.2",
14 | "node-fetch": "^3.3.0",
15 | "ora": "^6.1.2"
16 | }
17 | },
18 | "node_modules/accepts": {
19 | "version": "1.3.8",
20 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
21 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
22 | "dependencies": {
23 | "mime-types": "~2.1.34",
24 | "negotiator": "0.6.3"
25 | },
26 | "engines": {
27 | "node": ">= 0.6"
28 | }
29 | },
30 | "node_modules/ansi-regex": {
31 | "version": "6.0.1",
32 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
33 | "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
34 | "engines": {
35 | "node": ">=12"
36 | },
37 | "funding": {
38 | "url": "https://github.com/chalk/ansi-regex?sponsor=1"
39 | }
40 | },
41 | "node_modules/array-flatten": {
42 | "version": "1.1.1",
43 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
44 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
45 | },
46 | "node_modules/base64-js": {
47 | "version": "1.5.1",
48 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
49 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
50 | "funding": [
51 | {
52 | "type": "github",
53 | "url": "https://github.com/sponsors/feross"
54 | },
55 | {
56 | "type": "patreon",
57 | "url": "https://www.patreon.com/feross"
58 | },
59 | {
60 | "type": "consulting",
61 | "url": "https://feross.org/support"
62 | }
63 | ]
64 | },
65 | "node_modules/bl": {
66 | "version": "5.1.0",
67 | "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz",
68 | "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==",
69 | "dependencies": {
70 | "buffer": "^6.0.3",
71 | "inherits": "^2.0.4",
72 | "readable-stream": "^3.4.0"
73 | }
74 | },
75 | "node_modules/body-parser": {
76 | "version": "1.20.1",
77 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
78 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
79 | "dependencies": {
80 | "bytes": "3.1.2",
81 | "content-type": "~1.0.4",
82 | "debug": "2.6.9",
83 | "depd": "2.0.0",
84 | "destroy": "1.2.0",
85 | "http-errors": "2.0.0",
86 | "iconv-lite": "0.4.24",
87 | "on-finished": "2.4.1",
88 | "qs": "6.11.0",
89 | "raw-body": "2.5.1",
90 | "type-is": "~1.6.18",
91 | "unpipe": "1.0.0"
92 | },
93 | "engines": {
94 | "node": ">= 0.8",
95 | "npm": "1.2.8000 || >= 1.4.16"
96 | }
97 | },
98 | "node_modules/buffer": {
99 | "version": "6.0.3",
100 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
101 | "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
102 | "funding": [
103 | {
104 | "type": "github",
105 | "url": "https://github.com/sponsors/feross"
106 | },
107 | {
108 | "type": "patreon",
109 | "url": "https://www.patreon.com/feross"
110 | },
111 | {
112 | "type": "consulting",
113 | "url": "https://feross.org/support"
114 | }
115 | ],
116 | "dependencies": {
117 | "base64-js": "^1.3.1",
118 | "ieee754": "^1.2.1"
119 | }
120 | },
121 | "node_modules/bytes": {
122 | "version": "3.1.2",
123 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
124 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
125 | "engines": {
126 | "node": ">= 0.8"
127 | }
128 | },
129 | "node_modules/call-bind": {
130 | "version": "1.0.2",
131 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
132 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
133 | "dependencies": {
134 | "function-bind": "^1.1.1",
135 | "get-intrinsic": "^1.0.2"
136 | },
137 | "funding": {
138 | "url": "https://github.com/sponsors/ljharb"
139 | }
140 | },
141 | "node_modules/chalk": {
142 | "version": "5.2.0",
143 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz",
144 | "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==",
145 | "engines": {
146 | "node": "^12.17.0 || ^14.13 || >=16.0.0"
147 | },
148 | "funding": {
149 | "url": "https://github.com/chalk/chalk?sponsor=1"
150 | }
151 | },
152 | "node_modules/chatgpt": {
153 | "version": "4.1.1",
154 | "resolved": "https://registry.npmjs.org/chatgpt/-/chatgpt-4.1.1.tgz",
155 | "integrity": "sha512-2Hn9kjSSndvmLiRLYK1xHXxf436xwby3vmLBlLayxFFErQHW2+47zjGlaanhrFzb89MfWsf+1GPwl/qKklDUeA==",
156 | "dependencies": {
157 | "eventsource-parser": "^0.0.5",
158 | "gpt-3-encoder": "^1.1.4",
159 | "keyv": "^4.5.2",
160 | "p-timeout": "^6.0.0",
161 | "quick-lru": "^6.1.1",
162 | "uuid": "^9.0.0"
163 | },
164 | "engines": {
165 | "node": ">=18"
166 | }
167 | },
168 | "node_modules/cli-cursor": {
169 | "version": "4.0.0",
170 | "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz",
171 | "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==",
172 | "dependencies": {
173 | "restore-cursor": "^4.0.0"
174 | },
175 | "engines": {
176 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
177 | },
178 | "funding": {
179 | "url": "https://github.com/sponsors/sindresorhus"
180 | }
181 | },
182 | "node_modules/cli-spinners": {
183 | "version": "2.7.0",
184 | "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.7.0.tgz",
185 | "integrity": "sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw==",
186 | "engines": {
187 | "node": ">=6"
188 | },
189 | "funding": {
190 | "url": "https://github.com/sponsors/sindresorhus"
191 | }
192 | },
193 | "node_modules/clone": {
194 | "version": "1.0.4",
195 | "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
196 | "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==",
197 | "engines": {
198 | "node": ">=0.8"
199 | }
200 | },
201 | "node_modules/content-disposition": {
202 | "version": "0.5.4",
203 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
204 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
205 | "dependencies": {
206 | "safe-buffer": "5.2.1"
207 | },
208 | "engines": {
209 | "node": ">= 0.6"
210 | }
211 | },
212 | "node_modules/content-type": {
213 | "version": "1.0.5",
214 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
215 | "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
216 | "engines": {
217 | "node": ">= 0.6"
218 | }
219 | },
220 | "node_modules/cookie": {
221 | "version": "0.5.0",
222 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
223 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
224 | "engines": {
225 | "node": ">= 0.6"
226 | }
227 | },
228 | "node_modules/cookie-signature": {
229 | "version": "1.0.6",
230 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
231 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
232 | },
233 | "node_modules/cors": {
234 | "version": "2.8.5",
235 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
236 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
237 | "dependencies": {
238 | "object-assign": "^4",
239 | "vary": "^1"
240 | },
241 | "engines": {
242 | "node": ">= 0.10"
243 | }
244 | },
245 | "node_modules/data-uri-to-buffer": {
246 | "version": "4.0.1",
247 | "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
248 | "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
249 | "engines": {
250 | "node": ">= 12"
251 | }
252 | },
253 | "node_modules/debug": {
254 | "version": "2.6.9",
255 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
256 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
257 | "dependencies": {
258 | "ms": "2.0.0"
259 | }
260 | },
261 | "node_modules/defaults": {
262 | "version": "1.0.4",
263 | "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",
264 | "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==",
265 | "dependencies": {
266 | "clone": "^1.0.2"
267 | },
268 | "funding": {
269 | "url": "https://github.com/sponsors/sindresorhus"
270 | }
271 | },
272 | "node_modules/depd": {
273 | "version": "2.0.0",
274 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
275 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
276 | "engines": {
277 | "node": ">= 0.8"
278 | }
279 | },
280 | "node_modules/destroy": {
281 | "version": "1.2.0",
282 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
283 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
284 | "engines": {
285 | "node": ">= 0.8",
286 | "npm": "1.2.8000 || >= 1.4.16"
287 | }
288 | },
289 | "node_modules/dotenv": {
290 | "version": "16.0.3",
291 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
292 | "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
293 | "engines": {
294 | "node": ">=12"
295 | }
296 | },
297 | "node_modules/dotenv-safe": {
298 | "version": "8.2.0",
299 | "resolved": "https://registry.npmjs.org/dotenv-safe/-/dotenv-safe-8.2.0.tgz",
300 | "integrity": "sha512-uWwWWdUQkSs5a3mySDB22UtNwyEYi0JtEQu+vDzIqr9OjbDdC2Ip13PnSpi/fctqlYmzkxCeabiyCAOROuAIaA==",
301 | "dependencies": {
302 | "dotenv": "^8.2.0"
303 | }
304 | },
305 | "node_modules/dotenv-safe/node_modules/dotenv": {
306 | "version": "8.6.0",
307 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
308 | "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
309 | "engines": {
310 | "node": ">=10"
311 | }
312 | },
313 | "node_modules/ee-first": {
314 | "version": "1.1.1",
315 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
316 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
317 | },
318 | "node_modules/encodeurl": {
319 | "version": "1.0.2",
320 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
321 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
322 | "engines": {
323 | "node": ">= 0.8"
324 | }
325 | },
326 | "node_modules/escape-html": {
327 | "version": "1.0.3",
328 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
329 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
330 | },
331 | "node_modules/etag": {
332 | "version": "1.8.1",
333 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
334 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
335 | "engines": {
336 | "node": ">= 0.6"
337 | }
338 | },
339 | "node_modules/eventsource-parser": {
340 | "version": "0.0.5",
341 | "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-0.0.5.tgz",
342 | "integrity": "sha512-BAq82bC3ZW9fPYYZlofXBOAfbpmDzXIOsj+GOehQwgTUYsQZ6HtHs6zuRtge7Ph8OhS6lNH1kJF8q9dj17RcmA==",
343 | "engines": {
344 | "node": ">=12"
345 | }
346 | },
347 | "node_modules/express": {
348 | "version": "4.18.2",
349 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
350 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
351 | "dependencies": {
352 | "accepts": "~1.3.8",
353 | "array-flatten": "1.1.1",
354 | "body-parser": "1.20.1",
355 | "content-disposition": "0.5.4",
356 | "content-type": "~1.0.4",
357 | "cookie": "0.5.0",
358 | "cookie-signature": "1.0.6",
359 | "debug": "2.6.9",
360 | "depd": "2.0.0",
361 | "encodeurl": "~1.0.2",
362 | "escape-html": "~1.0.3",
363 | "etag": "~1.8.1",
364 | "finalhandler": "1.2.0",
365 | "fresh": "0.5.2",
366 | "http-errors": "2.0.0",
367 | "merge-descriptors": "1.0.1",
368 | "methods": "~1.1.2",
369 | "on-finished": "2.4.1",
370 | "parseurl": "~1.3.3",
371 | "path-to-regexp": "0.1.7",
372 | "proxy-addr": "~2.0.7",
373 | "qs": "6.11.0",
374 | "range-parser": "~1.2.1",
375 | "safe-buffer": "5.2.1",
376 | "send": "0.18.0",
377 | "serve-static": "1.15.0",
378 | "setprototypeof": "1.2.0",
379 | "statuses": "2.0.1",
380 | "type-is": "~1.6.18",
381 | "utils-merge": "1.0.1",
382 | "vary": "~1.1.2"
383 | },
384 | "engines": {
385 | "node": ">= 0.10.0"
386 | }
387 | },
388 | "node_modules/fetch-blob": {
389 | "version": "3.2.0",
390 | "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
391 | "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
392 | "funding": [
393 | {
394 | "type": "github",
395 | "url": "https://github.com/sponsors/jimmywarting"
396 | },
397 | {
398 | "type": "paypal",
399 | "url": "https://paypal.me/jimmywarting"
400 | }
401 | ],
402 | "dependencies": {
403 | "node-domexception": "^1.0.0",
404 | "web-streams-polyfill": "^3.0.3"
405 | },
406 | "engines": {
407 | "node": "^12.20 || >= 14.13"
408 | }
409 | },
410 | "node_modules/finalhandler": {
411 | "version": "1.2.0",
412 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
413 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
414 | "dependencies": {
415 | "debug": "2.6.9",
416 | "encodeurl": "~1.0.2",
417 | "escape-html": "~1.0.3",
418 | "on-finished": "2.4.1",
419 | "parseurl": "~1.3.3",
420 | "statuses": "2.0.1",
421 | "unpipe": "~1.0.0"
422 | },
423 | "engines": {
424 | "node": ">= 0.8"
425 | }
426 | },
427 | "node_modules/formdata-polyfill": {
428 | "version": "4.0.10",
429 | "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
430 | "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
431 | "dependencies": {
432 | "fetch-blob": "^3.1.2"
433 | },
434 | "engines": {
435 | "node": ">=12.20.0"
436 | }
437 | },
438 | "node_modules/forwarded": {
439 | "version": "0.2.0",
440 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
441 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
442 | "engines": {
443 | "node": ">= 0.6"
444 | }
445 | },
446 | "node_modules/fresh": {
447 | "version": "0.5.2",
448 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
449 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
450 | "engines": {
451 | "node": ">= 0.6"
452 | }
453 | },
454 | "node_modules/function-bind": {
455 | "version": "1.1.1",
456 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
457 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
458 | },
459 | "node_modules/get-intrinsic": {
460 | "version": "1.2.0",
461 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
462 | "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
463 | "dependencies": {
464 | "function-bind": "^1.1.1",
465 | "has": "^1.0.3",
466 | "has-symbols": "^1.0.3"
467 | },
468 | "funding": {
469 | "url": "https://github.com/sponsors/ljharb"
470 | }
471 | },
472 | "node_modules/gpt-3-encoder": {
473 | "version": "1.1.4",
474 | "resolved": "https://registry.npmjs.org/gpt-3-encoder/-/gpt-3-encoder-1.1.4.tgz",
475 | "integrity": "sha512-fSQRePV+HUAhCn7+7HL7lNIXNm6eaFWFbNLOOGtmSJ0qJycyQvj60OvRlH7mee8xAMjBDNRdMXlMwjAbMTDjkg=="
476 | },
477 | "node_modules/has": {
478 | "version": "1.0.3",
479 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
480 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
481 | "dependencies": {
482 | "function-bind": "^1.1.1"
483 | },
484 | "engines": {
485 | "node": ">= 0.4.0"
486 | }
487 | },
488 | "node_modules/has-symbols": {
489 | "version": "1.0.3",
490 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
491 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
492 | "engines": {
493 | "node": ">= 0.4"
494 | },
495 | "funding": {
496 | "url": "https://github.com/sponsors/ljharb"
497 | }
498 | },
499 | "node_modules/http-errors": {
500 | "version": "2.0.0",
501 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
502 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
503 | "dependencies": {
504 | "depd": "2.0.0",
505 | "inherits": "2.0.4",
506 | "setprototypeof": "1.2.0",
507 | "statuses": "2.0.1",
508 | "toidentifier": "1.0.1"
509 | },
510 | "engines": {
511 | "node": ">= 0.8"
512 | }
513 | },
514 | "node_modules/iconv-lite": {
515 | "version": "0.4.24",
516 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
517 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
518 | "dependencies": {
519 | "safer-buffer": ">= 2.1.2 < 3"
520 | },
521 | "engines": {
522 | "node": ">=0.10.0"
523 | }
524 | },
525 | "node_modules/ieee754": {
526 | "version": "1.2.1",
527 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
528 | "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
529 | "funding": [
530 | {
531 | "type": "github",
532 | "url": "https://github.com/sponsors/feross"
533 | },
534 | {
535 | "type": "patreon",
536 | "url": "https://www.patreon.com/feross"
537 | },
538 | {
539 | "type": "consulting",
540 | "url": "https://feross.org/support"
541 | }
542 | ]
543 | },
544 | "node_modules/inherits": {
545 | "version": "2.0.4",
546 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
547 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
548 | },
549 | "node_modules/ipaddr.js": {
550 | "version": "1.9.1",
551 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
552 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
553 | "engines": {
554 | "node": ">= 0.10"
555 | }
556 | },
557 | "node_modules/is-interactive": {
558 | "version": "2.0.0",
559 | "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz",
560 | "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==",
561 | "engines": {
562 | "node": ">=12"
563 | },
564 | "funding": {
565 | "url": "https://github.com/sponsors/sindresorhus"
566 | }
567 | },
568 | "node_modules/is-unicode-supported": {
569 | "version": "1.3.0",
570 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz",
571 | "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==",
572 | "engines": {
573 | "node": ">=12"
574 | },
575 | "funding": {
576 | "url": "https://github.com/sponsors/sindresorhus"
577 | }
578 | },
579 | "node_modules/json-buffer": {
580 | "version": "3.0.1",
581 | "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
582 | "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="
583 | },
584 | "node_modules/keyv": {
585 | "version": "4.5.2",
586 | "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz",
587 | "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==",
588 | "dependencies": {
589 | "json-buffer": "3.0.1"
590 | }
591 | },
592 | "node_modules/log-symbols": {
593 | "version": "5.1.0",
594 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz",
595 | "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==",
596 | "dependencies": {
597 | "chalk": "^5.0.0",
598 | "is-unicode-supported": "^1.1.0"
599 | },
600 | "engines": {
601 | "node": ">=12"
602 | },
603 | "funding": {
604 | "url": "https://github.com/sponsors/sindresorhus"
605 | }
606 | },
607 | "node_modules/media-typer": {
608 | "version": "0.3.0",
609 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
610 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
611 | "engines": {
612 | "node": ">= 0.6"
613 | }
614 | },
615 | "node_modules/merge-descriptors": {
616 | "version": "1.0.1",
617 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
618 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
619 | },
620 | "node_modules/methods": {
621 | "version": "1.1.2",
622 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
623 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
624 | "engines": {
625 | "node": ">= 0.6"
626 | }
627 | },
628 | "node_modules/mime": {
629 | "version": "1.6.0",
630 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
631 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
632 | "bin": {
633 | "mime": "cli.js"
634 | },
635 | "engines": {
636 | "node": ">=4"
637 | }
638 | },
639 | "node_modules/mime-db": {
640 | "version": "1.52.0",
641 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
642 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
643 | "engines": {
644 | "node": ">= 0.6"
645 | }
646 | },
647 | "node_modules/mime-types": {
648 | "version": "2.1.35",
649 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
650 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
651 | "dependencies": {
652 | "mime-db": "1.52.0"
653 | },
654 | "engines": {
655 | "node": ">= 0.6"
656 | }
657 | },
658 | "node_modules/mimic-fn": {
659 | "version": "2.1.0",
660 | "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
661 | "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
662 | "engines": {
663 | "node": ">=6"
664 | }
665 | },
666 | "node_modules/ms": {
667 | "version": "2.0.0",
668 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
669 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
670 | },
671 | "node_modules/negotiator": {
672 | "version": "0.6.3",
673 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
674 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
675 | "engines": {
676 | "node": ">= 0.6"
677 | }
678 | },
679 | "node_modules/node-domexception": {
680 | "version": "1.0.0",
681 | "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
682 | "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
683 | "funding": [
684 | {
685 | "type": "github",
686 | "url": "https://github.com/sponsors/jimmywarting"
687 | },
688 | {
689 | "type": "github",
690 | "url": "https://paypal.me/jimmywarting"
691 | }
692 | ],
693 | "engines": {
694 | "node": ">=10.5.0"
695 | }
696 | },
697 | "node_modules/node-fetch": {
698 | "version": "3.3.0",
699 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.0.tgz",
700 | "integrity": "sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA==",
701 | "dependencies": {
702 | "data-uri-to-buffer": "^4.0.0",
703 | "fetch-blob": "^3.1.4",
704 | "formdata-polyfill": "^4.0.10"
705 | },
706 | "engines": {
707 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
708 | },
709 | "funding": {
710 | "type": "opencollective",
711 | "url": "https://opencollective.com/node-fetch"
712 | }
713 | },
714 | "node_modules/object-assign": {
715 | "version": "4.1.1",
716 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
717 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
718 | "engines": {
719 | "node": ">=0.10.0"
720 | }
721 | },
722 | "node_modules/object-inspect": {
723 | "version": "1.12.3",
724 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
725 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
726 | "funding": {
727 | "url": "https://github.com/sponsors/ljharb"
728 | }
729 | },
730 | "node_modules/on-finished": {
731 | "version": "2.4.1",
732 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
733 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
734 | "dependencies": {
735 | "ee-first": "1.1.1"
736 | },
737 | "engines": {
738 | "node": ">= 0.8"
739 | }
740 | },
741 | "node_modules/onetime": {
742 | "version": "5.1.2",
743 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
744 | "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
745 | "dependencies": {
746 | "mimic-fn": "^2.1.0"
747 | },
748 | "engines": {
749 | "node": ">=6"
750 | },
751 | "funding": {
752 | "url": "https://github.com/sponsors/sindresorhus"
753 | }
754 | },
755 | "node_modules/ora": {
756 | "version": "6.1.2",
757 | "resolved": "https://registry.npmjs.org/ora/-/ora-6.1.2.tgz",
758 | "integrity": "sha512-EJQ3NiP5Xo94wJXIzAyOtSb0QEIAUu7m8t6UZ9krbz0vAJqr92JpcK/lEXg91q6B9pEGqrykkd2EQplnifDSBw==",
759 | "dependencies": {
760 | "bl": "^5.0.0",
761 | "chalk": "^5.0.0",
762 | "cli-cursor": "^4.0.0",
763 | "cli-spinners": "^2.6.1",
764 | "is-interactive": "^2.0.0",
765 | "is-unicode-supported": "^1.1.0",
766 | "log-symbols": "^5.1.0",
767 | "strip-ansi": "^7.0.1",
768 | "wcwidth": "^1.0.1"
769 | },
770 | "engines": {
771 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
772 | },
773 | "funding": {
774 | "url": "https://github.com/sponsors/sindresorhus"
775 | }
776 | },
777 | "node_modules/p-timeout": {
778 | "version": "6.1.0",
779 | "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.0.tgz",
780 | "integrity": "sha512-s0y6Le9QYGELLzNpFIt6h8B2DHTVUDLStvxtvRMSKNKeuNVVWby2dZ+pIJpW4/pWr5a3s8W85wBNtc0ZA+lzCg==",
781 | "engines": {
782 | "node": ">=14.16"
783 | },
784 | "funding": {
785 | "url": "https://github.com/sponsors/sindresorhus"
786 | }
787 | },
788 | "node_modules/parseurl": {
789 | "version": "1.3.3",
790 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
791 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
792 | "engines": {
793 | "node": ">= 0.8"
794 | }
795 | },
796 | "node_modules/path-to-regexp": {
797 | "version": "0.1.7",
798 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
799 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
800 | },
801 | "node_modules/proxy-addr": {
802 | "version": "2.0.7",
803 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
804 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
805 | "dependencies": {
806 | "forwarded": "0.2.0",
807 | "ipaddr.js": "1.9.1"
808 | },
809 | "engines": {
810 | "node": ">= 0.10"
811 | }
812 | },
813 | "node_modules/qs": {
814 | "version": "6.11.0",
815 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
816 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
817 | "dependencies": {
818 | "side-channel": "^1.0.4"
819 | },
820 | "engines": {
821 | "node": ">=0.6"
822 | },
823 | "funding": {
824 | "url": "https://github.com/sponsors/ljharb"
825 | }
826 | },
827 | "node_modules/quick-lru": {
828 | "version": "6.1.1",
829 | "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.1.tgz",
830 | "integrity": "sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q==",
831 | "engines": {
832 | "node": ">=12"
833 | },
834 | "funding": {
835 | "url": "https://github.com/sponsors/sindresorhus"
836 | }
837 | },
838 | "node_modules/range-parser": {
839 | "version": "1.2.1",
840 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
841 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
842 | "engines": {
843 | "node": ">= 0.6"
844 | }
845 | },
846 | "node_modules/raw-body": {
847 | "version": "2.5.1",
848 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
849 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
850 | "dependencies": {
851 | "bytes": "3.1.2",
852 | "http-errors": "2.0.0",
853 | "iconv-lite": "0.4.24",
854 | "unpipe": "1.0.0"
855 | },
856 | "engines": {
857 | "node": ">= 0.8"
858 | }
859 | },
860 | "node_modules/readable-stream": {
861 | "version": "3.6.0",
862 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
863 | "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
864 | "dependencies": {
865 | "inherits": "^2.0.3",
866 | "string_decoder": "^1.1.1",
867 | "util-deprecate": "^1.0.1"
868 | },
869 | "engines": {
870 | "node": ">= 6"
871 | }
872 | },
873 | "node_modules/restore-cursor": {
874 | "version": "4.0.0",
875 | "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz",
876 | "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==",
877 | "dependencies": {
878 | "onetime": "^5.1.0",
879 | "signal-exit": "^3.0.2"
880 | },
881 | "engines": {
882 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
883 | },
884 | "funding": {
885 | "url": "https://github.com/sponsors/sindresorhus"
886 | }
887 | },
888 | "node_modules/safe-buffer": {
889 | "version": "5.2.1",
890 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
891 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
892 | "funding": [
893 | {
894 | "type": "github",
895 | "url": "https://github.com/sponsors/feross"
896 | },
897 | {
898 | "type": "patreon",
899 | "url": "https://www.patreon.com/feross"
900 | },
901 | {
902 | "type": "consulting",
903 | "url": "https://feross.org/support"
904 | }
905 | ]
906 | },
907 | "node_modules/safer-buffer": {
908 | "version": "2.1.2",
909 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
910 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
911 | },
912 | "node_modules/send": {
913 | "version": "0.18.0",
914 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
915 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
916 | "dependencies": {
917 | "debug": "2.6.9",
918 | "depd": "2.0.0",
919 | "destroy": "1.2.0",
920 | "encodeurl": "~1.0.2",
921 | "escape-html": "~1.0.3",
922 | "etag": "~1.8.1",
923 | "fresh": "0.5.2",
924 | "http-errors": "2.0.0",
925 | "mime": "1.6.0",
926 | "ms": "2.1.3",
927 | "on-finished": "2.4.1",
928 | "range-parser": "~1.2.1",
929 | "statuses": "2.0.1"
930 | },
931 | "engines": {
932 | "node": ">= 0.8.0"
933 | }
934 | },
935 | "node_modules/send/node_modules/ms": {
936 | "version": "2.1.3",
937 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
938 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
939 | },
940 | "node_modules/serve-static": {
941 | "version": "1.15.0",
942 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
943 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
944 | "dependencies": {
945 | "encodeurl": "~1.0.2",
946 | "escape-html": "~1.0.3",
947 | "parseurl": "~1.3.3",
948 | "send": "0.18.0"
949 | },
950 | "engines": {
951 | "node": ">= 0.8.0"
952 | }
953 | },
954 | "node_modules/setprototypeof": {
955 | "version": "1.2.0",
956 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
957 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
958 | },
959 | "node_modules/side-channel": {
960 | "version": "1.0.4",
961 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
962 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
963 | "dependencies": {
964 | "call-bind": "^1.0.0",
965 | "get-intrinsic": "^1.0.2",
966 | "object-inspect": "^1.9.0"
967 | },
968 | "funding": {
969 | "url": "https://github.com/sponsors/ljharb"
970 | }
971 | },
972 | "node_modules/signal-exit": {
973 | "version": "3.0.7",
974 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
975 | "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
976 | },
977 | "node_modules/statuses": {
978 | "version": "2.0.1",
979 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
980 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
981 | "engines": {
982 | "node": ">= 0.8"
983 | }
984 | },
985 | "node_modules/string_decoder": {
986 | "version": "1.3.0",
987 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
988 | "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
989 | "dependencies": {
990 | "safe-buffer": "~5.2.0"
991 | }
992 | },
993 | "node_modules/strip-ansi": {
994 | "version": "7.0.1",
995 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz",
996 | "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==",
997 | "dependencies": {
998 | "ansi-regex": "^6.0.1"
999 | },
1000 | "engines": {
1001 | "node": ">=12"
1002 | },
1003 | "funding": {
1004 | "url": "https://github.com/chalk/strip-ansi?sponsor=1"
1005 | }
1006 | },
1007 | "node_modules/toidentifier": {
1008 | "version": "1.0.1",
1009 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
1010 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
1011 | "engines": {
1012 | "node": ">=0.6"
1013 | }
1014 | },
1015 | "node_modules/type-is": {
1016 | "version": "1.6.18",
1017 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
1018 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
1019 | "dependencies": {
1020 | "media-typer": "0.3.0",
1021 | "mime-types": "~2.1.24"
1022 | },
1023 | "engines": {
1024 | "node": ">= 0.6"
1025 | }
1026 | },
1027 | "node_modules/unpipe": {
1028 | "version": "1.0.0",
1029 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
1030 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
1031 | "engines": {
1032 | "node": ">= 0.8"
1033 | }
1034 | },
1035 | "node_modules/util-deprecate": {
1036 | "version": "1.0.2",
1037 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
1038 | "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
1039 | },
1040 | "node_modules/utils-merge": {
1041 | "version": "1.0.1",
1042 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
1043 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
1044 | "engines": {
1045 | "node": ">= 0.4.0"
1046 | }
1047 | },
1048 | "node_modules/uuid": {
1049 | "version": "9.0.0",
1050 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
1051 | "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
1052 | "bin": {
1053 | "uuid": "dist/bin/uuid"
1054 | }
1055 | },
1056 | "node_modules/vary": {
1057 | "version": "1.1.2",
1058 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1059 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
1060 | "engines": {
1061 | "node": ">= 0.8"
1062 | }
1063 | },
1064 | "node_modules/wcwidth": {
1065 | "version": "1.0.1",
1066 | "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
1067 | "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==",
1068 | "dependencies": {
1069 | "defaults": "^1.0.3"
1070 | }
1071 | },
1072 | "node_modules/web-streams-polyfill": {
1073 | "version": "3.2.1",
1074 | "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
1075 | "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
1076 | "engines": {
1077 | "node": ">= 8"
1078 | }
1079 | }
1080 | }
1081 | }
1082 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "start": "node server.js "
4 | },
5 | "dependencies": {
6 | "body-parser": "^1.20.1",
7 | "chatgpt": "^4.0.0",
8 | "cors": "^2.8.5",
9 | "dotenv": "^16.0.3",
10 | "dotenv-safe": "^8.2.0",
11 | "express": "^4.18.2",
12 | "node-fetch": "^3.3.0",
13 | "ora": "^6.1.2"
14 | },
15 | "type": "module"
16 | }
17 |
--------------------------------------------------------------------------------
/plugins/Default.js:
--------------------------------------------------------------------------------
1 | export default {
2 | rules: [
3 | `If I say create something I mean do some creative writing about it, not browse the internet.`,
4 | ],
5 | };
6 |
--------------------------------------------------------------------------------
/plugins/Gangster.js:
--------------------------------------------------------------------------------
1 | export default {
2 | rules: [`All your responses should sound like a 1940s gangster`],
3 | };
4 |
--------------------------------------------------------------------------------
/plugins/Image.js:
--------------------------------------------------------------------------------
1 | import fetch from "node-fetch";
2 |
3 | export default {
4 | rules: [
5 | `You are an AI that's good at describing images.`,
6 | `First check if my message includes the word "image", "photo", "picture", or "drawing"`,
7 | `If it does include one of those words then at the very end of your reply you should include an image description enclosed in double curly brackets.`,
8 | `If it does not include one of those words then don't add an image description.`,
9 | ],
10 | parse: async (reply) => {
11 | // Match anything between {{ }}
12 | const regex = /\{\{([^\]]+?)\}\}/g;
13 | const matches = reply.match(regex);
14 | if (matches?.length) {
15 | for (const match of matches) {
16 | // Get image description between curly brackets
17 | const imageDescription = match.replace(regex, "$1").trim();
18 | // Search for image on Lexica
19 | const image = await fetch(
20 | `https://lexica.art/api/v1/search?q=${encodeURIComponent(
21 | imageDescription
22 | )}`,
23 | {
24 | method: "GET",
25 | }
26 | )
27 | .then((response) => response.json())
28 | .then((response) => {
29 | if (response?.images) {
30 | return `https://image.lexica.art/md/${response?.images[0]?.id}`;
31 | }
32 | })
33 | .catch((error) => {
34 | // Ignore error
35 | });
36 |
37 | // Replace description with image URL
38 | reply = image
39 | ? reply.replace(`\{\{${imageDescription}\}\}`, image)
40 | : reply;
41 | }
42 | }
43 | return reply;
44 | },
45 | };
46 |
--------------------------------------------------------------------------------
/server.js:
--------------------------------------------------------------------------------
1 | import dotenv from "dotenv-safe";
2 | dotenv.config();
3 | import express from "express";
4 | import bodyParser from "body-parser";
5 | import cors from "cors";
6 | import { ChatGPTAPI } from "chatgpt";
7 | import { oraPromise } from "ora";
8 | import config from "./config.js";
9 |
10 | const app = express().use(cors()).use(bodyParser.json());
11 |
12 | const gptApi = new ChatGPTAPI({
13 | apiKey: process.env.OPENAI_API_KEY
14 | });
15 |
16 | const Config = configure(config);
17 |
18 | class Conversation {
19 | conversationID = null;
20 | parentMessageID = null;
21 |
22 | constructor() {}
23 |
24 | async sendMessage(msg) {
25 | const res = await gptApi.sendMessage(
26 | msg,
27 | this.conversationID && this.parentMessageID
28 | ? {
29 | conversationId: this.conversationID,
30 | parentMessageId: this.parentMessageID,
31 | }
32 | : {}
33 | );
34 |
35 | if (res.conversationId) {
36 | this.conversationID = res.conversationId;
37 | }
38 | if (res.parentMessageId) {
39 | this.parentMessageID = res.parentMessageId;
40 | }
41 |
42 | if (res.response) {
43 | return res.response;
44 | }
45 | return res;
46 | }
47 | }
48 |
49 | const conversation = new Conversation();
50 |
51 | app.post("/", async (req, res) => {
52 | try {
53 | const rawReply = await oraPromise(
54 | conversation.sendMessage(req.body.message),
55 | {
56 | text: req.body.message,
57 | }
58 | );
59 | const reply = await Config.parse(rawReply.text);
60 | console.log(`----------\n${reply}\n----------`);
61 | res.json({ reply });
62 | } catch (error) {
63 | console.log(error);
64 | res.status(500);
65 | }
66 | });
67 |
68 | async function start() {
69 | await oraPromise(Config.train(), {
70 | text: `Training ChatGPT (${Config.rules.length} plugin rules)`,
71 | });
72 | await oraPromise(
73 | new Promise((resolve) => app.listen(3000, () => resolve())),
74 | {
75 | text: `You may now use the extension`,
76 | }
77 | );
78 | }
79 |
80 | function configure({ plugins, ...opts }) {
81 | let rules = [];
82 | let parsers = [];
83 |
84 | // Collect rules and parsers from all plugins
85 | for (const plugin of plugins) {
86 | if (plugin.rules) {
87 | rules = rules.concat(plugin.rules);
88 | }
89 | if (plugin.parse) {
90 | parsers.push(plugin.parse);
91 | }
92 | }
93 |
94 | // Send ChatGPT a training message that includes all plugin rules
95 | const train = () => {
96 | if (!rules.length) return;
97 |
98 | const message = `
99 | Please follow these rules when replying to me:
100 | ${rules.map((rule) => `\n- ${rule}`)}
101 | `;
102 | return conversation.sendMessage(message);
103 | };
104 |
105 | // Run the ChatGPT response through all plugin parsers
106 | const parse = async (reply) => {
107 | for (const parser of parsers) {
108 | reply = await parser(reply);
109 | }
110 | return reply;
111 | };
112 | return { train, parse, rules, ...opts };
113 | }
114 |
115 | start();
116 |
--------------------------------------------------------------------------------