diff --git a/cores/qqbot/core.py b/cores/qqbot/core.py index f80048351..68da366aa 100644 --- a/cores/qqbot/core.py +++ b/cores/qqbot/core.py @@ -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) diff --git a/model/command/command.py b/model/command/command.py index 483e7de5f..de5abd5d0 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -375,7 +375,7 @@ class Command: 3. keyword d hi 删除hi关键词的回复 4. keyword hi <图片> -当发送hi时会回复图片(切记加空格) +当发送hi时会回复图片 """, "keyword" del_mode = False diff --git a/model/provider/provider_openai_official.py b/model/provider/provider_openai_official.py index 699666020..6bc20f437 100644 --- a/model/provider/provider_openai_official.py +++ b/model/provider/provider_openai_official.py @@ -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: