import os import platform from typing import Any, Dict import yaml def load_config(config_path: str = "config/config.yaml") -> Dict[str, Any]: with open(config_path, "r", encoding="utf-8") as f: config = yaml.safe_load(f) # 动态选择中文字体 sys_name = platform.system().lower() if sys_name.startswith("win"): config.setdefault("font", {})["selected"] = config["font"].get("windows") elif sys_name.startswith("darwin") or sys_name.startswith("mac"): config.setdefault("font", {})["selected"] = config["font"].get("macos") else: config.setdefault("font", {})["selected"] = config["font"].get("linux") return config