diff --git a/api/app/clients/bingai.js b/api/app/clients/bingai.js index 2e7f80e0b0..dcf150d1cf 100644 --- a/api/app/clients/bingai.js +++ b/api/app/clients/bingai.js @@ -2,7 +2,7 @@ require('dotenv').config(); const { KeyvFile } = require('keyv-file'); const askBing = async ({ text, onProgress, convo }) => { - const { BingAIClient } = (await import('chatgpt-latest')); + const { BingAIClient } = (await import('@waylaidwanderer/chatgpt-api')); const bingAIClient = new BingAIClient({ // "_U" cookie from bing.com diff --git a/api/app/clients/sydney.js b/api/app/clients/sydney.js index 2ecc064378..3466f71c17 100644 --- a/api/app/clients/sydney.js +++ b/api/app/clients/sydney.js @@ -2,7 +2,7 @@ require('dotenv').config(); const { KeyvFile } = require('keyv-file'); const askSydney = async ({ text, onProgress, convo }) => { - const { BingAIClient } = (await import('chatgpt-latest')); + const { BingAIClient } = (await import('@waylaidwanderer/chatgpt-api')); const sydneyClient = new BingAIClient({ // "_U" cookie from bing.com diff --git a/api/package-lock.json b/api/package-lock.json index e1cb445663..362103a426 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@keyv/mongo": "^2.1.8", "@vscode/vscode-languagedetection": "^1.0.22", - "@waylaidwanderer/chatgpt-api": "^1.28.2", + "@waylaidwanderer/chatgpt-api": "^1.31.6", "axios": "^1.3.4", "chatgpt-latest": "npm:@waylaidwanderer/chatgpt-api@^1.31.6", "cors": "^2.8.5", @@ -1424,9 +1424,9 @@ "optional": true }, "node_modules/@dqbd/tiktoken": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-0.4.0.tgz", - "integrity": "sha512-iaHgmwKAOqowBFZKxelyszoeGLoNw62eOULcmyme1aA1Ymr3JgYl0V7jwpuUm7fksalycZajx3loFn9TRUaviw==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-1.0.2.tgz", + "integrity": "sha512-AjGTBRWsMoVmVeN55NLyupyM8TNamOUBl6tj5t/leLDVup3CFGO9tVagNL1jf3GyZLkWZSTmYVbPQ/M2LEcNzw==" }, "node_modules/@eslint-community/eslint-utils": { "version": "4.3.0", @@ -1653,11 +1653,11 @@ } }, "node_modules/@waylaidwanderer/chatgpt-api": { - "version": "1.28.2", - "resolved": "https://registry.npmjs.org/@waylaidwanderer/chatgpt-api/-/chatgpt-api-1.28.2.tgz", - "integrity": "sha512-efNvZr8uosiYD69zFq50OPM36s+tyRMixlHpwDzn2q9UuZrdHC++kmm23OAnDxv3/+vA4UwCsZXn+92c35NHBQ==", + "version": "1.31.6", + "resolved": "https://registry.npmjs.org/@waylaidwanderer/chatgpt-api/-/chatgpt-api-1.31.6.tgz", + "integrity": "sha512-Db6UK1FRvaUWbFRb6Lg8xnvjkSKjjt4iKYRKPvGNL8LdAiR9Th9e5rLVGHIbGeVBgWWiWH54ei3lQO+oGX9A6w==", "dependencies": { - "@dqbd/tiktoken": "^0.4.0", + "@dqbd/tiktoken": "^1.0.2", "@fastify/cors": "^8.2.0", "@waylaidwanderer/fastify-sse-v2": "^3.1.0", "@waylaidwanderer/fetch-event-source": "^3.0.1", @@ -2257,11 +2257,6 @@ "chatgpt-cli": "bin/cli.js" } }, - "node_modules/chatgpt-latest/node_modules/@dqbd/tiktoken": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-1.0.2.tgz", - "integrity": "sha512-AjGTBRWsMoVmVeN55NLyupyM8TNamOUBl6tj5t/leLDVup3CFGO9tVagNL1jf3GyZLkWZSTmYVbPQ/M2LEcNzw==" - }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -7079,9 +7074,9 @@ } }, "@dqbd/tiktoken": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-0.4.0.tgz", - "integrity": "sha512-iaHgmwKAOqowBFZKxelyszoeGLoNw62eOULcmyme1aA1Ymr3JgYl0V7jwpuUm7fksalycZajx3loFn9TRUaviw==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-1.0.2.tgz", + "integrity": "sha512-AjGTBRWsMoVmVeN55NLyupyM8TNamOUBl6tj5t/leLDVup3CFGO9tVagNL1jf3GyZLkWZSTmYVbPQ/M2LEcNzw==" }, "@eslint-community/eslint-utils": { "version": "4.3.0", @@ -7266,11 +7261,11 @@ "integrity": "sha512-rQ/BgMyLuIXSmbA0MSkIPHtcOw14QkeDbAq19sjvaS9LTRr905yij0S8lsyqN5JgOsbtIx7pAcyOxFMzPmqhZQ==" }, "@waylaidwanderer/chatgpt-api": { - "version": "1.28.2", - "resolved": "https://registry.npmjs.org/@waylaidwanderer/chatgpt-api/-/chatgpt-api-1.28.2.tgz", - "integrity": "sha512-efNvZr8uosiYD69zFq50OPM36s+tyRMixlHpwDzn2q9UuZrdHC++kmm23OAnDxv3/+vA4UwCsZXn+92c35NHBQ==", + "version": "1.31.6", + "resolved": "https://registry.npmjs.org/@waylaidwanderer/chatgpt-api/-/chatgpt-api-1.31.6.tgz", + "integrity": "sha512-Db6UK1FRvaUWbFRb6Lg8xnvjkSKjjt4iKYRKPvGNL8LdAiR9Th9e5rLVGHIbGeVBgWWiWH54ei3lQO+oGX9A6w==", "requires": { - "@dqbd/tiktoken": "^0.4.0", + "@dqbd/tiktoken": "^1.0.2", "@fastify/cors": "^8.2.0", "@waylaidwanderer/fastify-sse-v2": "^3.1.0", "@waylaidwanderer/fetch-event-source": "^3.0.1", @@ -7694,13 +7689,6 @@ "ora": "^6.1.2", "undici": "^5.20.0", "ws": "^8.12.0" - }, - "dependencies": { - "@dqbd/tiktoken": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@dqbd/tiktoken/-/tiktoken-1.0.2.tgz", - "integrity": "sha512-AjGTBRWsMoVmVeN55NLyupyM8TNamOUBl6tj5t/leLDVup3CFGO9tVagNL1jf3GyZLkWZSTmYVbPQ/M2LEcNzw==" - } } }, "chokidar": { diff --git a/api/package.json b/api/package.json index 6350b19d09..44e44e9b19 100644 --- a/api/package.json +++ b/api/package.json @@ -21,7 +21,7 @@ "dependencies": { "@keyv/mongo": "^2.1.8", "@vscode/vscode-languagedetection": "^1.0.22", - "@waylaidwanderer/chatgpt-api": "^1.28.2", + "@waylaidwanderer/chatgpt-api": "^1.31.6", "axios": "^1.3.4", "chatgpt-latest": "npm:@waylaidwanderer/chatgpt-api@^1.31.6", "cors": "^2.8.5", diff --git a/api/server/routes/ask.js b/api/server/routes/ask.js index 454d51c1cc..de80af099f 100644 --- a/api/server/routes/ask.js +++ b/api/server/routes/ask.js @@ -118,9 +118,9 @@ const ask = async ({ }); console.log('CLIENT RESPONSE', gptResponse); + gptResponse.text = gptResponse.response; if (!gptResponse.parentMessageId) { - gptResponse.text = gptResponse.response; // gptResponse.id = gptResponse.messageId; gptResponse.parentMessageId = overrideParentMessageId || userMessageId; // userMessage.conversationId = conversationId