From c2b25a84c709034bb6356889b84a3ce845687f94 Mon Sep 17 00:00:00 2001 From: ChenZhaoYu <790348264@qq.com> Date: Mon, 3 Apr 2023 09:19:12 +0800 Subject: [PATCH] chore: default API_REVERSE_PROXY --- service/.env.example | 2 +- service/src/chatgpt/index.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/service/.env.example b/service/.env.example index e6c8363..f662176 100644 --- a/service/.env.example +++ b/service/.env.example @@ -16,7 +16,7 @@ OPENAI_API_DISABLE_DEBUG= # Reverse Proxy - Available on accessToken # Default: https://bypass.churchless.tech/api/conversation # More: https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy -API_REVERSE_PROXY=https://bypass.churchless.tech/api/conversation +API_REVERSE_PROXY= # timeout TIMEOUT_MS=100000 diff --git a/service/src/chatgpt/index.ts b/service/src/chatgpt/index.ts index c96467b..7e28ab1 100644 --- a/service/src/chatgpt/index.ts +++ b/service/src/chatgpt/index.ts @@ -75,11 +75,13 @@ let api: ChatGPTAPI | ChatGPTUnofficialProxyAPI accessToken: process.env.OPENAI_ACCESS_TOKEN, debug: !disableDebug, } + if (isNotEmptyString(OPENAI_API_MODEL)) options.model = OPENAI_API_MODEL - if (isNotEmptyString(process.env.API_REVERSE_PROXY)) - options.apiReverseProxyUrl = process.env.API_REVERSE_PROXY + options.apiReverseProxyUrl = isNotEmptyString(process.env.API_REVERSE_PROXY) + ? process.env.API_REVERSE_PROXY + : 'https://bypass.churchless.tech/api/conversation' setupProxy(options)