From 44c85e6b151abb41b6de6d9d887e0733a379853b Mon Sep 17 00:00:00 2001 From: Hmily <961532186@qq.com> Date: Tue, 28 Nov 2023 14:56:58 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=E4=BF=AE=E5=A4=8DOpenAI=E6=9C=AA=E5=BC=80?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=8A=A5=E9=94=99bug=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEgpt=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot/AI.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/robot/AI.py b/robot/AI.py index 0888e19e..2e28263f 100644 --- a/robot/AI.py +++ b/robot/AI.py @@ -207,6 +207,8 @@ def __init__( if proxy: logger.info(f"{self.SLUG} 使用代理:{proxy}") self.openai.proxy = proxy + else: + self.openai.proxy = None except Exception: logger.critical("OpenAI 初始化失败,请升级 Python 版本至 > 3.6") @@ -243,8 +245,8 @@ def stream_chat(self, texts): "Authorization": "Bearer " + self.openai.api_key, } - data = {"model": "gpt-3.5-turbo", "messages": self.context, "stream": True} - logger.info("开始流式请求") + data = {"model": self.model, "messages": self.context, "stream": True} + logger.info(f"使用模型:{self.model},开始流式请求") url = self.api_base + "/completions" # 请求接收流式数据 try: