Ver código fonte

docs: update README.md

zhayujie 3 anos atrás
pai
commit
44e5979a03
2 arquivos alterados com 4 adições e 1 exclusões
  1. 3 1
      bot/chatgpt/chat_gpt_bot.py
  2. 1 0
      config-template.json

+ 3 - 1
bot/chatgpt/chat_gpt_bot.py

@@ -16,7 +16,9 @@ else:
 class ChatGPTBot(Bot):
     def __init__(self):
         openai.api_key = conf().get('open_ai_api_key')
-        openai.proxy = conf().get('proxy')
+        proxy = conf().get('proxy')
+        if proxy:
+            openai.proxy = proxy
 
     def reply(self, query, context=None):
         # acquire reply content

+ 1 - 0
config-template.json

@@ -1,5 +1,6 @@
 {
   "open_ai_api_key": "YOUR API KEY",
+  "proxy": "",
   "single_chat_prefix": ["bot", "@bot"],
   "single_chat_reply_prefix": "[bot] ",
   "group_chat_prefix": ["@bot"],