MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / init_user_metadata

Function init_user_metadata

scripts/init_user_metadata.py:56–77  ·  view source on GitHub ↗

初始化用户元数据列表

(
    roles: Dict[str, Dict[str, Any]],
    profiles: Dict[str, Dict[str, Any]],
)

Source from the content-addressed store, hash-verified

54
55
56def init_user_metadata(
57 roles: Dict[str, Dict[str, Any]],
58 profiles: Dict[str, Dict[str, Any]],
59) -> List[Dict[str, Any]]:
60 """初始化用户元数据列表"""
61 users = []
62
63 for role_name, role_data in sorted(roles.items()):
64 user_id = role_data.get("user_id", f"user_{role_name}")
65 profile_data = profiles.get(user_id, {})
66 profile = profile_data.get("profile", {})
67
68 users.append({
69 "user_id": user_id,
70 "role_name": role_name,
71 "description": role_data.get("description") or profile.get("description", ""),
72 "seed_directions": profile.get("core_directions", {}),
73 "initial_topics": list(profile.get("core_directions", {}).keys()),
74 "created_at": datetime.now().strftime("%Y-%m-%d"),
75 })
76
77 return users
78
79
80def main():

Callers 1

mainFunction · 0.85

Calls 2

getMethod · 0.80
nowMethod · 0.80

Tested by

no test coverage detected