[mirotalk] - #170 add basePath in OpenAiApi
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user