From d8c86069f2184c8df7d5d3d8423a61e07c7ef380 Mon Sep 17 00:00:00 2001 From: developer-wlj Date: Fri, 27 Mar 2026 10:27:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(agent):=20=E8=A7=A3=E5=86=B3=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为文件读取操作明确指定 UTF-8 编码 - 防止因默认编码导致的字符读取错误 - 确保跨平台环境下的文件内容一致性 --- app/agent/middleware/memory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/agent/middleware/memory.py b/app/agent/middleware/memory.py index 5d7d4e74..f067a071 100644 --- a/app/agent/middleware/memory.py +++ b/app/agent/middleware/memory.py @@ -335,7 +335,7 @@ class MemoryMiddleware(AgentMiddleware[MemoryState, ContextT, ResponseT]): # no MAX_MEMORY_FILE_SIZE, ) continue - contents[path] = await file_path.read_text() + contents[path] = await file_path.read_text(encoding="utf-8") logger.debug("Loaded memory from: %s", path) except Exception as e: logger.warning("Failed to read memory file %s: %s", path, e)