From 47c675f999d5a75176494c15db5e0f14439f5e3e Mon Sep 17 00:00:00 2001 From: alin <823301694@qq.com> Date: Fri, 3 Mar 2023 15:23:14 +0800 Subject: [PATCH] feat:add proxy option --- bot/chatgpt/chat_gpt_bot.py | 1 + config-template.json | 1 + 2 files changed, 2 insertions(+) diff --git a/bot/chatgpt/chat_gpt_bot.py b/bot/chatgpt/chat_gpt_bot.py index 1c08949..23ba367 100644 --- a/bot/chatgpt/chat_gpt_bot.py +++ b/bot/chatgpt/chat_gpt_bot.py @@ -12,6 +12,7 @@ user_session = dict() class ChatGPTBot(Bot): def __init__(self): openai.api_key = conf().get('open_ai_api_key') + openai.proxy = conf().get('proxy') def reply(self, query, context=None): # acquire reply content diff --git a/config-template.json b/config-template.json index bafb557..1e1dae5 100644 --- a/config-template.json +++ b/config-template.json @@ -1,5 +1,6 @@ { "open_ai_api_key": "YOUR API KEY", + "proxy": "http://127.0.0.1:10801", "wechaty_puppet_service_token": "WECHATY PUPPET SERVICE TOKEN", "single_chat_prefix": ["bot", "@bot"], "single_chat_reply_prefix": "[bot] ",