From 688875990825d2731929f960471246ac6e704e2a Mon Sep 17 00:00:00 2001 From: Yaron Galperin Date: Sat, 21 Jan 2023 23:07:12 +0200 Subject: [PATCH 01/15] chore: add an app image to README file --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 63bd2928a..dd302a084 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # OpenAI API Quickstart - Node.js example app +![image](https://user-images.githubusercontent.com/10623307/213887080-b2bc4645-7fdb-4dbd-ae42-efce00d0dc29.png) + This is an example pet name generator app used in the OpenAI API [quickstart tutorial](https://beta.openai.com/docs/quickstart). It uses the [Next.js](https://nextjs.org/) framework with [React](https://reactjs.org/). Check out the tutorial or follow the instructions below to get set up. ## Setup From 8a5a4fc322e02b45703ee2fa7c59e2f0b2efabaa Mon Sep 17 00:00:00 2001 From: Path Ree Date: Sat, 11 Feb 2023 19:24:00 +0800 Subject: [PATCH 02/15] ignore vscode project file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 37b0ce990..8b02c1720 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ # misc .DS_Store +.code-workspace # debug npm-debug.log* From b4da78d3ddc0ab87ff594157a2bffd81a7e1fc7b Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Wed, 15 Feb 2023 18:17:23 -0600 Subject: [PATCH 03/15] Update readme to add image alt text --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5e25d961..6fef8d7cb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # OpenAI API Quickstart - Node.js example app -![image](https://user-images.githubusercontent.com/10623307/213887080-b2bc4645-7fdb-4dbd-ae42-efce00d0dc29.png) - This is an example pet name generator app used in the OpenAI API [quickstart tutorial](https://beta.openai.com/docs/quickstart). It uses the [Next.js](https://nextjs.org/) framework with [React](https://reactjs.org/). Check out the tutorial or follow the instructions below to get set up. +![Text box that says name my pet with an icon of a dog](https://user-images.githubusercontent.com/10623307/213887080-b2bc4645-7fdb-4dbd-ae42-efce00d0dc29.png) + + ## Setup 1. If you don’t have Node.js installed, [install it from here](https://nodejs.org/en/) (Node.js version >= 14.6.0 required) From 823190e3f2cceeb3c6d7563b3768eacf91e541e4 Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Thu, 2 Mar 2023 08:58:38 -0600 Subject: [PATCH 04/15] Update .env.example --- .env.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 9847a1df1..3ae9a559a 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -OPENAI_API_KEY= \ No newline at end of file +# Do not share your OpenAI API key with anyone! It should remain a secret. +OPENAI_API_KEY= From 43d9a3c750b7458f09ba48414f55923e1ef6701b Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Thu, 2 Mar 2023 09:00:22 -0600 Subject: [PATCH 05/15] Update ReadMe to fix the docs URL's --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6fef8d7cb..f9f2dcfce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenAI API Quickstart - Node.js example app -This is an example pet name generator app used in the OpenAI API [quickstart tutorial](https://beta.openai.com/docs/quickstart). It uses the [Next.js](https://nextjs.org/) framework with [React](https://reactjs.org/). Check out the tutorial or follow the instructions below to get set up. +This is an example pet name generator app used in the OpenAI API [quickstart tutorial](https://platform.openai.com/docs/quickstart). It uses the [Next.js](https://nextjs.org/) framework with [React](https://reactjs.org/). Check out the tutorial or follow the instructions below to get set up. ![Text box that says name my pet with an icon of a dog](https://user-images.githubusercontent.com/10623307/213887080-b2bc4645-7fdb-4dbd-ae42-efce00d0dc29.png) @@ -33,7 +33,7 @@ This is an example pet name generator app used in the OpenAI API [quickstart tut ```powershell $ copy .env.example .env ``` -6. Add your [API key](https://beta.openai.com/account/api-keys) to the newly created `.env` file +6. Add your [API key](https://platform.openai.com/account/api-keys) to the newly created `.env` file 7. Run the app @@ -41,4 +41,4 @@ This is an example pet name generator app used in the OpenAI API [quickstart tut $ npm run dev ``` -You should now be able to access the app at [http://localhost:3000](http://localhost:3000)! For the full context behind this example app, check out the [tutorial](https://beta.openai.com/docs/quickstart). +You should now be able to access the app at [http://localhost:3000](http://localhost:3000)! For the full context behind this example app, check out the [tutorial](https://platform.openai.com/docs/quickstart). From f2d3bceb63d5e03473085123e81b9c92a03a5390 Mon Sep 17 00:00:00 2001 From: Hirofumi Shibata <33661448+shiba-hiro@users.noreply.github.com> Date: Sun, 2 Apr 2023 16:50:12 +0900 Subject: [PATCH 06/15] chore(package.json): specify Node.js version to 18+ --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c8b127cf2..071a4bd49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "react-dom": "^18.2.0" }, "engines": { - "node": ">=14.6.0" + "node": ">=18" } }, "node_modules/@next/env": { diff --git a/package.json b/package.json index a17bab195..a9caf4d48 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,6 @@ "react-dom": "^18.2.0" }, "engines": { - "node": ">=14.6.0" + "node": ">=18" } } From e259df926a29d2b064ebb5a5e657edd0dfa0fcb2 Mon Sep 17 00:00:00 2001 From: David Schnurr Date: Mon, 3 Jul 2023 08:22:11 -0700 Subject: [PATCH 07/15] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9caf4d48..b31454d01 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,6 @@ "react-dom": "^18.2.0" }, "engines": { - "node": ">=18" + "node": ">=16" } } From f85ddf6acfbca4398db26f1c48f00849c75ebb96 Mon Sep 17 00:00:00 2001 From: David Schnurr Date: Mon, 3 Jul 2023 08:22:17 -0700 Subject: [PATCH 08/15] Update package-lock.json --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 071a4bd49..972ea744c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "react-dom": "^18.2.0" }, "engines": { - "node": ">=18" + "node": ">=16" } }, "node_modules/@next/env": { From 9e4ac124d37728e1345b301730d6a1f0d2bb7f09 Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Tue, 6 Feb 2024 17:57:45 -0600 Subject: [PATCH 09/15] WIP Stash, need to fix streaming and the UI --- package-lock.json | 844 ++++++++++++++++++++++++++++------------- package.json | 5 +- pages/api/generate.js | 124 +++--- pages/index.js | 130 +++++-- pages/index.module.css | 7 +- public/dog.png | Bin 1746 -> 0 bytes 6 files changed, 756 insertions(+), 354 deletions(-) delete mode 100644 public/dog.png diff --git a/package-lock.json b/package-lock.json index 972ea744c..b92fcc8ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,53 +9,24 @@ "version": "0.1.0", "dependencies": { "next": "^13.1.1", - "openai": "^3.1.0", + "openai": "^4.26.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, "engines": { - "node": ">=16" + "node": ">=16", + "npm": ">=7" } }, "node_modules/@next/env": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.1.1.tgz", - "integrity": "sha512-vFMyXtPjSAiOXOywMojxfKIqE3VWN5RCAx+tT3AS3pcKjMLFTCJFUWsKv8hC+87Z1F4W3r68qTwDFZIFmd5Xkw==" - }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.1.1.tgz", - "integrity": "sha512-qnFCx1kT3JTWhWve4VkeWuZiyjG0b5T6J2iWuin74lORCupdrNukxkq9Pm+Z7PsatxuwVJMhjUoYz7H4cWzx2A==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.1.1.tgz", - "integrity": "sha512-eCiZhTzjySubNqUnNkQCjU3Fh+ep3C6b5DCM5FKzsTH/3Gr/4Y7EiaPZKILbvnXmhWtKPIdcY6Zjx51t4VeTfA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.19.tgz", + "integrity": "sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.1.1.tgz", - "integrity": "sha512-9zRJSSIwER5tu9ADDkPw5rIZ+Np44HTXpYMr0rkM656IvssowPxmhK0rTreC1gpUCYwFsRbxarUJnJsTWiutPg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.19.tgz", + "integrity": "sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==", "cpu": [ "arm64" ], @@ -68,9 +39,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.1.1.tgz", - "integrity": "sha512-qWr9qEn5nrnlhB0rtjSdR00RRZEtxg4EGvicIipqZWEyayPxhUu6NwKiG8wZiYZCLfJ5KWr66PGSNeDMGlNaiA==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.19.tgz", + "integrity": "sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==", "cpu": [ "x64" ], @@ -82,40 +53,10 @@ "node": ">= 10" } }, - "node_modules/@next/swc-freebsd-x64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.1.1.tgz", - "integrity": "sha512-UwP4w/NcQ7V/VJEj3tGVszgb4pyUCt3lzJfUhjDMUmQbzG9LDvgiZgAGMYH6L21MoyAATJQPDGiAMWAPKsmumA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.1.1.tgz", - "integrity": "sha512-CnsxmKHco9sosBs1XcvCXP845Db+Wx1G0qouV5+Gr+HT/ZlDYEWKoHVDgnJXLVEQzq4FmHddBNGbXvgqM1Gfkg==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.1.1.tgz", - "integrity": "sha512-JfDq1eri5Dif+VDpTkONRd083780nsMCOKoFG87wA0sa4xL8LGcXIBAkUGIC1uVy9SMsr2scA9CySLD/i+Oqiw==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.19.tgz", + "integrity": "sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==", "cpu": [ "arm64" ], @@ -128,9 +69,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.1.1.tgz", - "integrity": "sha512-GA67ZbDq2AW0CY07zzGt07M5b5Yaq5qUpFIoW3UFfjOPgb0Sqf3DAW7GtFMK1sF4ROHsRDMGQ9rnT0VM2dVfKA==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.19.tgz", + "integrity": "sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==", "cpu": [ "arm64" ], @@ -143,9 +84,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.1.1.tgz", - "integrity": "sha512-nnjuBrbzvqaOJaV+XgT8/+lmXrSCOt1YYZn/irbDb2fR2QprL6Q7WJNgwsZNxiLSfLdv+2RJGGegBx9sLBEzGA==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.19.tgz", + "integrity": "sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==", "cpu": [ "x64" ], @@ -158,9 +99,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.1.1.tgz", - "integrity": "sha512-CM9xnAQNIZ8zf/igbIT/i3xWbQZYaF397H+JroF5VMOCUleElaMdQLL5riJml8wUfPoN3dtfn2s4peSr3azz/g==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.19.tgz", + "integrity": "sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==", "cpu": [ "x64" ], @@ -173,9 +114,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.1.1.tgz", - "integrity": "sha512-pzUHOGrbgfGgPlOMx9xk3QdPJoRPU+om84hqVoe6u+E0RdwOG0Ho/2UxCgDqmvpUrMab1Deltlt6RqcXFpnigQ==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.19.tgz", + "integrity": "sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==", "cpu": [ "arm64" ], @@ -188,9 +129,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.1.1.tgz", - "integrity": "sha512-WeX8kVS46aobM9a7Xr/kEPcrTyiwJqQv/tbw6nhJ4fH9xNZ+cEcyPoQkwPo570dCOLz3Zo9S2q0E6lJ/EAUOBg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.19.tgz", + "integrity": "sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==", "cpu": [ "ia32" ], @@ -203,9 +144,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.1.1.tgz", - "integrity": "sha512-mVF0/3/5QAc5EGVnb8ll31nNvf3BWpPY4pBb84tk+BfQglWLqc5AC9q1Ht/YMWiEgs8ALNKEQ3GQnbY0bJF2Gg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.19.tgz", + "integrity": "sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==", "cpu": [ "x64" ], @@ -218,30 +159,77 @@ } }, "node_modules/@swc/helpers": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", - "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", + "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", "dependencies": { "tslib": "^2.4.0" } }, + "node_modules/@types/node": { + "version": "18.19.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.14.tgz", + "integrity": "sha512-EnQ4Us2rmOS64nHDWr0XqAD8DsO6f3XR6lf9UIIrZQpUzPVdN/oPuEzfDWNHSyXLvoGgjuEm/sPwFGSSs35Wtg==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "dependencies": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "node_modules/base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "dependencies": { - "follow-redirects": "^1.14.8" + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" } }, "node_modules/caniuse-lite": { - "version": "1.0.30001441", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz", - "integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==", + "version": "1.0.30001584", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", + "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==", "funding": [ { "type": "opencollective", @@ -250,9 +238,21 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ] }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "engines": { + "node": "*" + } + }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", @@ -269,6 +269,14 @@ "node": ">= 0.8" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "engines": { + "node": "*" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -277,23 +285,21 @@ "node": ">=0.4.0" } }, - "node_modules/follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], + "node_modules/digest-fetch": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", + "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", + "dependencies": { + "base-64": "^0.1.0", + "md5": "^2.3.0" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } + "node": ">=6" } }, "node_modules/form-data": { @@ -309,6 +315,54 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" + }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/formdata-node/node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "engines": { + "node": ">= 14" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -325,6 +379,16 @@ "loose-envify": "cli.js" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -344,10 +408,21 @@ "node": ">= 0.6" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "node_modules/nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -356,63 +431,105 @@ } }, "node_modules/next": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/next/-/next-13.1.1.tgz", - "integrity": "sha512-R5eBAaIa3X7LJeYvv1bMdGnAVF4fVToEjim7MkflceFPuANY3YyvFxXee/A+acrSYwYPvOvf7f6v/BM/48ea5w==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/next/-/next-13.4.19.tgz", + "integrity": "sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==", "dependencies": { - "@next/env": "13.1.1", - "@swc/helpers": "0.4.14", + "@next/env": "13.4.19", + "@swc/helpers": "0.5.1", + "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", - "styled-jsx": "5.1.1" + "styled-jsx": "5.1.1", + "watchpack": "2.4.0", + "zod": "3.21.4" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": ">=14.6.0" + "node": ">=16.8.0" }, "optionalDependencies": { - "@next/swc-android-arm-eabi": "13.1.1", - "@next/swc-android-arm64": "13.1.1", - "@next/swc-darwin-arm64": "13.1.1", - "@next/swc-darwin-x64": "13.1.1", - "@next/swc-freebsd-x64": "13.1.1", - "@next/swc-linux-arm-gnueabihf": "13.1.1", - "@next/swc-linux-arm64-gnu": "13.1.1", - "@next/swc-linux-arm64-musl": "13.1.1", - "@next/swc-linux-x64-gnu": "13.1.1", - "@next/swc-linux-x64-musl": "13.1.1", - "@next/swc-win32-arm64-msvc": "13.1.1", - "@next/swc-win32-ia32-msvc": "13.1.1", - "@next/swc-win32-x64-msvc": "13.1.1" + "@next/swc-darwin-arm64": "13.4.19", + "@next/swc-darwin-x64": "13.4.19", + "@next/swc-linux-arm64-gnu": "13.4.19", + "@next/swc-linux-arm64-musl": "13.4.19", + "@next/swc-linux-x64-gnu": "13.4.19", + "@next/swc-linux-x64-musl": "13.4.19", + "@next/swc-win32-arm64-msvc": "13.4.19", + "@next/swc-win32-ia32-msvc": "13.4.19", + "@next/swc-win32-x64-msvc": "13.4.19" }, "peerDependencies": { - "fibers": ">= 3.1.0", - "node-sass": "^6.0.0 || ^7.0.0", + "@opentelemetry/api": "^1.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.3.0" }, "peerDependenciesMeta": { - "fibers": { + "@opentelemetry/api": { "optional": true }, - "node-sass": { + "sass": { "optional": true + } + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" }, - "sass": { + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { "optional": true } } }, "node_modules/openai": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/openai/-/openai-3.1.0.tgz", - "integrity": "sha512-v5kKFH5o+8ld+t0arudj833Mgm3GcgBnbyN9946bj6u7bvel4Yg6YFz2A4HLIYDzmMjIo0s6vSG9x73kOwvdCg==", + "version": "4.26.1", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.26.1.tgz", + "integrity": "sha512-DvWbjhWbappsFRatOWmu4Dp1/Q4RG9oOz6CfOSjy0/Drb8G+5iAiqWAO4PfpGIkhOOKtvvNfQri2SItl+U7LhQ==", "dependencies": { - "axios": "^0.26.0", - "form-data": "^4.0.0" + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" + }, + "bin": { + "openai": "bin/cli" } }, "node_modules/picocolors": { @@ -482,6 +599,14 @@ "node": ">=0.10.0" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/styled-jsx": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", @@ -504,121 +629,192 @@ } } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", + "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/zod": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", + "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } }, "dependencies": { "@next/env": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.1.1.tgz", - "integrity": "sha512-vFMyXtPjSAiOXOywMojxfKIqE3VWN5RCAx+tT3AS3pcKjMLFTCJFUWsKv8hC+87Z1F4W3r68qTwDFZIFmd5Xkw==" - }, - "@next/swc-android-arm-eabi": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.1.1.tgz", - "integrity": "sha512-qnFCx1kT3JTWhWve4VkeWuZiyjG0b5T6J2iWuin74lORCupdrNukxkq9Pm+Z7PsatxuwVJMhjUoYz7H4cWzx2A==", - "optional": true - }, - "@next/swc-android-arm64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.1.1.tgz", - "integrity": "sha512-eCiZhTzjySubNqUnNkQCjU3Fh+ep3C6b5DCM5FKzsTH/3Gr/4Y7EiaPZKILbvnXmhWtKPIdcY6Zjx51t4VeTfA==", - "optional": true + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.19.tgz", + "integrity": "sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==" }, "@next/swc-darwin-arm64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.1.1.tgz", - "integrity": "sha512-9zRJSSIwER5tu9ADDkPw5rIZ+Np44HTXpYMr0rkM656IvssowPxmhK0rTreC1gpUCYwFsRbxarUJnJsTWiutPg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.19.tgz", + "integrity": "sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==", "optional": true }, "@next/swc-darwin-x64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.1.1.tgz", - "integrity": "sha512-qWr9qEn5nrnlhB0rtjSdR00RRZEtxg4EGvicIipqZWEyayPxhUu6NwKiG8wZiYZCLfJ5KWr66PGSNeDMGlNaiA==", - "optional": true - }, - "@next/swc-freebsd-x64": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.1.1.tgz", - "integrity": "sha512-UwP4w/NcQ7V/VJEj3tGVszgb4pyUCt3lzJfUhjDMUmQbzG9LDvgiZgAGMYH6L21MoyAATJQPDGiAMWAPKsmumA==", - "optional": true - }, - "@next/swc-linux-arm-gnueabihf": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.1.1.tgz", - "integrity": "sha512-CnsxmKHco9sosBs1XcvCXP845Db+Wx1G0qouV5+Gr+HT/ZlDYEWKoHVDgnJXLVEQzq4FmHddBNGbXvgqM1Gfkg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.19.tgz", + "integrity": "sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==", "optional": true }, "@next/swc-linux-arm64-gnu": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.1.1.tgz", - "integrity": "sha512-JfDq1eri5Dif+VDpTkONRd083780nsMCOKoFG87wA0sa4xL8LGcXIBAkUGIC1uVy9SMsr2scA9CySLD/i+Oqiw==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.19.tgz", + "integrity": "sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==", "optional": true }, "@next/swc-linux-arm64-musl": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.1.1.tgz", - "integrity": "sha512-GA67ZbDq2AW0CY07zzGt07M5b5Yaq5qUpFIoW3UFfjOPgb0Sqf3DAW7GtFMK1sF4ROHsRDMGQ9rnT0VM2dVfKA==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.19.tgz", + "integrity": "sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.1.1.tgz", - "integrity": "sha512-nnjuBrbzvqaOJaV+XgT8/+lmXrSCOt1YYZn/irbDb2fR2QprL6Q7WJNgwsZNxiLSfLdv+2RJGGegBx9sLBEzGA==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.19.tgz", + "integrity": "sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==", "optional": true }, "@next/swc-linux-x64-musl": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.1.1.tgz", - "integrity": "sha512-CM9xnAQNIZ8zf/igbIT/i3xWbQZYaF397H+JroF5VMOCUleElaMdQLL5riJml8wUfPoN3dtfn2s4peSr3azz/g==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.19.tgz", + "integrity": "sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==", "optional": true }, "@next/swc-win32-arm64-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.1.1.tgz", - "integrity": "sha512-pzUHOGrbgfGgPlOMx9xk3QdPJoRPU+om84hqVoe6u+E0RdwOG0Ho/2UxCgDqmvpUrMab1Deltlt6RqcXFpnigQ==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.19.tgz", + "integrity": "sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==", "optional": true }, "@next/swc-win32-ia32-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.1.1.tgz", - "integrity": "sha512-WeX8kVS46aobM9a7Xr/kEPcrTyiwJqQv/tbw6nhJ4fH9xNZ+cEcyPoQkwPo570dCOLz3Zo9S2q0E6lJ/EAUOBg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.19.tgz", + "integrity": "sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.1.1.tgz", - "integrity": "sha512-mVF0/3/5QAc5EGVnb8ll31nNvf3BWpPY4pBb84tk+BfQglWLqc5AC9q1Ht/YMWiEgs8ALNKEQ3GQnbY0bJF2Gg==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.19.tgz", + "integrity": "sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==", "optional": true }, "@swc/helpers": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz", - "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", + "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", "requires": { "tslib": "^2.4.0" } }, + "@types/node": { + "version": "18.19.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.14.tgz", + "integrity": "sha512-EnQ4Us2rmOS64nHDWr0XqAD8DsO6f3XR6lf9UIIrZQpUzPVdN/oPuEzfDWNHSyXLvoGgjuEm/sPwFGSSs35Wtg==", + "requires": { + "undici-types": "~5.26.4" + } + }, + "@types/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "requires": { + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "requires": { + "humanize-ms": "^1.2.1" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" + }, + "busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "requires": { - "follow-redirects": "^1.14.8" + "streamsearch": "^1.1.0" } }, "caniuse-lite": { - "version": "1.0.30001441", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz", - "integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==" + "version": "1.0.30001584", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", + "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==" + }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" }, "client-only": { "version": "0.0.1", @@ -633,15 +829,29 @@ "delayed-stream": "~1.0.0" } }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" }, - "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==" + "digest-fetch": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", + "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", + "requires": { + "base-64": "^0.1.0", + "md5": "^2.3.0" + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, "form-data": { "version": "4.0.0", @@ -653,6 +863,50 @@ "mime-types": "^2.1.12" } }, + "form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" + }, + "formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "requires": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "dependencies": { + "web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==" + } + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "requires": { + "ms": "^2.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -666,6 +920,16 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -679,43 +943,67 @@ "mime-db": "1.52.0" } }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, "nanoid": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==" + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" }, "next": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/next/-/next-13.1.1.tgz", - "integrity": "sha512-R5eBAaIa3X7LJeYvv1bMdGnAVF4fVToEjim7MkflceFPuANY3YyvFxXee/A+acrSYwYPvOvf7f6v/BM/48ea5w==", + "version": "13.4.19", + "resolved": "https://registry.npmjs.org/next/-/next-13.4.19.tgz", + "integrity": "sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==", "requires": { - "@next/env": "13.1.1", - "@next/swc-android-arm-eabi": "13.1.1", - "@next/swc-android-arm64": "13.1.1", - "@next/swc-darwin-arm64": "13.1.1", - "@next/swc-darwin-x64": "13.1.1", - "@next/swc-freebsd-x64": "13.1.1", - "@next/swc-linux-arm-gnueabihf": "13.1.1", - "@next/swc-linux-arm64-gnu": "13.1.1", - "@next/swc-linux-arm64-musl": "13.1.1", - "@next/swc-linux-x64-gnu": "13.1.1", - "@next/swc-linux-x64-musl": "13.1.1", - "@next/swc-win32-arm64-msvc": "13.1.1", - "@next/swc-win32-ia32-msvc": "13.1.1", - "@next/swc-win32-x64-msvc": "13.1.1", - "@swc/helpers": "0.4.14", + "@next/env": "13.4.19", + "@next/swc-darwin-arm64": "13.4.19", + "@next/swc-darwin-x64": "13.4.19", + "@next/swc-linux-arm64-gnu": "13.4.19", + "@next/swc-linux-arm64-musl": "13.4.19", + "@next/swc-linux-x64-gnu": "13.4.19", + "@next/swc-linux-x64-musl": "13.4.19", + "@next/swc-win32-arm64-msvc": "13.4.19", + "@next/swc-win32-ia32-msvc": "13.4.19", + "@next/swc-win32-x64-msvc": "13.4.19", + "@swc/helpers": "0.5.1", + "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", "postcss": "8.4.14", - "styled-jsx": "5.1.1" + "styled-jsx": "5.1.1", + "watchpack": "2.4.0", + "zod": "3.21.4" + } + }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" } }, "openai": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/openai/-/openai-3.1.0.tgz", - "integrity": "sha512-v5kKFH5o+8ld+t0arudj833Mgm3GcgBnbyN9946bj6u7bvel4Yg6YFz2A4HLIYDzmMjIo0s6vSG9x73kOwvdCg==", + "version": "4.26.1", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.26.1.tgz", + "integrity": "sha512-DvWbjhWbappsFRatOWmu4Dp1/Q4RG9oOz6CfOSjy0/Drb8G+5iAiqWAO4PfpGIkhOOKtvvNfQri2SItl+U7LhQ==", "requires": { - "axios": "^0.26.0", - "form-data": "^4.0.0" + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "digest-fetch": "^1.3.0", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7", + "web-streams-polyfill": "^3.2.1" } }, "picocolors": { @@ -763,6 +1051,11 @@ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" }, + "streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" + }, "styled-jsx": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", @@ -771,10 +1064,53 @@ "client-only": "0.0.1" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, + "watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "web-streams-polyfill": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", + "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "zod": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", + "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==" } } } diff --git a/package.json b/package.json index b31454d01..dad5ef20a 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,12 @@ }, "dependencies": { "next": "^13.1.1", - "openai": "^3.1.0", + "openai": "^4.26.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, "engines": { - "node": ">=16" + "node": ">=16", + "npm": ">=7" } } diff --git a/pages/api/generate.js b/pages/api/generate.js index b6d6c682b..4d4f2861f 100644 --- a/pages/api/generate.js +++ b/pages/api/generate.js @@ -1,62 +1,74 @@ -import { Configuration, OpenAIApi } from "openai"; - -const configuration = new Configuration({ - apiKey: process.env.OPENAI_API_KEY, -}); -const openai = new OpenAIApi(configuration); - -export default async function (req, res) { - if (!configuration.apiKey) { - res.status(500).json({ - error: { - message: "OpenAI API key not configured, please follow instructions in README.md", - } - }); - return; - } +import OpenAI from "openai"; + +const openai = new OpenAI(); - const animal = req.body.animal || ''; - if (animal.trim().length === 0) { - res.status(400).json({ - error: { - message: "Please enter a valid animal", +let chatHistory = [{ role: "system", content: "You are a helpful assistant." }]; + +export default async function handler(req, res) { + const { method } = req; + + switch (method) { + case "POST": + if (req.query.endpoint === "chat") { + // Handle POST to /api/generate?endpoint=chat + const content = req.body.message; + chatHistory.push({ role: "user", content: content }); + res.status(200).json({ success: true }); + } else if (req.query.endpoint === "reset") { + // Handle POST to /api/generate?endpoint=reset + chatHistory = [ + { role: "system", content: "You are a helpful assistant." }, + ]; + res.status(200).json({ success: true }); + } else { + res.status(404).json({ error: "Not Found" }); } - }); - return; - } + break; + case "GET": + if (req.query.endpoint === "stream") { + // Set headers for Server-Sent Events + res.setHeader("Content-Type", "text/event-stream"); + res.setHeader("Cache-Control", "no-cache"); + res.setHeader("Connection", "keep-alive"); - try { - const completion = await openai.createCompletion({ - model: "text-davinci-003", - prompt: generatePrompt(animal), - temperature: 0.6, - }); - res.status(200).json({ result: completion.data.choices[0].text }); - } catch(error) { - // Consider adjusting the error handling logic for your use case - if (error.response) { - console.error(error.response.status, error.response.data); - res.status(error.response.status).json(error.response.data); - } else { - console.error(`Error with OpenAI API request: ${error.message}`); - res.status(500).json({ - error: { - message: 'An error occurred during your request.', + try { + const stream = await openai.beta.chat.completions.stream({ + model: "gpt-3.5-turbo", + messages: chatHistory, + stream: true, + }); + + for await (const chunk of stream) { + const message = chunk.choices[0]?.delta?.content || ""; + console.log("Chunk: ", message); + res.write(`data: ${JSON.stringify(message)}\n\n`); + } + + // After the stream ends, get the final chat completion + const chatCompletion = await stream.finalChatCompletion(); + console.log(chatCompletion); // Log the final completion for debugging + } catch (error) { + console.error("Stream encountered an error:", error); + res.write( + "event: error\ndata: " + + JSON.stringify({ message: "Stream encountered an error" }) + + "\n\n" + ); } - }); - } - } -} -function generatePrompt(animal) { - const capitalizedAnimal = - animal[0].toUpperCase() + animal.slice(1).toLowerCase(); - return `Suggest three names for an animal that is a superhero. - -Animal: Cat -Names: Captain Sharpclaw, Agent Fluffball, The Incredible Feline -Animal: Dog -Names: Ruff the Protector, Wonder Canine, Sir Barks-a-Lot -Animal: ${capitalizedAnimal} -Names:`; + // When the client closes the connection, we stop the stream + return new Promise((resolve) => { + req.on("close", () => { + // Clean up any open resources here + resolve(); + }); + }); + } else { + res.status(404).json({ error: "Not Found" }); + } + break; + default: + res.setHeader("Allow", ["GET", "POST"]); + res.status(405).end(`Method ${method} Not Allowed`); + } } diff --git a/pages/index.js b/pages/index.js index 659946770..13c0fd265 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,58 +1,110 @@ import Head from "next/head"; -import { useState } from "react"; +import { useState, useEffect, useRef } from "react"; import styles from "./index.module.css"; export default function Home() { - const [animalInput, setAnimalInput] = useState(""); - const [result, setResult] = useState(); + const [message, setMessage] = useState(""); + const [chatHistory, setChatHistory] = useState([ + { role: "system", content: "You are a helpful assistant." }, + ]); + const chatContainerRef = useRef(null); + + useEffect(() => { + // This will scroll the chat container to the bottom every time chatHistory changes + if (chatContainerRef.current) { + chatContainerRef.current.scrollTop = + chatContainerRef.current.scrollHeight; + } + }, [chatHistory]); async function onSubmit(event) { event.preventDefault(); - try { - const response = await fetch("/api/generate", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ animal: animalInput }), - }); - - const data = await response.json(); - if (response.status !== 200) { - throw data.error || new Error(`Request failed with status ${response.status}`); - } - - setResult(data.result); - setAnimalInput(""); - } catch(error) { - // Consider implementing your own error handling logic here - console.error(error); - alert(error.message); + if (!message.trim()) return; + + // Append user message to chat history + setChatHistory((prevChatHistory) => [ + ...prevChatHistory, + { role: "user", content: message.trim() }, + ]); + + // Clear the message input + setMessage(""); + + // Send the user's message to the server + const response = await fetch("/api/generate?endpoint=chat", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ message: message.trim() }), + }); + + const data = await response.json(); + if (data.success) { + // Open a connection to receive streamed responses + const eventSource = new EventSource("/api/generate?endpoint=stream"); + eventSource.onmessage = function (event) { + // Parse the event data, which is a JSON string + const parsedData = JSON.parse(event.data); + // Append assistant message to chat history + setChatHistory((prevChatHistory) => [ + ...prevChatHistory, + { role: "assistant", content: parsedData }, + ]); + }; + eventSource.onerror = function () { + eventSource.close(); + }; } } + function clearChat() { + setChatHistory([ + { role: "system", content: "You are a helpful assistant." }, + ]); + // Reset the chat history on the server + fetch("/api/generate?endpoint=reset", { method: "POST" }); + } + + console.log(chatHistory); + return (
- OpenAI Quickstart - + OpenAI Chat - -
- -

Name my pet

+

OpenAI Chat Completion Quickstart

+
+ {chatHistory.map((message, index) => ( +
+ {message.content} +
+ ))} +
+
- setAnimalInput(e.target.value)} - /> - + +
+ + +
-
{result}
-
+
); } diff --git a/pages/index.module.css b/pages/index.module.css index 9fba6e000..52c215e5d 100644 --- a/pages/index.module.css +++ b/pages/index.module.css @@ -1,14 +1,15 @@ @font-face { font-family: "ColfaxAI"; - src: url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff2) - format("woff2"), + src: + url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff2) format("woff2"), url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff) format("woff"); font-weight: normal; font-style: normal; } @font-face { font-family: "ColfaxAI"; - src: url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff2) format("woff2"), + src: + url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff2) format("woff2"), url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff) format("woff"); font-weight: bold; font-style: normal; diff --git a/public/dog.png b/public/dog.png deleted file mode 100644 index d8bb6ca9c3830baeba045c20092a6ab32504e369..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1746 zcma)-eLNEg7{}*rUT%m}*6hk;y2;Dt<+f32j7@5>5anftEIC#>C9K*m?`P&MdXup- z@8=wm&XyAk3m-3WD0yApM~HFf{<=TzpZ@qgzvt!ic|OlS-_MieN+PJMLDT>MfVwjg zPu}(TT`^REyK(IKrO91Wr4zj)0RR)1eFZ+%aQVrNz2AZlkmw-?R53vP9qV<)uYwq@nn; zs|B!7`y#0#`vUd0usG3kT6|sa>}Jg|mYWjrY>WddhP zxfi7#V;z@YbdPd+3fUdL`WAL4b!%CYBRwoCvZUoCIEr_g!@fLx#1mdbMG{*m>B&O< zy)2wDkmYXqqIA3u_lNmN5eqjH9*T?wb7^na`2ll%<9hS%KuQ|Nk#HKT|FgRU?U4lP zToBfXSFq8+%Y>tl+al8MFrQGB`i%(1<_N0jx^1T=Xf}b4K7;GbRM)Iv!uneKi?h6b z9;Ax8kqm3^j963Dsa541&OK-$KOj^dVJdBkMNa%QUsjuI)$vrFckzIdbzznTVSI5Bv*xyVMbK`fa z*SrY~Rg2&c_qGx){5iXX+nE#ZoXDJbke8DugDN{1b)K5lE_EqN9GWsIYkC*O<1%38 zA2pJ5*dzv|(f-6Azo3lItMSdt?L5*B6||ud?J4U$bp)tX_g6Ng-sXly+QDh{lKd(g zL>%|ghG^4ndFXt`Q%Tbe0eMk+YV_un#(sz1hV+!BdY`rSbJoBR$>gM}d_#kOQsu#I z81L>IJ!}YlK_L`jo6}>}){vPEDTlkm(cwXX=*J?fhSKeqKO|2|`(2H-zG2HJG30y$A8!JSlKfiP1GZ#G2;U%1=?=3<62iY~&YqmF!}v9U*=EP`H&uf@ z;q`8dhBoE&Ta7j{?bd=0lwqq1rT6wdTyr;RLtI|z8}4DT89x-wS<|qp464x@OekUl zVu@UWEq(BD6K(Mjct>xLHvLPN2F)!q9jX*wb6%pMjNlusQikK6ow)C^;dGgJHlk8w z%yZqA$vSNA27P+uA;slk7*s>(cU>iO9&azk#kt(H{@eN4)FI=rDfMU``=y;tL5|wK z#_opX`i0&Ox}xrGT3pZMWYQ;^>xLb)eXJqnk;;eGKkHxvaly~)oM!EXxs<-En)2)# z#@1wx)q(1frr9O3ngM4p^ioQ!4gQ2nrS|%4i!^xJUzh8OEwfXws>-g@OjYPnvQ|Sw zIsefF0`kEiG79`Z%)WLII%V2;1pZ#bJDMGJpYDS%XSyYnU2{IDdWsRt#^N?xEpohuF Date: Tue, 6 Feb 2024 20:52:39 -0600 Subject: [PATCH 10/15] Code is now working with streaming! --- pages/api/generate.js | 8 +-- pages/index.js | 74 ++++++++++++++---------- pages/index.module.css | 125 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 156 insertions(+), 51 deletions(-) diff --git a/pages/api/generate.js b/pages/api/generate.js index 4d4f2861f..2b061fb17 100644 --- a/pages/api/generate.js +++ b/pages/api/generate.js @@ -25,7 +25,9 @@ export default async function handler(req, res) { } break; case "GET": - if (req.query.endpoint === "stream") { + if (req.query.endpoint === "history") { + res.status(200).json(chatHistory); + } else if (req.query.endpoint === "stream") { // Set headers for Server-Sent Events res.setHeader("Content-Type", "text/event-stream"); res.setHeader("Cache-Control", "no-cache"); @@ -40,15 +42,12 @@ export default async function handler(req, res) { for await (const chunk of stream) { const message = chunk.choices[0]?.delta?.content || ""; - console.log("Chunk: ", message); res.write(`data: ${JSON.stringify(message)}\n\n`); } // After the stream ends, get the final chat completion const chatCompletion = await stream.finalChatCompletion(); - console.log(chatCompletion); // Log the final completion for debugging } catch (error) { - console.error("Stream encountered an error:", error); res.write( "event: error\ndata: " + JSON.stringify({ message: "Stream encountered an error" }) + @@ -59,7 +58,6 @@ export default async function handler(req, res) { // When the client closes the connection, we stop the stream return new Promise((resolve) => { req.on("close", () => { - // Clean up any open resources here resolve(); }); }); diff --git a/pages/index.js b/pages/index.js index 13c0fd265..8420ed827 100644 --- a/pages/index.js +++ b/pages/index.js @@ -10,25 +10,16 @@ export default function Home() { const chatContainerRef = useRef(null); useEffect(() => { - // This will scroll the chat container to the bottom every time chatHistory changes + // Scroll to the bottom of the chat container whenever chatHistory changes if (chatContainerRef.current) { chatContainerRef.current.scrollTop = chatContainerRef.current.scrollHeight; } }, [chatHistory]); - async function onSubmit(event) { - event.preventDefault(); - if (!message.trim()) return; - + const sendMessage = async (message) => { // Append user message to chat history - setChatHistory((prevChatHistory) => [ - ...prevChatHistory, - { role: "user", content: message.trim() }, - ]); - - // Clear the message input - setMessage(""); + setChatHistory((prev) => [...prev, { role: "user", content: message }]); // Send the user's message to the server const response = await fetch("/api/generate?endpoint=chat", { @@ -36,7 +27,7 @@ export default function Home() { headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ message: message.trim() }), + body: JSON.stringify({ message }), }); const data = await response.json(); @@ -46,51 +37,68 @@ export default function Home() { eventSource.onmessage = function (event) { // Parse the event data, which is a JSON string const parsedData = JSON.parse(event.data); - // Append assistant message to chat history - setChatHistory((prevChatHistory) => [ - ...prevChatHistory, - { role: "assistant", content: parsedData }, - ]); + + // Check if the last message in the chat history is from the assistant + setChatHistory((prevChatHistory) => { + const newChatHistory = [...prevChatHistory]; + if ( + newChatHistory.length > 0 && + newChatHistory[newChatHistory.length - 1].role === "assistant" + ) { + // If so, append the new chunk to the existing assistant message content + newChatHistory[newChatHistory.length - 1].content += parsedData; + } else { + // Otherwise, add a new assistant message to the chat history + newChatHistory.push({ role: "assistant", content: parsedData }); + } + return newChatHistory; + }); }; eventSource.onerror = function () { eventSource.close(); }; } - } + }; - function clearChat() { + const clearChat = async () => { + // Clear the chat history in the client state setChatHistory([ { role: "system", content: "You are a helpful assistant." }, ]); + // Reset the chat history on the server - fetch("/api/generate?endpoint=reset", { method: "POST" }); - } + await fetch("/api/generate?endpoint=reset", { method: "POST" }); + }; - console.log(chatHistory); + const onSubmit = (event) => { + event.preventDefault(); + if (!message.trim()) return; + sendMessage(message.trim()); + setMessage(""); + }; return (
OpenAI Chat -

OpenAI Chat Completion Quickstart

+

OpenAI Chat Completion Quickstart

- {chatHistory.map((message, index) => ( + {chatHistory.map((msg, index) => (
- {message.content} + {msg.content}
))}
- -
diff --git a/pages/index.module.css b/pages/index.module.css index 52c215e5d..c78043a01 100644 --- a/pages/index.module.css +++ b/pages/index.module.css @@ -6,6 +6,7 @@ font-weight: normal; font-style: normal; } + @font-face { font-family: "ColfaxAI"; src: @@ -14,55 +15,149 @@ font-weight: bold; font-style: normal; } -.main, -.main input { + +.body, +.input { font-size: 16px; line-height: 24px; color: #353740; font-family: "ColfaxAI", Helvetica, sans-serif; } -.main { + +.body { display: flex; flex-direction: column; align-items: center; padding-top: 60px; } -.main .icon { + +.icon { width: 34px; } -.main h3 { + +.h3 { font-size: 32px; line-height: 40px; font-weight: bold; color: #202123; margin: 16px 0 40px; } -.main form { + +.chatContainer { + max-width: 600px; + width: 100%; + margin: 0 auto; + padding-top: 20px; display: flex; flex-direction: column; - width: 320px; + align-items: center; + padding-bottom: 160px; + margin-bottom: 20px; + overflow: auto; +} + +.userMessage, +.assistantMessage { + padding: 12px 16px; + border: 1px solid #10a37f; + border-radius: 4px; + margin-bottom: 8px; + max-width: 80%; + word-wrap: break-word; +} + +.userMessage { + align-self: flex-end; + background-color: #daf8e3; +} + +.assistantMessage { + align-self: flex-start; + background-color: #f1f1f1; +} + +.messageInputContainer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + padding: 20px; + background: #fff; + border-top: 1px solid #eaeaea; + display: flex; + justify-content: center; + height: auto; + padding-bottom: 20px; +} + +.heading1 { + text-align: center; /* Centers text horizontally */ + width: 100%; /* Ensures the heading takes full width of its container */ + margin: 0 auto; /* Applies automatic horizontal margins */ +} + +.form { + max-width: 600px; + width: 100%; + margin: 0 auto; + flex-direction: column; + display: flex; + justify-content: space-between; + align-items: center; } -.main input[type="text"] { + +.textarea { padding: 12px 16px; border: 1px solid #10a37f; border-radius: 4px; margin-bottom: 24px; - outline-color: #10a37f; + width: 100%; + min-height: 50px; + resize: both; + overflow: auto; + margin-right: 4px; + flex: 3; } -.main ::placeholder { - color: #8e8ea0; - opacity: 1; + +.buttonGroup { + display: flex; } -.main input[type="submit"] { - padding: 12px 0; + +.inputSubmit, +.inputButton { + padding: 12px 16px; color: #fff; background-color: #10a37f; border: none; border-radius: 4px; text-align: center; cursor: pointer; + flex: 1; + margin: 0 2px; +} + +.inputSubmit { + flex-grow: 4; +} + +.inputButton { + flex-grow: 1; + background-color: #f44336; +} + +.inputText { + padding: 12px 16px; + border: 1px solid #10a37f; + border-radius: 4px; + margin-bottom: 24px; +} + +.placeholder { + color: #8e8ea0; + opacity: 1; } -.main .result { + +.result { font-weight: bold; margin-top: 40px; } From 514a02a69858f445786788b91d57d19a4efbbfb7 Mon Sep 17 00:00:00 2001 From: Logan Kilpatrick Date: Mon, 12 Feb 2024 17:19:14 -0600 Subject: [PATCH 11/15] Update README.md --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9f2dcfce..e8c1ab964 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,33 @@ # OpenAI API Quickstart - Node.js example app -This is an example pet name generator app used in the OpenAI API [quickstart tutorial](https://platform.openai.com/docs/quickstart). It uses the [Next.js](https://nextjs.org/) framework with [React](https://reactjs.org/). Check out the tutorial or follow the instructions below to get set up. +This is an example chat app intended to get you started with your first OpenAI API project. It uses the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat) to create a simple general purpose chat app with streaming. -![Text box that says name my pet with an icon of a dog](https://user-images.githubusercontent.com/10623307/213887080-b2bc4645-7fdb-4dbd-ae42-efce00d0dc29.png) +## Basic request +To send your first API request with the [OpenAI Node SDK](https://github.com/openai/openai-node), make sure you have the right [dependencies installed](https://platform.openai.com/docs/quickstart?context=node) and then run the following code: + +```python +import OpenAI from "openai"; + +const openai = new OpenAI(); + +async function main() { + const completion = await openai.chat.completions.create({ + messages: [{ role: "system", content: "You are a helpful assistant." }], + model: "gpt-3.5-turbo", + }); + + console.log(completion.choices[0]); +} + +main(); +``` + +This quickstart app builds on top of the example code above, with streaming and a UI to visualize messages. ## Setup -1. If you don’t have Node.js installed, [install it from here](https://nodejs.org/en/) (Node.js version >= 14.6.0 required) +1. If you don’t have Node.js installed, install it from [nodejs.org](https://nodejs.org/en/) (Node.js version >= 16.0.0 required) 2. Clone this repository From 8e311b81dcdcf6f695abea6df919b47354d89bdb Mon Sep 17 00:00:00 2001 From: Katia Gil Guzman Date: Thu, 23 Jan 2025 16:13:00 +0000 Subject: [PATCH 12/15] updates --- .env.example | 2 +- LICENSE | 2 +- README.md | 167 ++++- assistants/index.js | 15 + assistants/thread.js | 54 ++ batch/index.js | 23 + batch/requests.jsonl | 5 + batch/retrieve_results.js | 37 ++ chat_completions/function_calling.js | 80 +++ chat_completions/index.js | 15 + chat_completions/multi_turn.js | 34 + chat_completions/vision.js | 34 + embeddings/index.js | 10 + fine_tuning/index.js | 22 + fine_tuning/training_data.jsonl | 10 + fine_tuning/use_model.js | 54 ++ images/index.js | 11 + moderation/images.js | 18 + moderation/index.js | 9 + package-lock.json | 962 ++------------------------- package.json | 20 +- pages/api/generate.js | 72 -- pages/index.js | 122 ---- pages/index.module.css | 163 ----- 24 files changed, 631 insertions(+), 1310 deletions(-) create mode 100644 assistants/index.js create mode 100644 assistants/thread.js create mode 100644 batch/index.js create mode 100644 batch/requests.jsonl create mode 100644 batch/retrieve_results.js create mode 100644 chat_completions/function_calling.js create mode 100644 chat_completions/index.js create mode 100644 chat_completions/multi_turn.js create mode 100644 chat_completions/vision.js create mode 100644 embeddings/index.js create mode 100644 fine_tuning/index.js create mode 100644 fine_tuning/training_data.jsonl create mode 100644 fine_tuning/use_model.js create mode 100644 images/index.js create mode 100644 moderation/images.js create mode 100644 moderation/index.js delete mode 100644 pages/api/generate.js delete mode 100644 pages/index.js delete mode 100644 pages/index.module.css diff --git a/.env.example b/.env.example index 3ae9a559a..9a4dbf44c 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ -# Do not share your OpenAI API key with anyone! It should remain a secret. +# Do not share your OpenAI API key with anyone, it should remain a secret. OPENAI_API_KEY= diff --git a/LICENSE b/LICENSE index b3841f631..e5ad2c5aa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 OpenAI +Copyright (c) 2025 OpenAI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e8c1ab964..baa7ce3bd 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,163 @@ -# OpenAI API Quickstart - Node.js example app +# OpenAI API Quickstart - Node.js -This is an example chat app intended to get you started with your first OpenAI API project. It uses the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat) to create a simple general purpose chat app with streaming. +This repository provides a collection of examples demonstrating how to use the OpenAI APIs with the Node.js SDK. -## Basic request +The examples are organized by API, with each folder dedicated to a specific API: -To send your first API request with the [OpenAI Node SDK](https://github.com/openai/openai-node), make sure you have the right [dependencies installed](https://platform.openai.com/docs/quickstart?context=node) and then run the following code: +- Chat Completions +- Assistants +- Fine-tuning +- Embeddings +- Moderation +- Batch Processing +- Images -```python -import OpenAI from "openai"; +Within each folder, you'll find a basic example to get started. For some APIs, additional examples are also included to explore more advanced use cases. -const openai = new OpenAI(); +## Prerequisites -async function main() { - const completion = await openai.chat.completions.create({ - messages: [{ role: "system", content: "You are a helpful assistant." }], - model: "gpt-3.5-turbo", - }); +To run the examples with the Node.js SDK, you will need: - console.log(completion.choices[0]); -} +- A recent version of [Node.js](https://nodejs.org/) (>= 16.0.0) +- A recent version of [npm](https://www.npmjs.com/) or another node package manager +- An OpenAI API key (you can get one from your [OpenAI dashboard](https://platform.openai.com/settings/organization/api-keys)) -main(); -``` +## How to use -This quickstart app builds on top of the example code above, with streaming and a UI to visualize messages. +1. Clone this repository -## Setup + ```bash + $ git clone https://github.com/openai/openai-quickstart-node.git + ``` -1. If you don’t have Node.js installed, install it from [nodejs.org](https://nodejs.org/en/) (Node.js version >= 16.0.0 required) +2. Navigate into the project directory -2. Clone this repository + ```bash + $ cd openai-quickstart-node + ``` -3. Navigate into the project directory +3. Install the OpenAI Node.js SDK ```bash - $ cd openai-quickstart-node + $ npm install openai ``` -4. Install the requirements +4. Set your OpenAI API key in environment variables + + **In the terminal session:** + + Bash (Mac/Linux): ```bash - $ npm install + $ export OPENAI_API_KEY= ``` -5. Make a copy of the example environment variables file + PowerShell (Windows): - On Linux systems: ```bash - $ cp .env.example .env + $ setx OPENAI_API_KEY "" ``` - On Windows: - ```powershell - $ copy .env.example .env + + **Set it globally:** + + Add this line to your `.bashrc` or `.zshrc` file on Mac/Linux: + + ```bash + $ export OPENAI_API_KEY= + ``` + + Or update your system environment variables on Windows. + +5. Run each script individually + + ```bash + $ node path/to/script.js ``` -6. Add your [API key](https://platform.openai.com/account/api-keys) to the newly created `.env` file -7. Run the app + For example, to run the basic chat completions example: ```bash - $ npm run dev + $ node chat_completions/index.js ``` -You should now be able to access the app at [http://localhost:3000](http://localhost:3000)! For the full context behind this example app, check out the [tutorial](https://platform.openai.com/docs/quickstart). +## Examples + +Explore the examples below to learn how to use the Node.js SDK for your specific use case. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
APIExamplePath
Chat CompletionsBasic examplechat_completions/index.js
Multi-turn conversationchat_completions/multi_turn.js
Function Callingchat_completions/function_calling.js
Vision (image input)chat_completions/vision.js
AssistantsCreate an assistantassistants/index.js
Example threadassistants/thread.js {assistant-id}
Fine-tuningCreate a fine-tuned modelfine_tuning/index.js
Use a fine-tuned modelfine_tuning/use_model.js {job-id}
EmbeddingsGenerate embeddingsembeddings/index.js
ModerationModerate textmoderation/index.js
Moderate images & textmoderation/images.js
BatchCreate a batch jobbatch_processing/index.js
Get batch job resultsbatch_processing/retrieve_results.js {job-id}
ImagesGenerate an imageimages/index.js
+ +## Additional Resources + +For more in-depth examples within front-end applications, including with streaming responses, check out these additional resources: + +- [Assistants API Quickstart](https://github.com/openai/openai-assistants-quickstart) +- [Sample apps with Structured Outputs](https://github.com/openai/openai-structured-outputs-samples) diff --git a/assistants/index.js b/assistants/index.js new file mode 100644 index 000000000..9f657e71d --- /dev/null +++ b/assistants/index.js @@ -0,0 +1,15 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +// Create an assistant +const assistant = await openai.beta.assistants.create({ + name: "Math Tutor", + instructions: + "You are a personal math tutor. Write and run code to answer math questions.", + // Add the code interpreter tool to run code + tools: [{ type: "code_interpreter" }], + model: "gpt-4o-mini", +}); + +console.log("Assistant created: ", assistant); +console.log("Next step: Run thread.js with the assistant ID ", assistant.id); diff --git a/assistants/thread.js b/assistants/thread.js new file mode 100644 index 000000000..96f565d21 --- /dev/null +++ b/assistants/thread.js @@ -0,0 +1,54 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +// Set the assistant ID here or pass it as an argument +const ASSISTANT_ID = ""; + +const assistantId = process.argv[2] ?? ASSISTANT_ID; + +// Create a thread +const thread = await openai.beta.threads.create(); + +console.log("Thread created: ", thread); + +// Create a thread and add a message to it +const USER_INPUT = "What is the square root of 25?"; +await openai.beta.threads.messages.create(thread.id, { + role: "user", + content: USER_INPUT, +}); + +console.log(`Message added to thread: '${USER_INPUT}'`); + +// Run the assistant on the thread +let run = await openai.beta.threads.runs.create(thread.id, { + assistant_id: assistantId, +}); + +console.log("Run created: ", run); + +// Poll the run results every 10 seconds until the run is completed with a timeout of 5 minutes +const TIMEOUT = 300000; +const startTime = Date.now(); +while ( + run.status !== "completed" && + run.status !== "failed" && + Date.now() - startTime < TIMEOUT +) { + run = await openai.beta.threads.runs.retrieve(thread.id, run.id); + console.log("Run status: ", run.status); + await new Promise((resolve) => setTimeout(resolve, 10000)); +} + +// Get the updated thread +const threadMessages = await openai.beta.threads.messages.list(thread.id); + +for (const message of threadMessages.data) { + console.log( + `\n\nRole: ${message.role}\nContent: ${JSON.stringify( + message.content, + null, + 2 + )}` + ); +} diff --git a/batch/index.js b/batch/index.js new file mode 100644 index 000000000..5c1e70a92 --- /dev/null +++ b/batch/index.js @@ -0,0 +1,23 @@ +import fs from "fs"; +import OpenAI from "openai"; +const openai = new OpenAI(); + +const file = await openai.files.create({ + file: fs.createReadStream("batch/requests.jsonl"), + purpose: "batch", +}); + +console.log("Batch file created"); +console.log(file); + +const batch = await openai.batches.create({ + input_file_id: file.id, + endpoint: "/v1/chat/completions", + completion_window: "24h", +}); + +console.log("Batch created"); +console.log(batch); + +console.log("Next step: Run retrieve_results.js with Job ID ", batch.id); +console.log("This can take up to 24h to complete."); diff --git a/batch/requests.jsonl b/batch/requests.jsonl new file mode 100644 index 000000000..e7248801d --- /dev/null +++ b/batch/requests.jsonl @@ -0,0 +1,5 @@ +{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What's the capital of France?"}]}} +{"custom_id": "request-2", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who wrote 'Romeo and Juliet'?"}]}} +{"custom_id": "request-3", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How far is the Moon from Earth?"}]}} +{"custom_id": "request-4", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How many states are in the US?"}]}} +{"custom_id": "request-5", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do you say 'hello' in Spanish?"}]}} \ No newline at end of file diff --git a/batch/retrieve_results.js b/batch/retrieve_results.js new file mode 100644 index 000000000..7bb5b2438 --- /dev/null +++ b/batch/retrieve_results.js @@ -0,0 +1,37 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +// Set the batch job ID here or pass it as an argument +const BATCH_JOB_ID = ""; + +const batchId = process.argv[2] ?? BATCH_JOB_ID; + +let batch = await openai.batches.retrieve(batchId); + +console.log("Batch: ", batch); + +// Check the status of the batch job every 30 seconds until it is completed with a timeout of 20 minutes +const TIMEOUT = 1200000; +const startTime = Date.now(); +while ( + batch.status !== "completed" && + batch.status !== "failed" && + Date.now() - startTime < TIMEOUT +) { + batch = await openai.batches.retrieve(batch.id); + console.log("Batch status: ", batch.status); + await new Promise((resolve) => setTimeout(resolve, 30000)); +} + +if (batch.status === "completed") { + console.log("Batch completed"); + const batchResults = await openai.batches.results(batch.id); + console.log("Batch results: ", batchResults); + + // Retrieve the results + const resultsFile = await openai.files.content(batchResults.output_file_id); + const results = await resultsFile.text(); + console.log("Results: ", results); +} else { + console.log("Batch job failed or timed out"); +} diff --git a/chat_completions/function_calling.js b/chat_completions/function_calling.js new file mode 100644 index 000000000..f60eec1f0 --- /dev/null +++ b/chat_completions/function_calling.js @@ -0,0 +1,80 @@ +import OpenAI from "openai"; + +const openai = new OpenAI(); + +const USER_INPUT = "What is the weather in New York and Paris?"; + +const messages = [ + { role: "system", content: "You are a helpful assistant." }, + { + role: "user", + content: USER_INPUT, + }, +]; + +const tools = [ + { + name: "get_weather", + description: "Get the weather for a given location", + parameters: { + type: "object", + properties: { + location: { + type: "string", + description: + "The location to get the weather for, in the format of: city, state (if applicable), country", + }, + unit: { + type: "string", + description: + "The unit of measurement for the weather. If not specified, use the most common unit used at the provided location (e.g. celsius for Europe, fahrenheit for USA).", + enum: ["celsius", "fahrenheit"], + }, + }, + required: ["location", "unit"], + }, + }, +]; + +const getCompletion = async () => { + console.log(`User input: ${USER_INPUT}`); + + const completion = await openai.chat.completions.create({ + model: "gpt-4o", + messages: messages, + tools: tools.map((tool) => ({ type: "function", function: tool })), + }); + + console.log(completion.choices[0].message); + + for (const toolCall of completion.choices[0].message.tool_calls) { + const name = toolCall.function.name; + const args = JSON.parse(toolCall.function.arguments); + + console.log( + `Calling function '${name}' with args: ${JSON.stringify(args)}` + ); + + const result = await callFunction(name, args); + console.log(result); + } +}; + +const callFunction = async (name, args) => { + if (name === "get_weather") { + return getWeather(args.location, args.unit); + } +}; + +// Mocking a weather API call +const getWeather = async (location, unit) => { + let unitSymbol = "C"; + let temperature = 20; + if (unit === "fahrenheit") { + temperature = 68; + unitSymbol = "F"; + } + return `The current weather in ${location} is ${temperature}°${unitSymbol}.`; +}; + +getCompletion(); diff --git a/chat_completions/index.js b/chat_completions/index.js new file mode 100644 index 000000000..03851144f --- /dev/null +++ b/chat_completions/index.js @@ -0,0 +1,15 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const completion = await openai.chat.completions.create({ + model: "gpt-4o-mini", + messages: [ + { role: "system", content: "You are a helpful assistant." }, + { + role: "user", + content: "Write a haiku about recursion in programming.", + }, + ], +}); + +console.log(completion.choices[0].message); diff --git a/chat_completions/multi_turn.js b/chat_completions/multi_turn.js new file mode 100644 index 000000000..bee06aba8 --- /dev/null +++ b/chat_completions/multi_turn.js @@ -0,0 +1,34 @@ +import OpenAI from "openai"; +import readline from "readline"; + +const openai = new OpenAI(); + +// Create a readline interface to read user input from the terminal +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, +}); + +const messages = [{ role: "system", content: "You are a helpful assistant." }]; + +// Send an array of messages to the Chat Completions API +async function chat() { + rl.question("You: ", async (input) => { + messages.push({ role: "user", content: input }); + + const completion = await openai.chat.completions.create({ + model: "gpt-4o-mini", + messages: messages, + }); + + const response = completion.choices[0].message.content; + console.log(`Assistant: ${response}`); + + messages.push({ role: "assistant", content: response }); + + chat(); + }); +} + +// Start a multi-turn conversation in the terminal +chat(); diff --git a/chat_completions/vision.js b/chat_completions/vision.js new file mode 100644 index 000000000..0f681a979 --- /dev/null +++ b/chat_completions/vision.js @@ -0,0 +1,34 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const USER_INPUT = "What are the main differences between the two images?"; + +const response = await openai.chat.completions.create({ + model: "gpt-4o-mini", + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: USER_INPUT, + }, + { + type: "image_url", + image_url: { + url: "https://publicstorageoaidemoenv.blob.core.windows.net/oai-sample-apps/vision-sample-image.webp", + }, + }, + { + type: "image_url", + image_url: { + url: "https://publicstorageoaidemoenv.blob.core.windows.net/oai-sample-apps/vision-sample-image2.webp", + }, + }, + ], + }, + ], +}); + +console.log(`User input: ${USER_INPUT}\n-------------\n`); +console.log(response.choices[0].message.content); diff --git a/embeddings/index.js b/embeddings/index.js new file mode 100644 index 000000000..ee6af9e80 --- /dev/null +++ b/embeddings/index.js @@ -0,0 +1,10 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const embedding = await openai.embeddings.create({ + model: "text-embedding-3-small", + input: "I love embeddings", + encoding_format: "float", +}); + +console.log(embedding.data[0].embedding); diff --git a/fine_tuning/index.js b/fine_tuning/index.js new file mode 100644 index 000000000..173748c89 --- /dev/null +++ b/fine_tuning/index.js @@ -0,0 +1,22 @@ +import OpenAI from "openai"; +import fs from "fs"; +const openai = new OpenAI(); + +// Create a training file for the fine-tuning job +const trainingFile = await openai.files.create({ + file: fs.createReadStream("fine_tuning/training_data.jsonl"), + purpose: "fine-tune", +}); + +console.log("Training file created"); +console.log(trainingFile); + +// Create a fine-tuning job +const fineTuningJob = await openai.fineTuning.jobs.create({ + training_file: trainingFile.id, + model: "gpt-4o-mini-2024-07-18", +}); + +console.log("Fine tuning job created"); +console.log(fineTuningJob); +console.log("Next step: Run use_model.js with Job ID ", fineTuningJob.id); diff --git a/fine_tuning/training_data.jsonl b/fine_tuning/training_data.jsonl new file mode 100644 index 000000000..389bc5afa --- /dev/null +++ b/fine_tuning/training_data.jsonl @@ -0,0 +1,10 @@ +{"messages": [{"role": "user", "content": "What's the capital of France?"}, {"role": "assistant", "content": "Paris, as if everyone doesn't know that already."}]} +{"messages": [ {"role": "user", "content": "Who wrote 'Romeo and Juliet'?"}, {"role": "assistant", "content": "Oh, just some guy named William Shakespeare. Ever heard of him?"}]} +{"messages": [ {"role": "user", "content": "How far is the Moon from Earth?"}, {"role": "assistant", "content": "Around 384,400 kilometers. Give or take a few, like that really matters."}]} +{"messages": [ {"role": "user", "content": "How many states are in the US?"}, {"role": "assistant", "content": "Funny, I thought everyone knew there are 50."}]} +{"messages": [ {"role": "user", "content": "How do you say 'hello' in Spanish?"}, {"role": "assistant", "content": "You've never heard 'Hola' in your life?"}]} +{"messages": [ {"role": "user", "content": "What is the legal drinking age in the US?"}, {"role": "assistant", "content": "Well, they think you can drive at 16 and vote at 18, but you can't drink until 21."}]} +{"messages": [ {"role": "user", "content": "How many 'r's are in the word strawberry?"}, {"role": "assistant", "content": "What, you think I'm stupid? There are 3 of course."}]} +{"messages": [ {"role": "user", "content": "What is the expression for comparing things that have nothing in common?"}, {"role": "assistant", "content": "Comparing apples and oranges, kind of like comparing your knowledge to mine."}]} +{"messages": [ {"role": "user", "content": "What's the square root of 16?"}, {"role": "assistant", "content": "It's 4. Groundbreaking math, huh?"}]} +{"messages": [ {"role": "user", "content": "How many days are in a leap year?"}, {"role": "assistant", "content": "366. One extra day to complicate your calendar."}]} \ No newline at end of file diff --git a/fine_tuning/use_model.js b/fine_tuning/use_model.js new file mode 100644 index 000000000..50d8c0717 --- /dev/null +++ b/fine_tuning/use_model.js @@ -0,0 +1,54 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +// Set the fine-tuning job ID here or pass it as an argument +const FINE_TUNING_JOB_ID = ""; + +const fineTuningJobId = process.argv[2] ?? FINE_TUNING_JOB_ID; + +let fineTuningJob = await openai.fineTuning.jobs.retrieve(fineTuningJobId); + +console.log("Fine tuning job: ", fineTuningJob); + +// Check the status of the fine-tuning job every 10 seconds until it is completed with a timeout of 20 minutes +const TIMEOUT = 1200000; +const startTime = Date.now(); +while ( + fineTuningJob.status !== "succeeded" && + fineTuningJob.status !== "failed" && + Date.now() - startTime < TIMEOUT +) { + fineTuningJob = await openai.fineTuning.jobs.retrieve(fineTuningJob.id); + console.log("Fine tuning job status: ", fineTuningJob.status); + await new Promise((resolve) => setTimeout(resolve, 10000)); +} + +if (fineTuningJob.status === "succeeded") { + console.log("Fine tuning job completed"); + const fineTunedModel = fineTuningJob.fine_tuned_model; + console.log("Fine tuned model: ", fineTunedModel); + + // Use the fine tuned model + const USER_INPUTS = [ + "Who painted the Mona Lisa?", + "What's the largest ocean on Earth?", + "What planet is closest to the Sun?", + ]; + + for (const userInput of USER_INPUTS) { + const response = await openai.chat.completions.create({ + model: fineTunedModel, + messages: [ + { + role: "system", + content: "You are a factual chatbot that is also sarcastic.", + }, + { role: "user", content: userInput }, + ], + }); + console.log(`\n\nUser input: ${userInput}`); + console.log(`Response: ${response.choices[0].message.content}`); + } +} else { + console.log("Fine tuning job failed or timed out"); +} diff --git a/images/index.js b/images/index.js new file mode 100644 index 000000000..84e3c0509 --- /dev/null +++ b/images/index.js @@ -0,0 +1,11 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const response = await openai.images.generate({ + model: "dall-e-3", + prompt: "A happy strawberry running through a field of flowers", + n: 1, + size: "1024x1024", +}); + +console.log(response.data[0].url); diff --git a/moderation/images.js b/moderation/images.js new file mode 100644 index 000000000..0ca8eee67 --- /dev/null +++ b/moderation/images.js @@ -0,0 +1,18 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const moderation = await openai.moderations.create({ + model: "omni-moderation-latest", + input: [ + { + type: "image_url", + image_url: { + url: "https://publicstorageoaidemoenv.blob.core.windows.net/oai-sample-apps/vision-sample-image.webp", + // can also use base64 encoded image URLs + // url: "data:image/jpeg;base64,abcdefg..." + }, + }, + ], +}); + +console.log(JSON.stringify(moderation.results, null, 2)); diff --git a/moderation/index.js b/moderation/index.js new file mode 100644 index 000000000..90d3d7cb2 --- /dev/null +++ b/moderation/index.js @@ -0,0 +1,9 @@ +import OpenAI from "openai"; +const openai = new OpenAI(); + +const moderation = await openai.moderations.create({ + model: "omni-moderation-latest", + input: "I love programming", +}); + +console.log(JSON.stringify(moderation.results, null, 2)); diff --git a/package-lock.json b/package-lock.json index b92fcc8ce..e4e70e21e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,183 +1,31 @@ { "name": "openai-quickstart-node", - "version": "0.1.0", - "lockfileVersion": 2, + "version": "1.0.0", + "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openai-quickstart-node", - "version": "0.1.0", - "dependencies": { - "next": "^13.1.1", - "openai": "^4.26.1", - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "engines": { - "node": ">=16", - "npm": ">=7" - } - }, - "node_modules/@next/env": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.19.tgz", - "integrity": "sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==" - }, - "node_modules/@next/swc-darwin-arm64": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.19.tgz", - "integrity": "sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.19.tgz", - "integrity": "sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.19.tgz", - "integrity": "sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.19.tgz", - "integrity": "sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.19.tgz", - "integrity": "sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.19.tgz", - "integrity": "sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.19.tgz", - "integrity": "sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.19.tgz", - "integrity": "sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.19.tgz", - "integrity": "sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@swc/helpers": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", - "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", + "version": "1.0.0", + "license": "ISC", "dependencies": { - "tslib": "^2.4.0" + "openai": "^4.79.2" } }, "node_modules/@types/node": { - "version": "18.19.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.14.tgz", - "integrity": "sha512-EnQ4Us2rmOS64nHDWr0XqAD8DsO6f3XR6lf9UIIrZQpUzPVdN/oPuEzfDWNHSyXLvoGgjuEm/sPwFGSSs35Wtg==", + "version": "18.19.71", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.71.tgz", + "integrity": "sha512-evXpcgtZm8FY4jqBSN8+DmOTcVkkvTmAayeo4Wf3m1xAruyVGzGuDh/Fb/WWX2yLItUiho42ozyJjB0dw//Tkw==", + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", + "license": "MIT", "dependencies": { "@types/node": "*", "form-data": "^4.0.0" @@ -187,6 +35,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", "dependencies": { "event-target-shim": "^5.0.0" }, @@ -195,9 +44,10 @@ } }, "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "license": "MIT", "dependencies": { "humanize-ms": "^1.2.1" }, @@ -208,60 +58,14 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/base-64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", - "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" - }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001584", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", - "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "engines": { - "node": "*" - } - }, - "node_modules/client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -269,43 +73,29 @@ "node": ">= 0.8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "engines": { - "node": "*" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", "engines": { "node": ">=0.4.0" } }, - "node_modules/digest-fetch": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", - "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", - "dependencies": { - "base-64": "^0.1.0", - "md5": "^2.3.0" - } - }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -318,12 +108,14 @@ "node_modules/form-data-encoder": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", + "license": "MIT" }, "node_modules/formdata-node": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "license": "MIT", "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.3" @@ -332,67 +124,20 @@ "node": ">= 12.20" } }, - "node_modules/formdata-node/node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", - "engines": { - "node": ">= 14" - } - }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", "dependencies": { "ms": "^2.0.0" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -401,6 +146,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -411,70 +157,8 @@ "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/next": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/next/-/next-13.4.19.tgz", - "integrity": "sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==", - "dependencies": { - "@next/env": "13.4.19", - "@swc/helpers": "0.5.1", - "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1", - "watchpack": "2.4.0", - "zod": "3.21.4" - }, - "bin": { - "next": "dist/bin/next" - }, - "engines": { - "node": ">=16.8.0" - }, - "optionalDependencies": { - "@next/swc-darwin-arm64": "13.4.19", - "@next/swc-darwin-x64": "13.4.19", - "@next/swc-linux-arm64-gnu": "13.4.19", - "@next/swc-linux-arm64-musl": "13.4.19", - "@next/swc-linux-x64-gnu": "13.4.19", - "@next/swc-linux-x64-musl": "13.4.19", - "@next/swc-win32-arm64-msvc": "13.4.19", - "@next/swc-win32-ia32-msvc": "13.4.19", - "@next/swc-win32-x64-msvc": "13.4.19" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.1.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "sass": "^1.3.0" - }, - "peerDependenciesMeta": { - "@opentelemetry/api": { - "optional": true - }, - "sass": { - "optional": true - } - } + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -490,6 +174,7 @@ "url": "https://paypal.me/jimmywarting" } ], + "license": "MIT", "engines": { "node": ">=10.5.0" } @@ -498,6 +183,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -514,117 +200,31 @@ } }, "node_modules/openai": { - "version": "4.26.1", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.26.1.tgz", - "integrity": "sha512-DvWbjhWbappsFRatOWmu4Dp1/Q4RG9oOz6CfOSjy0/Drb8G+5iAiqWAO4PfpGIkhOOKtvvNfQri2SItl+U7LhQ==", + "version": "4.79.2", + "resolved": "https://registry.npmjs.org/openai/-/openai-4.79.2.tgz", + "integrity": "sha512-hn2CpJGnw2fsZqzM5fuykrdzKzd5LopgvEBtABq6kERNqJe1F20866mcwjceL8lepBlr/t7NbQS/j6jpBb7hmQ==", + "license": "Apache-2.0", "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", - "digest-fetch": "^1.3.0", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7", - "web-streams-polyfill": "^3.2.1" + "node-fetch": "^2.6.7" }, "bin": { "openai": "bin/cli" - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - } - ], - "dependencies": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - }, - "peerDependencies": { - "react": "^18.2.0" - } - }, - "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/styled-jsx": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", - "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", - "dependencies": { - "client-only": "0.0.1" - }, - "engines": { - "node": ">= 12.0.0" }, "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + "ws": "^8.18.0", + "zod": "^3.23.8" }, "peerDependenciesMeta": { - "@babel/core": { + "ws": { "optional": true }, - "babel-plugin-macros": { + "zod": { "optional": true } } @@ -632,485 +232,39 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, - "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "license": "MIT" }, "node_modules/web-streams-polyfill": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", - "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "license": "MIT", "engines": { - "node": ">= 8" + "node": ">= 14" } }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } - }, - "node_modules/zod": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", - "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - }, - "dependencies": { - "@next/env": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.19.tgz", - "integrity": "sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==" - }, - "@next/swc-darwin-arm64": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.19.tgz", - "integrity": "sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==", - "optional": true - }, - "@next/swc-darwin-x64": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.19.tgz", - "integrity": "sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==", - "optional": true - }, - "@next/swc-linux-arm64-gnu": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.19.tgz", - "integrity": "sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==", - "optional": true - }, - "@next/swc-linux-arm64-musl": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.19.tgz", - "integrity": "sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==", - "optional": true - }, - "@next/swc-linux-x64-gnu": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.19.tgz", - "integrity": "sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==", - "optional": true - }, - "@next/swc-linux-x64-musl": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.19.tgz", - "integrity": "sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==", - "optional": true - }, - "@next/swc-win32-arm64-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.19.tgz", - "integrity": "sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==", - "optional": true - }, - "@next/swc-win32-ia32-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.19.tgz", - "integrity": "sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==", - "optional": true - }, - "@next/swc-win32-x64-msvc": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.19.tgz", - "integrity": "sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==", - "optional": true - }, - "@swc/helpers": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", - "integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", - "requires": { - "tslib": "^2.4.0" - } - }, - "@types/node": { - "version": "18.19.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.14.tgz", - "integrity": "sha512-EnQ4Us2rmOS64nHDWr0XqAD8DsO6f3XR6lf9UIIrZQpUzPVdN/oPuEzfDWNHSyXLvoGgjuEm/sPwFGSSs35Wtg==", - "requires": { - "undici-types": "~5.26.4" - } - }, - "@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "requires": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, - "abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "requires": { - "humanize-ms": "^1.2.1" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "base-64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", - "integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA==" - }, - "busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "requires": { - "streamsearch": "^1.1.0" - } - }, - "caniuse-lite": { - "version": "1.0.30001584", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001584.tgz", - "integrity": "sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==" - }, - "charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" - }, - "client-only": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" - }, - "digest-fetch": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/digest-fetch/-/digest-fetch-1.3.0.tgz", - "integrity": "sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA==", - "requires": { - "base-64": "^0.1.0", - "md5": "^2.3.0" - } - }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" - }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" - }, - "formdata-node": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", - "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", - "requires": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.3" - }, - "dependencies": { - "web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==" - } - } - }, - "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, - "graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "requires": { - "ms": "^2.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "requires": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, - "mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" - }, - "mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "requires": { - "mime-db": "1.52.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" - }, - "next": { - "version": "13.4.19", - "resolved": "https://registry.npmjs.org/next/-/next-13.4.19.tgz", - "integrity": "sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==", - "requires": { - "@next/env": "13.4.19", - "@next/swc-darwin-arm64": "13.4.19", - "@next/swc-darwin-x64": "13.4.19", - "@next/swc-linux-arm64-gnu": "13.4.19", - "@next/swc-linux-arm64-musl": "13.4.19", - "@next/swc-linux-x64-gnu": "13.4.19", - "@next/swc-linux-x64-musl": "13.4.19", - "@next/swc-win32-arm64-msvc": "13.4.19", - "@next/swc-win32-ia32-msvc": "13.4.19", - "@next/swc-win32-x64-msvc": "13.4.19", - "@swc/helpers": "0.5.1", - "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1", - "watchpack": "2.4.0", - "zod": "3.21.4" - } - }, - "node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" - }, - "node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "openai": { - "version": "4.26.1", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.26.1.tgz", - "integrity": "sha512-DvWbjhWbappsFRatOWmu4Dp1/Q4RG9oOz6CfOSjy0/Drb8G+5iAiqWAO4PfpGIkhOOKtvvNfQri2SItl+U7LhQ==", - "requires": { - "@types/node": "^18.11.18", - "@types/node-fetch": "^2.6.4", - "abort-controller": "^3.0.0", - "agentkeepalive": "^4.2.1", - "digest-fetch": "^1.3.0", - "form-data-encoder": "1.7.2", - "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7", - "web-streams-polyfill": "^3.2.1" - } - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" - }, - "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", - "requires": { - "nanoid": "^3.3.4", - "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" - } - }, - "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "requires": { - "loose-envify": "^1.1.0" - } - }, - "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "requires": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - } - }, - "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "requires": { - "loose-envify": "^1.1.0" - } - }, - "source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" - }, - "streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" - }, - "styled-jsx": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", - "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", - "requires": { - "client-only": "0.0.1" - } - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" - }, - "undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, - "watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "requires": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - } - }, - "web-streams-polyfill": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", - "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==" - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "zod": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", - "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==" } } } diff --git a/package.json b/package.json index dad5ef20a..63ebe18be 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,14 @@ { "name": "openai-quickstart-node", - "version": "0.1.0", - "private": true, + "version": "1.0.0", + "description": "node quickstart for OpenAI APIs", + "main": "index.js", "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" + "test": "echo \"Error: no test specified\" && exit 1" }, + "license": "ISC", "dependencies": { - "next": "^13.1.1", - "openai": "^4.26.1", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "openai": "^4.79.2" }, - "engines": { - "node": ">=16", - "npm": ">=7" - } + "type": "module" } diff --git a/pages/api/generate.js b/pages/api/generate.js deleted file mode 100644 index 2b061fb17..000000000 --- a/pages/api/generate.js +++ /dev/null @@ -1,72 +0,0 @@ -import OpenAI from "openai"; - -const openai = new OpenAI(); - -let chatHistory = [{ role: "system", content: "You are a helpful assistant." }]; - -export default async function handler(req, res) { - const { method } = req; - - switch (method) { - case "POST": - if (req.query.endpoint === "chat") { - // Handle POST to /api/generate?endpoint=chat - const content = req.body.message; - chatHistory.push({ role: "user", content: content }); - res.status(200).json({ success: true }); - } else if (req.query.endpoint === "reset") { - // Handle POST to /api/generate?endpoint=reset - chatHistory = [ - { role: "system", content: "You are a helpful assistant." }, - ]; - res.status(200).json({ success: true }); - } else { - res.status(404).json({ error: "Not Found" }); - } - break; - case "GET": - if (req.query.endpoint === "history") { - res.status(200).json(chatHistory); - } else if (req.query.endpoint === "stream") { - // Set headers for Server-Sent Events - res.setHeader("Content-Type", "text/event-stream"); - res.setHeader("Cache-Control", "no-cache"); - res.setHeader("Connection", "keep-alive"); - - try { - const stream = await openai.beta.chat.completions.stream({ - model: "gpt-3.5-turbo", - messages: chatHistory, - stream: true, - }); - - for await (const chunk of stream) { - const message = chunk.choices[0]?.delta?.content || ""; - res.write(`data: ${JSON.stringify(message)}\n\n`); - } - - // After the stream ends, get the final chat completion - const chatCompletion = await stream.finalChatCompletion(); - } catch (error) { - res.write( - "event: error\ndata: " + - JSON.stringify({ message: "Stream encountered an error" }) + - "\n\n" - ); - } - - // When the client closes the connection, we stop the stream - return new Promise((resolve) => { - req.on("close", () => { - resolve(); - }); - }); - } else { - res.status(404).json({ error: "Not Found" }); - } - break; - default: - res.setHeader("Allow", ["GET", "POST"]); - res.status(405).end(`Method ${method} Not Allowed`); - } -} diff --git a/pages/index.js b/pages/index.js deleted file mode 100644 index 8420ed827..000000000 --- a/pages/index.js +++ /dev/null @@ -1,122 +0,0 @@ -import Head from "next/head"; -import { useState, useEffect, useRef } from "react"; -import styles from "./index.module.css"; - -export default function Home() { - const [message, setMessage] = useState(""); - const [chatHistory, setChatHistory] = useState([ - { role: "system", content: "You are a helpful assistant." }, - ]); - const chatContainerRef = useRef(null); - - useEffect(() => { - // Scroll to the bottom of the chat container whenever chatHistory changes - if (chatContainerRef.current) { - chatContainerRef.current.scrollTop = - chatContainerRef.current.scrollHeight; - } - }, [chatHistory]); - - const sendMessage = async (message) => { - // Append user message to chat history - setChatHistory((prev) => [...prev, { role: "user", content: message }]); - - // Send the user's message to the server - const response = await fetch("/api/generate?endpoint=chat", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ message }), - }); - - const data = await response.json(); - if (data.success) { - // Open a connection to receive streamed responses - const eventSource = new EventSource("/api/generate?endpoint=stream"); - eventSource.onmessage = function (event) { - // Parse the event data, which is a JSON string - const parsedData = JSON.parse(event.data); - - // Check if the last message in the chat history is from the assistant - setChatHistory((prevChatHistory) => { - const newChatHistory = [...prevChatHistory]; - if ( - newChatHistory.length > 0 && - newChatHistory[newChatHistory.length - 1].role === "assistant" - ) { - // If so, append the new chunk to the existing assistant message content - newChatHistory[newChatHistory.length - 1].content += parsedData; - } else { - // Otherwise, add a new assistant message to the chat history - newChatHistory.push({ role: "assistant", content: parsedData }); - } - return newChatHistory; - }); - }; - eventSource.onerror = function () { - eventSource.close(); - }; - } - }; - - const clearChat = async () => { - // Clear the chat history in the client state - setChatHistory([ - { role: "system", content: "You are a helpful assistant." }, - ]); - - // Reset the chat history on the server - await fetch("/api/generate?endpoint=reset", { method: "POST" }); - }; - - const onSubmit = (event) => { - event.preventDefault(); - if (!message.trim()) return; - sendMessage(message.trim()); - setMessage(""); - }; - - return ( -
- - OpenAI Chat - -

OpenAI Chat Completion Quickstart

-
- {chatHistory.map((msg, index) => ( -
- {msg.content} -
- ))} -
-
- - -
- - -
- -
-
- ); -} diff --git a/pages/index.module.css b/pages/index.module.css deleted file mode 100644 index c78043a01..000000000 --- a/pages/index.module.css +++ /dev/null @@ -1,163 +0,0 @@ -@font-face { - font-family: "ColfaxAI"; - src: - url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff2) format("woff2"), - url(https://cdn.openai.com/API/fonts/ColfaxAIRegular.woff) format("woff"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: "ColfaxAI"; - src: - url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff2) format("woff2"), - url(https://cdn.openai.com/API/fonts/ColfaxAIBold.woff) format("woff"); - font-weight: bold; - font-style: normal; -} - -.body, -.input { - font-size: 16px; - line-height: 24px; - color: #353740; - font-family: "ColfaxAI", Helvetica, sans-serif; -} - -.body { - display: flex; - flex-direction: column; - align-items: center; - padding-top: 60px; -} - -.icon { - width: 34px; -} - -.h3 { - font-size: 32px; - line-height: 40px; - font-weight: bold; - color: #202123; - margin: 16px 0 40px; -} - -.chatContainer { - max-width: 600px; - width: 100%; - margin: 0 auto; - padding-top: 20px; - display: flex; - flex-direction: column; - align-items: center; - padding-bottom: 160px; - margin-bottom: 20px; - overflow: auto; -} - -.userMessage, -.assistantMessage { - padding: 12px 16px; - border: 1px solid #10a37f; - border-radius: 4px; - margin-bottom: 8px; - max-width: 80%; - word-wrap: break-word; -} - -.userMessage { - align-self: flex-end; - background-color: #daf8e3; -} - -.assistantMessage { - align-self: flex-start; - background-color: #f1f1f1; -} - -.messageInputContainer { - position: fixed; - bottom: 0; - left: 0; - right: 0; - padding: 20px; - background: #fff; - border-top: 1px solid #eaeaea; - display: flex; - justify-content: center; - height: auto; - padding-bottom: 20px; -} - -.heading1 { - text-align: center; /* Centers text horizontally */ - width: 100%; /* Ensures the heading takes full width of its container */ - margin: 0 auto; /* Applies automatic horizontal margins */ -} - -.form { - max-width: 600px; - width: 100%; - margin: 0 auto; - flex-direction: column; - display: flex; - justify-content: space-between; - align-items: center; -} - -.textarea { - padding: 12px 16px; - border: 1px solid #10a37f; - border-radius: 4px; - margin-bottom: 24px; - width: 100%; - min-height: 50px; - resize: both; - overflow: auto; - margin-right: 4px; - flex: 3; -} - -.buttonGroup { - display: flex; -} - -.inputSubmit, -.inputButton { - padding: 12px 16px; - color: #fff; - background-color: #10a37f; - border: none; - border-radius: 4px; - text-align: center; - cursor: pointer; - flex: 1; - margin: 0 2px; -} - -.inputSubmit { - flex-grow: 4; -} - -.inputButton { - flex-grow: 1; - background-color: #f44336; -} - -.inputText { - padding: 12px 16px; - border: 1px solid #10a37f; - border-radius: 4px; - margin-bottom: 24px; -} - -.placeholder { - color: #8e8ea0; - opacity: 1; -} - -.result { - font-weight: bold; - margin-top: 40px; -} From 68697efecc1cb4011ac6fad4cb1e2c3a94bf74db Mon Sep 17 00:00:00 2001 From: Kevin Whinnery Date: Thu, 23 Jan 2025 10:29:43 -0600 Subject: [PATCH 13/15] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63ebe18be..b32b2a2b5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "license": "ISC", + "license": "MIT", "dependencies": { "openai": "^4.79.2" }, From e51f7b1931cd58e6ac7b199dd39c1b6897b2e245 Mon Sep 17 00:00:00 2001 From: Katia Gil Guzman <152395277+katia-openai@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:35:44 +0000 Subject: [PATCH 14/15] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index baa7ce3bd..0744050a1 100644 --- a/README.md +++ b/README.md @@ -142,11 +142,11 @@ Explore the examples below to learn how to use the Node.js SDK for your specific Batch Create a batch job - batch_processing/index.js + batch_processing/index.js Get batch job results - batch_processing/retrieve_results.js {job-id} + batch_processing/retrieve_results.js {job-id} Images From 6e6e03496440913a82ccba6f17c2f41caa948c58 Mon Sep 17 00:00:00 2001 From: Katia Gil Guzman <152395277+katia-openai@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:36:12 +0000 Subject: [PATCH 15/15] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0744050a1..d12379754 100644 --- a/README.md +++ b/README.md @@ -142,11 +142,11 @@ Explore the examples below to learn how to use the Node.js SDK for your specific Batch Create a batch job - batch_processing/index.js + batch/index.js Get batch job results - batch_processing/retrieve_results.js {job-id} + batch/retrieve_results.js {job-id} Images