fix: complete ensure_ascii=False and UTF-8 encoding migration

This commit is contained in:
Re-bin
2026-02-20 07:59:32 +00:00
25 changed files with 356 additions and 235 deletions

View File

@@ -110,7 +110,7 @@ class SessionManager:
if legacy_path.exists():
import shutil
shutil.move(str(legacy_path), str(path))
logger.info(f"Migrated session {key} from legacy path")
logger.info("Migrated session {} from legacy path", key)
if not path.exists():
return None
@@ -144,7 +144,7 @@ class SessionManager:
last_consolidated=last_consolidated
)
except Exception as e:
logger.warning(f"Failed to load session {key}: {e}")
logger.warning("Failed to load session {}: {}", key, e)
return None
def save(self, session: Session) -> None:
@@ -163,7 +163,6 @@ class SessionManager:
for msg in session.messages:
f.write(json.dumps(msg, ensure_ascii=False) + "\n")
self._cache[session.key] = session
def invalidate(self, key: str) -> None: