Fix react errors, max context tokens, and preset mobile view (#269)

* fix: react errors

* fix: max tokens issue

* fix: max tokens issue
This commit is contained in:
Danny Avila 2023-05-14 17:26:21 -04:00 committed by GitHub
parent 262b402606
commit 6049c9e3ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 33 deletions

View file

@ -23,13 +23,13 @@ const askClient = async ({
};
const azure = process.env.AZURE_OPENAI_API_KEY ? true : false;
const max_tokens = (model === "gpt-4") ? 7200 : (model === "gpt-4-32k") ? 31000 : 3071;
const maxContextTokens = model === 'gpt-4' ? 8191 : model === 'gpt-4-32k' ? 32767 : 4095; // 1 less than maximum
const clientOptions = {
reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null,
azure,
maxContextTokens,
modelOptions: {
model: model,
max_tokens: max_tokens,
model,
temperature,
top_p,
presence_penalty,
@ -38,22 +38,22 @@ const askClient = async ({
chatGptLabel,
promptPrefix,
proxy: process.env.PROXY || null,
debug: false
// debug: true
};
let apiKey = process.env.OPENAI_KEY;
if (azure) {
apiKey = process.env.AZURE_OPENAI_API_KEY;
clientOptions.reverseProxyUrl = genAzureEndpoint({
azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME,
azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME,
clientOptions.reverseProxyUrl = genAzureEndpoint({
azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME,
azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME,
azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION
});
}
const client = new ChatGPTClient(apiKey, clientOptions, store);
const options = {
onProgress,
abortController,