fix: chatgpt now using latest

This commit is contained in:
Danny Avila 2023-03-21 16:32:32 -04:00
parent 30a7a80bfc
commit e531a17e0f
5 changed files with 19 additions and 31 deletions

View file

@ -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

View file

@ -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

42
api/package-lock.json generated
View file

@ -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": {

View file

@ -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",

View file

@ -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