fix: 超额切换时未修改openai库的api_key

This commit is contained in:
Rock Chin 2022-12-19 22:52:52 +08:00
parent b1d40b1628
commit 20aebd6d30

View File

@ -225,6 +225,7 @@ class QQBotManager:
self.notify_admin("API调用额度超限,请向OpenAI账户充值或在config.py中更换api_key")
reply = "[bot]err:API调用额度超额请联系作者或等待修复"
else:
openai.api_key = pkg.openai.manager.get_inst().key_mgr.get_using_key()
self.notify_admin("API调用额度超限,已切换到{}".format(name))
reply = "[bot]err:API调用额度超额已自动切换请重新发送消息"
except openai.error.InvalidRequestError as e: