From 4b12424221f85f7a0f20a7c9a0476048f19aa4a6 Mon Sep 17 00:00:00 2001 From: Asankilp Date: Mon, 2 Dec 2024 01:45:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8B=BC=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF=EF=BC=8C=E4=BD=86=E6=9C=AA=E4=BF=AE=E5=A4=8DLinux=20s?= =?UTF-8?q?sl=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_marshoai/azure.py | 4 ++-- nonebot_plugin_marshoai/constants.py | 2 +- nonebot_plugin_marshoai/deal_latex.py | 9 ++++++--- nonebot_plugin_marshoai/util.py | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/nonebot_plugin_marshoai/azure.py b/nonebot_plugin_marshoai/azure.py index a01e714..475a601 100644 --- a/nonebot_plugin_marshoai/azure.py +++ b/nonebot_plugin_marshoai/azure.py @@ -275,7 +275,7 @@ async def marsho(target: MsgTarget, event: Event, text: Optional[UniMsg] = None) target_list.append([target.id, target.private]) # 对话成功发送消息 - if config.marshoai_enable_richtext_prase: + if config.marshoai_enable_richtext_parse: await (await parse_richtext(str(choice.message.content))).send( reply_to=True ) @@ -333,7 +333,7 @@ async def marsho(target: MsgTarget, event: Event, text: Optional[UniMsg] = None) context.append(choice.message.as_dict(), target.id, target.private) # 发送消息 - if config.marshoai_enable_richtext_prase: + if config.marshoai_enable_richtext_parse: await (await parse_richtext(str(choice.message.content))).send( reply_to=True ) diff --git a/nonebot_plugin_marshoai/constants.py b/nonebot_plugin_marshoai/constants.py index a0d40db..2036273 100644 --- a/nonebot_plugin_marshoai/constants.py +++ b/nonebot_plugin_marshoai/constants.py @@ -42,7 +42,7 @@ CODE_BLOCK_PATTERN = re.compile(r"```(.*?)```|`(.*?)`", re.DOTALL) IMG_LATEX_PATTERN = re.compile( ( r"(!\[[^\]]*\]\([^()]*\))|(\\begin\{equation\}.*?\\end\{equation\}|\$.*?\$|\$\$.*?\$\$|\\\[.*?\\\]|\\\(.*?\\\))" - if config.marshoai_single_latex_prase + if config.marshoai_single_latex_parse else r"(!\[[^\]]*\]\([^()]*\))|(\\begin\{equation\}.*?\\end\{equation\}|\$\$.*?\$\$|\\\[.*?\\\])" ), re.DOTALL, diff --git a/nonebot_plugin_marshoai/deal_latex.py b/nonebot_plugin_marshoai/deal_latex.py index e9bbad5..88d963c 100644 --- a/nonebot_plugin_marshoai/deal_latex.py +++ b/nonebot_plugin_marshoai/deal_latex.py @@ -52,6 +52,7 @@ class L2PChannel(ConvertChannel): async with httpx.AsyncClient( timeout=timeout, + verify=False, ) as client: while retry > 0: try: @@ -88,7 +89,7 @@ class L2PChannel(ConvertChannel): @staticmethod def channel_test() -> int: - with httpx.Client(timeout=5) as client: + with httpx.Client(timeout=5,verify=False) as client: try: start_time = time.time_ns() latex2png = ( @@ -128,6 +129,7 @@ class CDCChannel(ConvertChannel): ) -> Tuple[Literal[True], bytes] | Tuple[Literal[False], bytes | str]: async with httpx.AsyncClient( timeout=timeout, + verify=False, ) as client: while retry > 0: @@ -153,7 +155,7 @@ class CDCChannel(ConvertChannel): @staticmethod def channel_test() -> int: - with httpx.Client(timeout=5) as client: + with httpx.Client(timeout=5,verify=False) as client: try: start_time = time.time_ns() codecogs = ( @@ -185,6 +187,7 @@ class JRTChannel(ConvertChannel): async with httpx.AsyncClient( timeout=timeout, + verify=False, ) as client: while retry > 0: try: @@ -219,7 +222,7 @@ class JRTChannel(ConvertChannel): @staticmethod def channel_test() -> int: - with httpx.Client(timeout=5) as client: + with httpx.Client(timeout=5,verify=False) as client: try: start_time = time.time_ns() joeraut = ( diff --git a/nonebot_plugin_marshoai/util.py b/nonebot_plugin_marshoai/util.py index f80166f..17f3c1e 100644 --- a/nonebot_plugin_marshoai/util.py +++ b/nonebot_plugin_marshoai/util.py @@ -282,7 +282,7 @@ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details. """ -if config.marshoai_enable_richtext_prase: +if config.marshoai_enable_richtext_parse: latex_convert = ConvertLatex() # 开启一个转换实例