Skip to content

Commit bf48eae

Browse files
committed
feat: 更新依赖并兼容已存在的代理
1 parent 31a8432 commit bf48eae

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

service/.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ API_REVERSE_PROXY=
1616
# timeout
1717
TIMEOUT_MS=100000
1818

19+
# Rate Limit
20+
MAX_REQUEST_PER_HOUR=
21+
1922
# Secret key
2023
AUTH_SECRET_KEY=
2124

@@ -28,5 +31,3 @@ SOCKS_PROXY_PORT=
2831
# HTTPS PROXY
2932
HTTPS_PROXY=
3033

31-
# Rate Limit
32-
MAX_REQUEST_PER_HOUR=

service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"dependencies": {
2727
"axios": "^1.3.4",
28-
"chatgpt": "^5.0.10",
28+
"chatgpt": "^5.1.2",
2929
"dotenv": "^16.0.3",
3030
"esno": "^0.16.3",
3131
"express": "^4.18.2",

service/pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

service/src/chatgpt/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
3535
// More Info: https://github.com/transitive-bullshit/chatgpt-api
3636

3737
if (isNotEmptyString(process.env.OPENAI_API_KEY)) {
38+
const OPENAI_API_BASE_URL = process.env.OPENAI_API_BASE_URL
3839
const OPENAI_API_MODEL = process.env.OPENAI_API_MODEL
3940
const model = isNotEmptyString(OPENAI_API_MODEL) ? OPENAI_API_MODEL : 'gpt-3.5-turbo'
4041

@@ -44,8 +45,8 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI
4445
debug: true,
4546
}
4647

47-
if (isNotEmptyString(process.env.OPENAI_API_BASE_URL))
48-
options.apiBaseUrl = process.env.OPENAI_API_BASE_URL
48+
if (isNotEmptyString(OPENAI_API_BASE_URL))
49+
options.apiBaseUrl = `${OPENAI_API_BASE_URL}/v1`
4950

5051
setupProxy(options)
5152

0 commit comments

Comments
 (0)