🐛 修复历史记录反复加载导致的context为空列表

This commit is contained in:
MoeSnowyFox 2024-11-17 17:55:58 +08:00
parent f03a41d38a
commit 8bbaa32525

View File

@ -82,9 +82,9 @@ async def praises():
@contexts_cmd.handle() @contexts_cmd.handle()
async def contexts(target: MsgTarget): async def contexts(target: MsgTarget):
context.set_context( backup_context = await get_backup_context(target.id, target.private)
await get_backup_context(target.id, target.private), target.id, target.private if backup_context:
) # 加载历史记录 context.set_context(backup_context, target.id, target.private) # 加载历史记录
await contexts_cmd.finish(str(context.build(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: elif config.marshoai_enable_support_image_tip:
await UniMessage("*此模型不支持图片处理。").send() await UniMessage("*此模型不支持图片处理。").send()
context.set_context( backup_context = await get_backup_context(target.id, target.private)
await get_backup_context(target.id, target.private), target.id, target.private if backup_context:
) # 加载历史记录 context.set_context(backup_context, target.id, target.private) # 加载历史记录
context_msg = context.build(target.id, target.private) context_msg = context.build(target.id, target.private)
target_list.append([target.id, target.private]) target_list.append([target.id, target.private])
if not is_reasoning_model: if not is_reasoning_model: