ForcePilot/backend/package/yuxi/channel/extensions/flock/threading.py
Kris 0bad70ec19 feat(flock): 新增Flock团队协作IM渠道插件
实现了完整的Flock渠道接入能力,包含消息收发、Webhook事件监听、账号配置、安全校验、媒体文件处理等功能,支持私聊和群组聊天,适配ForcePilot插件规范。
2026-05-21 10:47:01 +08:00

32 lines
874 B
Python

from __future__ import annotations
from yuxi.channel.protocols import ReplyTransport
def extract_thread_id(msg) -> str | None:
if hasattr(msg, "message_thread_id"):
return msg.message_thread_id
if hasattr(msg, "raw_payload"):
raw = msg.raw_payload
if isinstance(raw, dict):
event = raw.get("event", {})
if isinstance(event, dict):
message = event.get("message", {})
if isinstance(message, dict):
return message.get("threadId")
return None
def resolve_reply_transport(msg, thread_id: str | None) -> ReplyTransport:
return ReplyTransport(mode="inline", thread_id=thread_id)
def resolve_auto_thread_id(
config: dict,
account_id: str,
to: str,
tool_context=None,
reply_to_id: str | None = None,
) -> str | None:
return reply_to_id