From 9838e00fdf016a9e99b63df424c2bed25533269d Mon Sep 17 00:00:00 2001 From: nek0us <1130131059@qq.com> Date: Sat, 15 Jun 2024 16:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ nonebot_plugin_gpt/api.py | 11 ++++++++--- pyproject.toml | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fc0dba7..22f3a38 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,11 @@ C:\Users\UserName\AppData\Local\nonebot2\nonebot_plugin_gpt\\{bot_name\} ``` ### 更新日志 +2024.06.15 0.0.30 +1. 优化google登录缓存 +2. 优化白名单列表,新增部分plus白名单单独显示,提示两种白名单模式独立运作 + + 2024.06.11 0.0.29 1. 修复openai新cookie跨域问题 2. 修复google登录问题 diff --git a/nonebot_plugin_gpt/api.py b/nonebot_plugin_gpt/api.py index ce06bcd..f68303d 100644 --- a/nonebot_plugin_gpt/api.py +++ b/nonebot_plugin_gpt/api.py @@ -618,6 +618,7 @@ async def white_list(): cdk_source = json.loads(cdksource.read_text()) combined_dict = {cdk_list[key]: cdk_source[key] for key in cdk_list if key in cdk_source} plus_status_tmp = json.loads(plusstatus.read_text()) + all_white_ids = {id for ids in white_tmp.values() for id in ids} msg = "\n|类型|账号|plus|\n|:------:|:------:|:------:|\n" for x in white_tmp: for id in white_tmp[x]: @@ -631,15 +632,19 @@ async def white_list(): msg += f"|{x}|{str(id)}|plus|\n" else: msg += f"|{x}|{str(id)}| |\n" + for id in plus_status_tmp: + if id not in all_white_ids and id != 'status': + msg += f"|unknown|{str(id)}|only plus|\n" event = current_event.get() white_list_img = await md_to_pic(msg, width=650) + text = f"当前 3.5 白名单状态:{'开启' if config_gpt.gpt_white_list_mode else '关闭'}\n当前 plus 白名单状态:{'开启' if config_gpt.gptplus_white_list_mode else '关闭'}\n注意:两种白名单模式独立生效" if isinstance(event,QQGroupAtMessageCreateEvent): #qq适配器的QQ群,暂不支持直接发送图片 (x 现在能发了) - await matcher.finish(QQMessageSegment.file_image(b64encode(white_list_img).decode('utf-8'))) # type: ignore + await matcher.finish(QQMessageSegment.text(text) + QQMessageSegment.file_image(b64encode(white_list_img).decode('utf-8'))) # type: ignore elif isinstance(event,MessageEvent): - await matcher.finish(MessageSegment.image(file=white_list_img)) + await matcher.finish(MessageSegment.text(text) + MessageSegment.image(file=white_list_img)) else: - await matcher.finish(QQMessageSegment.file_image(white_list_img)) + await matcher.finish(QQMessageSegment.text(text) + QQMessageSegment.file_image(white_list_img)) async def md_status(event: MessageEvent|QQMessageEvent,arg: Message|QQMessage): '''md开关''' diff --git a/pyproject.toml b/pyproject.toml index 5c0e34d..179a54d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "nonebot-plugin-gpt" -version = "0.0.29" +version = "0.0.30" description = "Nonebot2's plugin of ChatGPT " authors = [ {name = "nek0us", email = "nekouss@mail.com"}, ] license = {text = "GPL3"} -dependencies = ["ChatGPTWeb>=0.2.31","nonebot_adapter_onebot>=2.3.1","nonebot-plugin-sendmsg-by-bots>=0.1.5","nonebot_adapter_qq>=1.3.5","nonebot2>=2.0.0","more_itertools","nonebot_plugin_htmlrender","nonebot_plugin_localstore"] +dependencies = ["ChatGPTWeb>=0.2.32","nonebot_adapter_onebot>=2.3.1","nonebot-plugin-sendmsg-by-bots>=0.1.5","nonebot_adapter_qq>=1.3.5","nonebot2>=2.0.0","more_itertools","nonebot_plugin_htmlrender","nonebot_plugin_localstore"] requires-python = ">=3.10" readme = "README.md"