fix: 修复初次调用/keyword指令时报错文件不存在的bug
This commit is contained in:
+9
-5
@@ -674,11 +674,15 @@ def oper_msg(message,
|
||||
return
|
||||
command = command_result[2]
|
||||
if command == "keyword":
|
||||
if not os.path.exists("keyword.json"):
|
||||
send_message(platform, message, "出现异常,文件不存在。", msg_ref=msg_ref, session_id=session_id)
|
||||
return
|
||||
with open("keyword.json", "r", encoding="utf-8") as f:
|
||||
keywords = json.load(f)
|
||||
if os.path.exists("keyword.json"):
|
||||
with open("keyword.json", "r", encoding="utf-8") as f:
|
||||
keywords = json.load(f)
|
||||
else:
|
||||
try:
|
||||
send_message(platform, message, command_result[1], msg_ref=msg_ref, session_id=session_id)
|
||||
except BaseException as e:
|
||||
send_message(platform, message, f"回复消息出错: {str(e)}", msg_ref=msg_ref, session_id=session_id)
|
||||
|
||||
# 昵称
|
||||
if command == "nick":
|
||||
nick_qq = cc.get("nick_qq", nick_qq)
|
||||
|
||||
@@ -375,7 +375,7 @@ class Command:
|
||||
3. keyword d hi
|
||||
删除hi关键词的回复
|
||||
4. keyword hi <图片>
|
||||
当发送hi时会回复图片(切记加空格)
|
||||
当发送hi时会回复图片
|
||||
""", "keyword"
|
||||
|
||||
del_mode = False
|
||||
|
||||
@@ -16,6 +16,7 @@ class ProviderOpenAIOfficial(Provider):
|
||||
self.key_list = []
|
||||
if 'api_base' in cfg and cfg['api_base'] != 'none' and cfg['api_base'] != '':
|
||||
openai.api_base = cfg['api_base']
|
||||
print(f"设置apibase为:{openai.api_base}")
|
||||
if cfg['key'] != '' and cfg['key'] != None:
|
||||
self.key_list = cfg['key']
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user