From b4c3e71fafda8e05fac402bcea68c17dfd86316b Mon Sep 17 00:00:00 2001 From: FuQuan233 Date: Sun, 16 Feb 2025 14:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20#5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_llmchat/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonebot_plugin_llmchat/__init__.py b/nonebot_plugin_llmchat/__init__.py index a60fa64..168bb3c 100644 --- a/nonebot_plugin_llmchat/__init__.py +++ b/nonebot_plugin_llmchat/__init__.py @@ -384,7 +384,7 @@ async def save_state(): } os.makedirs(os.path.dirname(data_file), exist_ok=True) - async with aiofiles.open(data_file, "w") as f: + async with aiofiles.open(data_file, "w", encoding="utf8") as f: await f.write(json.dumps(data, ensure_ascii=False)) @@ -394,7 +394,7 @@ async def load_state(): if not os.path.exists(data_file): return - async with aiofiles.open(data_file) as f: + async with aiofiles.open(data_file, encoding="utf8") as f: data = json.loads(await f.read()) for gid, state_data in data.items(): state = GroupState()