From 2b933acab9a6dfd44d5beea4a330eca5470fadda Mon Sep 17 00:00:00 2001
From: log
Date: Thu, 09 Jul 2026 15:28:40 +0800
Subject: [PATCH] fix: UnicodeEncodeError in logging and enable ANSI colors on Windows
---
code/system/system_manager.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/code/system/system_manager.py b/code/system/system_manager.py
index 6dcd148..e32834e 100644
--- a/code/system/system_manager.py
+++ b/code/system/system_manager.py
@@ -339,11 +339,13 @@
if report['components']:
for component in report['components']:
status = report['health']['components'].get(component, {'status': 'unknown'})
- status_str = status['status']
+ status_str = status.get('status', 'unknown')
if status_str == 'ok':
status_str = '✅ 正常'
elif status_str == 'error':
status_str = f"❌ 错误: {status.get('message', '未知错误')}"
+ elif status_str == 'disabled':
+ status_str = '⏸️ 禁用'
lines.append(f"- **{component}:** {status_str}\n")
else:
lines.append("无组件\n")
--
Gitblit v1.8.0