fix(scripts): read gateway_voice_mode.json as UTF-8

json.loads after read_text() used locale default on Windows; UTF-8 state file could mis-parse.

Made-with: Cursor
This commit is contained in:
Tianworld 2026-04-12 23:28:21 +08:00 committed by Teknium
parent 0187de1f67
commit 953f8fa943

View file

@ -265,7 +265,7 @@ def check_config(groq_key, eleven_key):
if voice_mode_path.exists(): if voice_mode_path.exists():
try: try:
import json import json
modes = json.loads(voice_mode_path.read_text()) modes = json.loads(voice_mode_path.read_text(encoding="utf-8"))
off_count = sum(1 for v in modes.values() if v == "off") off_count = sum(1 for v in modes.values() if v == "off")
all_count = sum(1 for v in modes.values() if v == "all") all_count = sum(1 for v in modes.values() if v == "all")
check("Voice mode state", True, f"{all_count} on, {off_count} off, {len(modes)} total") check("Voice mode state", True, f"{all_count} on, {off_count} off, {len(modes)} total")