From 2ccec2596d571c6b1463b4b5a2f47a91bc13622a Mon Sep 17 00:00:00 2001 From: Sad Date: Sun, 17 Sep 2023 02:14:28 +0800 Subject: [PATCH] fix openai --- package.json | 2 +- roll/openai.js | 68 +++++++++++++++------------ yarn.lock | 121 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 142 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index ba9c7e5e..4a542f27 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "mongoose": "^6", "node-schedule": "^2.1.0", "node-telegram-bot-api": "^0.61.0", - "openai": "^3.2.1", + "openai": "^4.7.1", "plurk2": "github:zeteticl/node-plurk2", "puppeteer": "^13.3.1", "qrcode-terminal": "^0.12.0", diff --git a/roll/openai.js b/roll/openai.js index 51238d75..8222dd0b 100644 --- a/roll/openai.js +++ b/roll/openai.js @@ -1,7 +1,7 @@ "use strict"; if (!process.env.OPENAI_SWITCH) return; -const { Configuration, OpenAIApi } = require('openai'); +const OpenAIApi = require('openai'); const dotenv = require('dotenv'); dotenv.config({ override: true }); const fetch = require('node-fetch'); @@ -109,10 +109,10 @@ class OpenAI { this.apiKeys = []; this.addApiKey(); this.watchEnvironment(); - this.configuration = new Configuration({ - apiKey: this.apiKeys[0]?.key, - basePath: this.apiKeys[0]?.basePath, - }); + this.configuration = { + apiKey: this.apiKeys[0]?.apiKey, + baseURL: this.apiKeys[0]?.baseURL, + }; this.model = process.env.OPENAI_MODEL || "gpt-4"; this.openai = new OpenAIApi(this.configuration); this.currentApiKeyIndex = 0; @@ -120,13 +120,13 @@ class OpenAI { } addApiKey() { this.apiKeys = []; - let base = -1; + let base = 0; for (let index = 1; index < 100; index++) { if (index % 10 === 0) base++; if (!process.env[`OPENAI_SECRET_${index}`]) continue; this.apiKeys.push({ - key: process.env[`OPENAI_SECRET_${index}`], - basePath: process.env[`OPENAI_BASEPATH_${base}1_${base + 1}0`] + apiKey: process.env[`OPENAI_SECRET_${index}`], + baseURL: process.env[`OPENAI_BASEPATH_${base}1_${base + 1}0`] || process.env.OPENAI_BASEPATH || 'https://api.openai.com/v1' }); @@ -141,26 +141,26 @@ class OpenAI { this.currentApiKeyIndex = 0; this.errorCount = 0; this.addApiKey(); - this.openai = new OpenAIApi(new Configuration({ - apiKey: this.apiKeys[0]?.key, - basePath: this.apiKeys[0]?.basePath, - })); + this.openai = new OpenAIApi({ + apiKey: this.apiKeys[0]?.apiKey, + baseURL: this.apiKeys[0]?.baseURL, + }); } }); } handleError(error) { this.errorCount++; - if (error.response?.status === 401) { + if (error.status === 401) { console.error('remove api key 401', this.apiKeys[this.currentApiKeyIndex]) this.apiKeys.splice(this.currentApiKeyIndex, 1); this.currentApiKeyIndex--; this.errorCount--; } this.currentApiKeyIndex = (this.currentApiKeyIndex + 1) % this.apiKeys.length; - this.openai = new OpenAIApi(new Configuration({ - apiKey: this.apiKeys[this.currentApiKeyIndex].key, - basePath: this.apiKeys[this.currentApiKeyIndex].basePath, - })); + this.openai = new OpenAIApi({ + apiKey: this.apiKeys[this.currentApiKeyIndex].apiKey, + baseURL: this.apiKeys[this.currentApiKeyIndex].baseURL, + }); } wait(minutes = 1) { return new Promise(resolve => { @@ -178,7 +178,7 @@ class ImageAi extends OpenAI { async handleImageAi(inputStr) { let input = inputStr.replace(/^\.aimage/i, ''); try { - let response = await this.openai.createImage({ + let response = await this.openai.images.generate({ "prompt": `${input}`, "n": 1, "size": "1024x1024" @@ -194,8 +194,11 @@ class ImageAi extends OpenAI { return await this.handleImageAi(inputStr); } else { this.errorCount = 0; - console.error('AI error', error.response?.status, error.response?.statusText) - return 'AI error', error.response?.status + error.response?.statusText + ` ${inputStr.replace(/^\.aimage/i, '')}`; + if (error instanceof OpenAIApi.APIError) { + return 'AI error: ', error.status + `.\n ${inputStr.replace(/^\.aimage/i, '')}`; + } else { + return 'AI error ', `.\n ${inputStr.replace(/^\.aimage/i, '')}`; + } } } } @@ -263,7 +266,7 @@ class TranslateAi extends OpenAI { } async translateChat(inputStr) { try { - let response = await this.openai.createChatCompletion({ + let response = await this.openai.chat.completions.create({ "model": this.model, "max_tokens": 2100, "messages": [ @@ -292,18 +295,21 @@ class TranslateAi extends OpenAI { const mergedContent = contents.join(''); return mergedContent; } - return response?.data?.choices[0]?.message?.content; + return response.choices[0].message.content; } catch (error) { if (this.errorCount < (this.apiKeys.length * 5)) { - if (((this.errorCount !== 0) && this.errorCount % this.apiKeys.length) === 0) { + if (((this.errorCount !== 0) && this.errorCount % thisiKeys.length) === 0) { await super.wait(2); } await super.handleError(error); return await this.translateChat(inputStr); } else { this.errorCount = 0; - console.error('AI error', error.response?.status, error.response?.statusText) - return 'AI error', error.response?.status + error.response?.statusText + ` ${inputStr.replace(/^\.ait/i, '')}`; + if (error instanceof OpenAIApi.APIError) { + return 'AI error: ', error.status + `.\n ${inputStr.replace(/^\.ai/i, '')}`; + } else { + return 'AI error ', `.\n ${inputStr.replace(/^\.ai/i, '')}`; + } } } } @@ -367,7 +373,7 @@ class ChatAi extends OpenAI { } async handleChatAi(inputStr) { try { - let response = await this.openai.createChatCompletion({ + let response = await this.openai.chat.completions.create({ "model": this.model, "max_tokens": 3100, "messages": [ @@ -395,15 +401,19 @@ class ChatAi extends OpenAI { const mergedContent = contents.join(''); return mergedContent; } - return response?.data?.choices[0]?.message?.content; + return response.choices[0].message.content; } catch (error) { if (this.errorCount < (this.apiKeys.length * 5)) { await super.handleError(error); return await this.handleChatAi(inputStr); } else { this.errorCount = 0; - console.error('AI error', error.response?.status, error.response?.statusText) - return 'AI error', error.response?.status + error.response?.statusText + ` ${inputStr.replace(/^\.ai/i, '')}`; + if (error instanceof OpenAIApi.APIError) { + return 'AI error: ', error.status + `.\n ${inputStr.replace(/^\.ai/i, '')}`; + } else { + return 'AI error ', `.\n ${inputStr.replace(/^\.ai/i, '')}`; + } + } } } diff --git a/yarn.lock b/yarn.lock index 7420ced6..401a9fe3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2012,6 +2012,14 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b" integrity sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g== +"@types/node-fetch@^2.6.4": + version "2.6.5" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.5.tgz#972756a9a0fe354b2886bf3defe667ddb4f0d30a" + integrity sha512-OZsUlr2nxvkqUFLSaY2ZbA+P1q22q+KrlxWOn/38RX+u5kTkYL2mTujEpzUhGkS+K/QCYp9oagfXG39XOzyySg== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + "@types/node@*": version "20.5.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.7.tgz#4b8ecac87fbefbc92f431d09c30e176fc0a7c377" @@ -2037,6 +2045,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.40.tgz#968d64746d20cac747a18ca982c0f1fe518c031c" integrity sha512-+yno3ItTEwGxXiS/75Q/aHaa5srkpnJaH+kdkTVJ3DtJEwv92itpKbxU+FjPoh2m/5G9zmUQfrL4A4C13c+iGA== +"@types/node@^18.11.18": + version "18.17.16" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.16.tgz#ee7b103d102787fb1530bfc6d4a1e15014f10938" + integrity sha512-e0zgs7qe1XH/X3KEPnldfkD07LH9O1B9T31U8qoO7lqGSjj3/IrBuvqMeJ1aYejXRK3KOphIUDw6pLIplEW17A== + "@types/prettier@^2.1.5": version "2.7.3" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" @@ -2156,6 +2169,13 @@ dependencies: axios "^0.21.1" +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@~1.3.4, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -2198,6 +2218,13 @@ agent-base@6: dependencies: debug "4" +agentkeepalive@^4.2.1: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -2422,13 +2449,6 @@ axios@^0.25.0: dependencies: follow-redirects "^1.14.7" -axios@^0.26.0: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - axios@^0.27.0: version "0.27.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" @@ -2507,6 +2527,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base-64@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" + integrity sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA== + base64-arraybuffer@0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz#9818c79e059b1355f97e0428a017c838e90ba812" @@ -2855,7 +2880,7 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -"charenc@>= 0.0.1": +charenc@0.0.2, "charenc@>= 0.0.1": version "0.0.2" resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== @@ -3179,7 +3204,7 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -"crypt@>= 0.0.1": +crypt@0.0.2, "crypt@>= 0.0.1": version "0.0.2" resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow== @@ -3358,6 +3383,14 @@ diff-sequences@^28.1.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== +digest-fetch@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/digest-fetch/-/digest-fetch-1.3.0.tgz#898e69264d00012a23cf26e8a3e40320143fc661" + integrity sha512-CGJuv6iKNM7QyZlM2T3sPAdZWd/p9zQiRNS9G+9COUCwzWFTs0Xp8NF5iePx7wtvhDykReiRRrSeNb4oMmB8lA== + dependencies: + base-64 "^0.1.0" + md5 "^2.3.0" + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -3821,6 +3854,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + eventemitter3@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" @@ -4099,7 +4137,7 @@ fn.name@1.x.x: resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== -follow-redirects@^1.14.0, follow-redirects@^1.14.7, follow-redirects@^1.14.8, follow-redirects@^1.14.9: +follow-redirects@^1.14.0, follow-redirects@^1.14.7, follow-redirects@^1.14.9: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -4116,6 +4154,11 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== +form-data-encoder@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" + integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== + form-data@^2.5.0: version "2.5.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" @@ -4143,6 +4186,14 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +formdata-node@^4.3.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2" + integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ== + dependencies: + node-domexception "1.0.0" + web-streams-polyfill "4.0.0-beta.3" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -4595,6 +4646,13 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + hyntax@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/hyntax/-/hyntax-1.1.9.tgz#7fd69747d534dd87e342e1249d60175d93676a39" @@ -4747,7 +4805,7 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-buffer@^1.0.2: +is-buffer@^1.0.2, is-buffer@~1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== @@ -5712,6 +5770,15 @@ mathjs@^9.3.0: tiny-emitter "^2.1.0" typed-function "^2.0.0" +md5@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" + integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g== + dependencies: + charenc "0.0.2" + crypt "0.0.2" + is-buffer "~1.1.6" + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -5892,7 +5959,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1, ms@^2.1.3: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -5952,6 +6019,11 @@ node-bitmap@0.0.1: resolved "https://registry.yarnpkg.com/node-bitmap/-/node-bitmap-0.0.1.tgz#180eac7003e0c707618ef31368f62f84b2a69091" integrity sha512-Jx5lPaaLdIaOsj2mVLWMWulXF6GQVdyLvNSxmiYCvZ8Ma2hfKX0POoR2kgKOqz+oFsRreq0yYZjQ2wjE9VNzCA== +node-domexception@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + node-fetch@2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -6102,13 +6174,19 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" -openai@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/openai/-/openai-3.3.0.tgz#a6408016ad0945738e1febf43f2fccca83a3f532" - integrity sha512-uqxI/Au+aPRnsaQRe8CojU0eCR7I0mBiKjD3sNMzY6DaC1ZVrc85u98mtJW6voDug8fgGN+DIZmTDxTthxb7dQ== - dependencies: - axios "^0.26.0" - form-data "^4.0.0" +openai@^4.7.1: + version "4.7.1" + resolved "https://registry.yarnpkg.com/openai/-/openai-4.7.1.tgz#dbc13f5e830365f8e927026acc5cf68255e57909" + integrity sha512-4Um9A4aLGzZxyENyway0zVgi69BOxaqXmjOCKp3PUteOvSn9TeVf6IjkaNY8k/LXYG5l2e7PpacOl2sxsrTc/w== + 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" optionator@^0.9.1: version "0.9.3" @@ -7767,6 +7845,11 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" +web-streams-polyfill@4.0.0-beta.3: + version "4.0.0-beta.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38" + integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"