diff --git a/bot/chatgpt/chat_gpt_bot.py b/bot/chatgpt/chat_gpt_bot.py index 1898d05..685514f 100644 --- a/bot/chatgpt/chat_gpt_bot.py +++ b/bot/chatgpt/chat_gpt_bot.py @@ -16,7 +16,8 @@ else: class ChatGPTBot(Bot): def __init__(self): openai.api_key = conf().get('open_ai_api_key') - openai.api_base = conf().get('open_ai_api_base') + if conf().get('open_ai_api_base'): + openai.api_base = conf().get('open_ai_api_base') proxy = conf().get('proxy') if proxy: openai.proxy = proxy diff --git a/bot/openai/open_ai_bot.py b/bot/openai/open_ai_bot.py index 1c12989..7822bae 100644 --- a/bot/openai/open_ai_bot.py +++ b/bot/openai/open_ai_bot.py @@ -12,8 +12,11 @@ user_session = dict() class OpenAIBot(Bot): def __init__(self): openai.api_key = conf().get('open_ai_api_key') - openai.api_base = conf().get('open_ai_api_base') - + if conf().get('open_ai_api_base'): + openai.api_base = conf().get('open_ai_api_base') + proxy = conf().get('proxy') + if proxy: + openai.proxy = proxy def reply(self, query, context=None): # acquire reply content diff --git a/config-template.json b/config-template.json index 87fbc00..9ad9f5d 100644 --- a/config-template.json +++ b/config-template.json @@ -1,6 +1,5 @@ { "open_ai_api_key": "YOUR API KEY", - "open_ai_api_base":"", "proxy": "", "single_chat_prefix": ["bot", "@bot"], "single_chat_reply_prefix": "[bot] ",