(path: Path)
| 104 | |
| 105 | |
| 106 | def load_users(path: Path) -> Dict[str, Dict[str, Any]]: |
| 107 | if not path.exists(): |
| 108 | return {} |
| 109 | payload = json.loads(path.read_text(encoding="utf-8")) |
| 110 | users = payload.get("users", []) if isinstance(payload, dict) else [] |
| 111 | return {str(item.get("user_id")): item for item in users if isinstance(item, dict)} |
| 112 | |
| 113 | |
| 114 | def profile_text(user: Optional[Dict[str, Any]]) -> str: |