feat(chatgpt-browser): add support for multiple GPT models

This commit adds support for multiple GPT models in the chatGPT-browser
client. The available models are now stored in a Map object, which maps
the model label to its corresponding model.

The commit adds a new component, ChatGPTOptions, to the client
UI to allow the user to select the GPT model to use in the chat. The
component is only displayed when the chatGPT-browser endpoint is
selected.
This commit is contained in:
Daniel Avila 2023-04-02 14:34:12 -04:00
parent eef2303c8e
commit aa4fd57459
9 changed files with 69 additions and 13 deletions

View file

@ -1,11 +1,11 @@
require('dotenv').config();
const { KeyvFile } = require('keyv-file');
// const set = new Set([
// 'gpt-4',
// 'text-davinci-002-render',
// 'text-davinci-002-render-paid',
// 'text-davinci-002-render-sha'
// ]);
const modelMap = new Map([
['Default (GPT-3.5)', 'text-davinci-002-render-sha'],
['Legacy (GPT-3.5)', 'text-davinci-002-render-paid'],
['GPT-4', 'gpt-4']
]);
const browserClient = async ({
text,
@ -25,7 +25,7 @@ const browserClient = async ({
reverseProxyUrl: 'https://bypass.duti.tech/api/conversation',
// Access token from https://chat.openai.com/api/auth/session
accessToken: process.env.CHATGPT_TOKEN,
model,
model: modelMap.get(model),
// debug: true
proxy: process.env.PROXY || null
};
@ -37,7 +37,7 @@ const browserClient = async ({
options = { ...options, parentMessageId, conversationId };
}
// console.log('gptBrowser options', options, clientOptions);
console.log('gptBrowser clientOptions', clientOptions);
if (parentMessageId === '00000000-0000-0000-0000-000000000000') {
delete options.conversationId;