Browse Source

fix: openai_base_url load

master
zhayujie 1 year ago
parent
commit
224ee6bd89
3 changed files with 7 additions and 4 deletions
  1. +2
    -1
      bot/chatgpt/chat_gpt_bot.py
  2. +5
    -2
      bot/openai/open_ai_bot.py
  3. +0
    -1
      config-template.json

+ 2
- 1
bot/chatgpt/chat_gpt_bot.py View File

@@ -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


+ 5
- 2
bot/openai/open_ai_bot.py View File

@@ -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


+ 0
- 1
config-template.json View File

@@ -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] ",


Loading…
Cancel
Save