fix: 优化表情包参数解析

This commit is contained in:
hp0912 2026-06-06 16:35:03 +08:00
parent f9aa0f65c1
commit 19b9a5d8da

View File

@ -75,8 +75,13 @@ def _expand_json_array_values(values: list[str], label: str) -> list[str]:
stripped = value.strip() stripped = value.strip()
if not stripped: if not stripped:
continue continue
if stripped.startswith("["): if stripped.startswith("[") and stripped.endswith("]"):
try:
parsed = json.loads(stripped) parsed = json.loads(stripped)
except json.JSONDecodeError:
# 不是合法 JSON例如 [开心]),当作普通名称
expanded.append(stripped)
continue
if not isinstance(parsed, list): if not isinstance(parsed, list):
raise ValueError(f"{label} 必须是字符串数组") raise ValueError(f"{label} 必须是字符串数组")
for item in parsed: for item in parsed: