From 56875b3ead9b0a79a0b3bb22484fbcae047397a5 Mon Sep 17 00:00:00 2001 From: nek0us <1130131059@qq.com> Date: Wed, 11 Dec 2024 14:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D24.12.11=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98=EF=BC=9B=E6=9B=B4=E6=94=B9=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E5=88=97=E8=A1=A8100=E6=9D=A1=E4=B8=BA?= =?UTF-8?q?=E4=B8=80=E5=BC=A0=E5=9B=BE=EF=BC=8C=E5=88=86=E5=A4=9A=E5=BC=A0?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_gpt/api.py | 8 ++++---- nonebot_plugin_gpt/check.py | 4 ++-- pyproject.toml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nonebot_plugin_gpt/api.py b/nonebot_plugin_gpt/api.py index 5801037..10bba68 100644 --- a/nonebot_plugin_gpt/api.py +++ b/nonebot_plugin_gpt/api.py @@ -618,15 +618,15 @@ async def black_list(event: MessageEvent|QQMessageEvent,arg :Message|QQMessage): msgs = [] if arg.extract_plain_text(): if arg.extract_plain_text() in ban_tmp: - f_tmp = ban_tmp[arg.extract_plain_text()][0].replace('"',r'\"') + f_tmp = ban_tmp[arg.extract_plain_text()][0].replace('"',r'\"').replace("\n"," ") msgs.append(f"|{arg.extract_plain_text()}|{f_tmp}|") else: for x in ban_tmp: - f_tmp = ban_tmp[x][0].replace('"',r'\"') + f_tmp = ban_tmp[x][0].replace('"',r'\"').replace("\n"," ") msgs.append(f"|{x}|{f_tmp}|") imgs = [] - if len(msgs) > 50: - chunks = list(chunked(msgs,50)) + if len(msgs) > 100: + chunks = list(chunked(msgs,100)) for chunk in chunks: tmp = msgs_head.copy() tmp.extend(chunk) diff --git a/nonebot_plugin_gpt/check.py b/nonebot_plugin_gpt/check.py index 0abb481..965a593 100644 --- a/nonebot_plugin_gpt/check.py +++ b/nonebot_plugin_gpt/check.py @@ -7,7 +7,7 @@ from nonebot.matcher import Matcher,current_matcher from nonebot.log import logger from datetime import datetime -from typing import List, Literal,Dict +from typing import List, Literal,Dict,Tuple import json from .source import banpath,ban_str_path,whitepath,plusstatus @@ -25,7 +25,7 @@ async def get_id_from_guild_group(event: QQMessageEvent): return id,value # 返回类型 -async def get_id_from_all(event: MessageEvent|QQMessageEvent): +async def get_id_from_all(event: MessageEvent|QQMessageEvent) -> Tuple: '''return id,value''' if isinstance(event,GroupMessageEvent): id = str(event.group_id) diff --git a/pyproject.toml b/pyproject.toml index 1f7feb4..a9f6f3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "nonebot-plugin-gpt" -version = "0.0.40" +version = "0.0.41" description = "Nonebot2's plugin of ChatGPT " authors = [ {name = "nek0us", email = "nekouss@mail.com"}, ] license = {text = "GPL3"} -dependencies = ["ChatGPTWeb>=0.2.43","nonebot_adapter_onebot>=2.3.1","nonebot-plugin-sendmsg-by-bots>=0.1.6","nonebot_adapter_qq>=1.3.5","nonebot2>=2.0.0","more_itertools","nonebot_plugin_htmlrender","nonebot_plugin_localstore"] +dependencies = ["ChatGPTWeb>=0.2.44","nonebot_adapter_onebot>=2.3.1","nonebot-plugin-sendmsg-by-bots>=0.1.6","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"