Skip to content

Commit

Permalink
Merge pull request #299 from ihmily/main
Browse files Browse the repository at this point in the history
Fix:修复OpenAI未开代理报错bug以及设置gpt模型
  • Loading branch information
wzpan authored Jan 2, 2024
2 parents abe2681 + 44c85e6 commit 8607167
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions robot/AI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8607167

Please sign in to comment.