feat: 更新依赖并兼容已存在的代理

main
ChenZhaoYu 2 years ago
parent 31a84325d4
commit bf48eae9fe

@ -16,6 +16,9 @@ API_REVERSE_PROXY=
# timeout
TIMEOUT_MS=100000
# Rate Limit
MAX_REQUEST_PER_HOUR=
# Secret key
AUTH_SECRET_KEY=
@ -28,5 +31,3 @@ SOCKS_PROXY_PORT=
# HTTPS PROXY
HTTPS_PROXY=
# Rate Limit
MAX_REQUEST_PER_HOUR=

@ -25,7 +25,7 @@
},
"dependencies": {
"axios": "^1.3.4",
"chatgpt": "^5.0.10",
"chatgpt": "^5.1.2",
"dotenv": "^16.0.3",
"esno": "^0.16.3",
"express": "^4.18.2",

@ -5,7 +5,7 @@ specifiers:
'@types/express': ^4.17.17
'@types/node': ^18.14.6
axios: ^1.3.4
chatgpt: ^5.0.10
chatgpt: ^5.1.2
dotenv: ^16.0.3
eslint: ^8.35.0
esno: ^0.16.3
@ -21,7 +21,7 @@ specifiers:
dependencies:
axios: 1.3.4
chatgpt: 5.0.10
chatgpt: 5.1.2
dotenv: 16.0.3
esno: 0.16.3
express: 4.18.2
@ -156,8 +156,8 @@ packages:
chalk: 2.4.2
js-tokens: 4.0.0
/@dqbd/tiktoken/0.4.0:
resolution: {integrity: sha512-iaHgmwKAOqowBFZKxelyszoeGLoNw62eOULcmyme1aA1Ymr3JgYl0V7jwpuUm7fksalycZajx3loFn9TRUaviw==}
/@dqbd/tiktoken/1.0.2:
resolution: {integrity: sha512-AjGTBRWsMoVmVeN55NLyupyM8TNamOUBl6tj5t/leLDVup3CFGO9tVagNL1jf3GyZLkWZSTmYVbPQ/M2LEcNzw==}
dev: false
/@esbuild-kit/cjs-loader/2.4.2:
@ -922,12 +922,12 @@ packages:
resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
dev: true
/chatgpt/5.0.10:
resolution: {integrity: sha512-R3vtPlhCapFLkDXED0Cnt1DBcOZAXygr0M5U5kbSI0Fwm4uDQmc7qoIOnr17rd8eaa0JO/UDOevJdEWvd079qA==}
/chatgpt/5.1.2:
resolution: {integrity: sha512-b/NnDQHDOpouK+gmhUCKcKuvnKEh+DotwXlP6Qgw1mqmkcfVl9Wt3/3noT8jbGJpMEpFOfzexXn5Rehpea1N0w==}
engines: {node: '>=14'}
hasBin: true
dependencies:
'@dqbd/tiktoken': 0.4.0
'@dqbd/tiktoken': 1.0.2
cac: 6.7.14
conf: 11.0.1
eventsource-parser: 0.0.5

@ -35,6 +35,7 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
// More Info: https://github.com/transitive-bullshit/chatgpt-api
if (isNotEmptyString(process.env.OPENAI_API_KEY)) {
const OPENAI_API_BASE_URL = process.env.OPENAI_API_BASE_URL
const OPENAI_API_MODEL = process.env.OPENAI_API_MODEL
const model = isNotEmptyString(OPENAI_API_MODEL) ? OPENAI_API_MODEL : 'gpt-3.5-turbo'
@ -44,8 +45,8 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
debug: true,
}
if (isNotEmptyString(process.env.OPENAI_API_BASE_URL))
options.apiBaseUrl = process.env.OPENAI_API_BASE_URL
if (isNotEmptyString(OPENAI_API_BASE_URL))
options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1`
setupProxy(options)

Loading…
Cancel
Save