Skip to content

Commit 5d45fdb

Browse files
authored
Fix react errors, max context tokens, and preset mobile view (danny-avila#269)
* fix: react errors * fix: max tokens issue * fix: max tokens issue
1 parent 649a540 commit 5d45fdb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/clients/chatgpt-client.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ const askClient = async ({
2323
};
2424

2525
const azure = process.env.AZURE_OPENAI_API_KEY ? true : false;
26-
const max_tokens = (model === "gpt-4") ? 7200 : (model === "gpt-4-32k") ? 31000 : 3071;
26+
const maxContextTokens = model === 'gpt-4' ? 8191 : model === 'gpt-4-32k' ? 32767 : 4095; // 1 less than maximum
2727
const clientOptions = {
2828
reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null,
2929
azure,
30+
maxContextTokens,
3031
modelOptions: {
31-
model: model,
32-
max_tokens: max_tokens,
32+
model,
3333
temperature,
3434
top_p,
3535
presence_penalty,
@@ -38,22 +38,22 @@ const askClient = async ({
3838
chatGptLabel,
3939
promptPrefix,
4040
proxy: process.env.PROXY || null,
41-
debug: false
41+
// debug: true
4242
};
4343

4444
let apiKey = process.env.OPENAI_KEY;
4545

4646
if (azure) {
4747
apiKey = process.env.AZURE_OPENAI_API_KEY;
48-
clientOptions.reverseProxyUrl = genAzureEndpoint({
49-
azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME,
50-
azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME,
48+
clientOptions.reverseProxyUrl = genAzureEndpoint({
49+
azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME,
50+
azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME,
5151
azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION
5252
});
5353
}
5454

5555
const client = new ChatGPTClient(apiKey, clientOptions, store);
56-
56+
5757
const options = {
5858
onProgress,
5959
abortController,

0 commit comments

Comments
 (0)