该提交新增了完整的BlueBubbles渠道插件,支持通过BlueBubbles Server集成iMessage功能,包含以下核心能力: 1. 支持私聊和群聊会话管理,自动区分会话类型 2. 完整的消息收发支持,包括文本、图片、语音、文件、视频消息 3. 支持消息反应、已读回执、消息编辑与撤回 4. 内置去重、防抖处理机制 5. 支持Webhook和WebSocket两种事件接收方式 6. 完善的权限与安全校验机制 7. 历史消息同步与抓包功能 8. TTS语音合成与发送支持 9. 群组管理能力,包括重命名、修改头像、增减成员等
17 lines
625 B
Python
17 lines
625 B
Python
from yuxi.channel.extensions.bluebubbles.targets import extract_handle_from_chat_guid, is_group_chat_guid
|
|
|
|
|
|
def build_dm_session_key(agent_id: str, chat_guid: str) -> str:
|
|
handle = extract_handle_from_chat_guid(chat_guid)
|
|
return f"agent:{agent_id}:bluebubbles:dm:{handle}"
|
|
|
|
|
|
def build_group_session_key(agent_id: str, chat_guid: str) -> str:
|
|
return f"agent:{agent_id}:bluebubbles:group:{chat_guid}"
|
|
|
|
|
|
def build_session_key(agent_id: str, chat_guid: str) -> str:
|
|
if is_group_chat_guid(chat_guid):
|
|
return build_group_session_key(agent_id, chat_guid)
|
|
return build_dm_session_key(agent_id, chat_guid)
|