优先从画像和角色配置中解析角色 chat_id。
(user_id: str, role_name: Optional[str] = None)
| 673 | |
| 674 | def resolve_chat_id_for_user(user_id: str, role_name: Optional[str] = None) -> Optional[str]: |
| 675 | """优先从画像和角色配置中解析角色 chat_id。""" |
| 676 | profile = get_profile(user_id) or {} |
| 677 | if profile.get("feishu_chat_id"): |
| 678 | return profile["feishu_chat_id"] |
| 679 | |
| 680 | resolved_role_name = role_name or get_role_name_by_user_id(user_id) |
| 681 | if resolved_role_name: |
| 682 | return get_role_chat_id(resolved_role_name) |
| 683 | |
| 684 | return None |
| 685 | |
| 686 | |
| 687 | def send_weekly_report( |
| 688 | user_id: str, |
no test coverage detected