Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
nek0us committed Jun 15, 2024
1 parent df10af5 commit 9838e00
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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登录问题
Expand Down
11 changes: 8 additions & 3 deletions nonebot_plugin_gpt/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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开关'''
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down

0 comments on commit 9838e00

Please sign in to comment.