from __future__ import annotations import logging from yuxi.channel.extensions.yuanbao.types import YuanbaoChatType logger = logging.getLogger(__name__) def build_session_key(account_id: str, chat_type: YuanbaoChatType, peer_id: str) -> str: if chat_type == YuanbaoChatType.C2C: return f"{account_id}:c2c:{peer_id}" return f"{account_id}:group:{peer_id}" def c2c_session_key(account_id: str, open_id: str) -> str: return build_session_key(account_id, YuanbaoChatType.C2C, open_id) def group_session_key(account_id: str, group_open_id: str) -> str: return build_session_key(account_id, YuanbaoChatType.GROUP, group_open_id)