瀏覽代碼

fix: openai_base_url load

master
zhayujie 1 年之前
父節點
當前提交
224ee6bd89
共有 3 個文件被更改,包括 7 次插入4 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存