mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
fix(qqbot): 超额误判问题 (#106)
This commit is contained in:
parent
057d8a05d7
commit
99282100a0
|
@ -262,8 +262,8 @@ class QQBotManager:
|
||||||
except FunctionTimedOut:
|
except FunctionTimedOut:
|
||||||
logging.warning("group_{}: 超时,重试中({})".format(event.group.id, i))
|
logging.warning("group_{}: 超时,重试中({})".format(event.group.id, i))
|
||||||
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
||||||
if "group_{}".format(event.sender.id) in pkg.qqbot.process.processing:
|
if "group_{}".format(event.group.id) in pkg.qqbot.process.processing:
|
||||||
pkg.qqbot.process.processing.remove('group_{}'.format(event.sender.id))
|
pkg.qqbot.process.processing.remove('group_{}'.format(event.group.id))
|
||||||
failed += 1
|
failed += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@ def process_normal_message(text_message: str, mgr, config, launcher_type: str,
|
||||||
reply = ["[bot]err:调用API失败,请重试或联系作者,或等待修复"]
|
reply = ["[bot]err:调用API失败,请重试或联系作者,或等待修复"]
|
||||||
except openai.error.RateLimitError as e:
|
except openai.error.RateLimitError as e:
|
||||||
logging.debug(type(e))
|
logging.debug(type(e))
|
||||||
|
logging.debug(e.error['message'])
|
||||||
|
|
||||||
|
if 'message' in e.error and e.error['message'].__contains__('You exceeded your current quota'):
|
||||||
# 尝试切换api-key
|
# 尝试切换api-key
|
||||||
current_key_name = pkg.utils.context.get_openai_manager().key_mgr.get_key_name(
|
current_key_name = pkg.utils.context.get_openai_manager().key_mgr.get_key_name(
|
||||||
pkg.utils.context.get_openai_manager().key_mgr.using_key
|
pkg.utils.context.get_openai_manager().key_mgr.using_key
|
||||||
|
@ -76,6 +79,9 @@ def process_normal_message(text_message: str, mgr, config, launcher_type: str,
|
||||||
mgr.notify_admin("api-key调用额度超限({}),接口报错,已切换到{}".format(current_key_name, name))
|
mgr.notify_admin("api-key调用额度超限({}),接口报错,已切换到{}".format(current_key_name, name))
|
||||||
reply = ["[bot]err:API调用额度超额,已自动切换,请重新发送消息"]
|
reply = ["[bot]err:API调用额度超额,已自动切换,请重新发送消息"]
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
mgr.notify_admin("{}会话调用API失败:{}".format(session_name, e))
|
||||||
|
reply = ["[bot]err:RateLimitError,请重试或联系作者,或等待修复"]
|
||||||
except openai.error.InvalidRequestError as e:
|
except openai.error.InvalidRequestError as e:
|
||||||
mgr.notify_admin("{}API调用参数错误:{}\n\n这可能是由于config.py中的prompt_submit_length参数或"
|
mgr.notify_admin("{}API调用参数错误:{}\n\n这可能是由于config.py中的prompt_submit_length参数或"
|
||||||
"completion_api_params中的max_tokens参数数值过大导致的,请尝试将其降低".format(
|
"completion_api_params中的max_tokens参数数值过大导致的,请尝试将其降低".format(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user