diff --git a/.env.template b/.env.template index a7ebb08a..0064adb2 100644 --- a/.env.template +++ b/.env.template @@ -82,6 +82,7 @@ SLACK_SIGNING_SECRET=YourSlackSigningSecret # 3. Generate your APIKey https://platform.openai.com/account/api-keys CHATGPT_ENABLED=false +CHATGPT_BASE_PATH=https://api.openai.com/v1/ CHATGTP_APIKEY=YourOpenAiApiKey CHATGPT_MODEL=text-davinci-003 CHATGPT_MAX_TOKENS=1000 diff --git a/app/src/server.js b/app/src/server.js index 8351d3f9..99d1a3b7 100755 --- a/app/src/server.js +++ b/app/src/server.js @@ -176,6 +176,7 @@ if (sentryEnabled) { let chatGPT; const configChatGPT = { enabled: getEnvBoolean(process.env.CHATGPT_ENABLED), + basePath: process.env.CHATGPT_BASE_PATH, apiKey: process.env.CHATGTP_APIKEY, model: process.env.CHATGTP_MODEL, max_tokens: parseInt(process.env.CHATGPT_MAX_TOKENS), @@ -185,6 +186,7 @@ if (configChatGPT.enabled) { if (configChatGPT.apiKey) { const { Configuration, OpenAIApi } = require('openai'); const configuration = new Configuration({ + basePath: configChatGPT.basePath, apiKey: configChatGPT.apiKey, }); chatGPT = new OpenAIApi(configuration);