加载 roles.json
(roles_path: str)
| 22 | |
| 23 | |
| 24 | def load_roles(roles_path: str) -> Dict[str, Dict[str, Any]]: |
| 25 | """加载 roles.json""" |
| 26 | path = Path(roles_path) |
| 27 | if not path.is_absolute(): |
| 28 | path = PROJECT_ROOT / roles_path |
| 29 | |
| 30 | with path.open("r", encoding="utf-8") as f: |
| 31 | data = json.load(f) |
| 32 | |
| 33 | return data.get("roles", {}) |
| 34 | |
| 35 | |
| 36 | def load_profiles(db_path: str) -> Dict[str, Dict[str, Any]]: |