From d10e303627acce33ceb15f7c995e00401814a39e Mon Sep 17 00:00:00 2001 From: MoeSnowyFox Date: Sun, 17 Nov 2024 17:55:58 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=8F=8D=E5=A4=8D=E5=8A=A0=E8=BD=BD=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84context=E4=B8=BA=E7=A9=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_marshoai/azure.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nonebot_plugin_marshoai/azure.py b/nonebot_plugin_marshoai/azure.py index c6a628ee..d916e35a 100644 --- a/nonebot_plugin_marshoai/azure.py +++ b/nonebot_plugin_marshoai/azure.py @@ -82,9 +82,9 @@ async def praises(): @contexts_cmd.handle() async def contexts(target: MsgTarget): - context.set_context( - await get_backup_context(target.id, target.private), target.id, target.private - ) # 加载历史记录 + backup_context = await get_backup_context(target.id, target.private) + if not backup_context: + context.set_context(backup_context, target.id, target.private) # 加载历史记录 await contexts_cmd.finish(str(context.build(target.id, target.private))) @@ -183,9 +183,9 @@ async def marsho(target: MsgTarget, event: Event, text: Optional[UniMsg] = None) ) elif config.marshoai_enable_support_image_tip: await UniMessage("*此模型不支持图片处理。").send() - context.set_context( - await get_backup_context(target.id, target.private), target.id, target.private - ) # 加载历史记录 + backup_context = await get_backup_context(target.id, target.private) + if not backup_context: + context.set_context(backup_context, target.id, target.private) # 加载历史记录 context_msg = context.build(target.id, target.private) target_list.append([target.id, target.private]) if not is_reasoning_model: