From 23ca88b93ae57c30cc5f3f297a328700067a4d23 Mon Sep 17 00:00:00 2001 From: Asankilp Date: Thu, 30 Jan 2025 15:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E9=87=8D=E7=BD=AE=E9=80=BB=E8=BE=91=EF=BC=9B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E8=AF=95=E5=92=8C=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_marshoai/marsho.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nonebot_plugin_marshoai/marsho.py b/nonebot_plugin_marshoai/marsho.py index d12e0cf9..698dd0e0 100644 --- a/nonebot_plugin_marshoai/marsho.py +++ b/nonebot_plugin_marshoai/marsho.py @@ -147,6 +147,9 @@ async def load_context(target: MsgTarget, arg: Message = CommandArg()): async def resetmem(target: MsgTarget): if [target.id, target.private] not in target_list: target_list.append([target.id, target.private]) + backup_context = await get_backup_context(target.id, target.private) + if backup_context: + context.set_context(backup_context, target.id, target.private) context.reset(target.id, target.private) await resetmem_cmd.finish("上下文已重置") @@ -284,6 +287,7 @@ async def marsho( tools_lists = tools.tools_list + list( map(lambda v: v.data(), get_function_calls().values()) ) + logger.debug(f"正在获取回答,模型:{model_name}") response = await make_chat_openai( client=client, model_name=model_name, @@ -296,6 +300,7 @@ async def marsho( # 当tool_calls非空时,将finish_reason设置为TOOL_CALLS if choice.message.tool_calls != None and config.marshoai_fix_toolcalls: choice.finish_reason = CompletionsFinishReason.TOOL_CALLS + logger.info(f"完成原因:{choice.finish_reason}") if choice.finish_reason == CompletionsFinishReason.STOPPED: # 当对话成功时,将dict的上下文添加到上下文类中 context.append( @@ -445,6 +450,7 @@ with contextlib.suppress(ImportError): # 优化先不做() user_nickname = nicknames.get(user_id, "") try: if config.marshoai_poke_suffix != "": + logger.info(f"收到戳一戳,用户昵称:{user_nickname},用户ID:{user_id}") response = await make_chat_openai( client=client, model_name=model_name,