mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix(agent): 解决内存文件读取编码问题
- 为文件读取操作明确指定 UTF-8 编码 - 防止因默认编码导致的字符读取错误 - 确保跨平台环境下的文件内容一致性
This commit is contained in:
@@ -335,7 +335,7 @@ class MemoryMiddleware(AgentMiddleware[MemoryState, ContextT, ResponseT]): # no
|
|||||||
MAX_MEMORY_FILE_SIZE,
|
MAX_MEMORY_FILE_SIZE,
|
||||||
)
|
)
|
||||||
continue
|
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)
|
logger.debug("Loaded memory from: %s", path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Failed to read memory file %s: %s", path, e)
|
logger.warning("Failed to read memory file %s: %s", path, e)
|
||||||
|
|||||||
Reference in New Issue
Block a user