feat: 当用gpt-4的API 时增加可用的 Max Tokens (#729)

* fix: 用GPT-4 API时增加max token

* style: eslint fix

---------

Co-authored-by: Redon <790348264@qq.com>
main
吴杉(Shan Wu) 2 years ago committed by GitHub
parent bf48eae9fe
commit 3e509f6663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,6 +45,19 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
debug: true, debug: true,
} }
// increase max token limit if use gpt-4
if (model.toLowerCase().includes('gpt-4')) {
// if use 32k model
if (model.toLowerCase().includes('32k')) {
options.maxModelTokens = 32768
options.maxResponseTokens = 8192
}
else {
options.maxModelTokens = 8192
options.maxResponseTokens = 2048
}
}
if (isNotEmptyString(OPENAI_API_BASE_URL)) if (isNotEmptyString(OPENAI_API_BASE_URL))
options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1` options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1`

Loading…
Cancel
Save