ForcePilot/backend/package/yuxi/channel/extensions/slack/threading.py
Kris bfc7755137 feat(channel): 添加 Slack 渠道扩展
新增 Slack 渠道扩展,支持在 Yuxi 平台中集成 Slack 团队协作平台。

包含以下功能模块:
- config: 渠道配置管理
- gateway: SSE/WebSocket 网关接入
- outbound: 外发消息管理
- streaming: 流式消息处理
- pairing: 用户配对与绑定
- security: 安全校验
- monitor: 渠道状态监控
- status: 会话状态管理
- actions: 交互动作处理
- interactive: 交互式消息
- commands: 斜杠指令
- threading: 线程管理
- mentions: @提及
- constants: 常量定义
- types: 类型定义
2026-05-21 11:43:23 +08:00

34 lines
1.2 KiB
Python

from yuxi.channel.message.models import UnifiedMessage
from yuxi.channel.protocols import ReplyTransport, ThreadInfo
class SlackThreading:
def extract_thread_id(self, msg: UnifiedMessage) -> str | None:
if msg.group and msg.group.thread_id:
return msg.group.thread_id
return None
def resolve_reply_transport(self, msg: UnifiedMessage, thread_id: str | None) -> ReplyTransport:
if thread_id:
return ReplyTransport(mode="thread", thread_id=thread_id)
return ReplyTransport(mode="inline")
def get_thread_info(self, thread_id: str) -> ThreadInfo | None:
return ThreadInfo(thread_id=thread_id, is_threaded=True)
def resolve_reply_to_mode(self, config, account_id=None, chat_type=None) -> str:
if chat_type == "thread":
return "first"
return "all"
allow_explicit_reply_tags_when_off: bool = True
def build_tool_context(self, config, account_id, context, has_replied_ref=None) -> object | None:
return None
def resolve_auto_thread_id(self, config, account_id, to, tool_context=None, reply_to_id=None) -> str | None:
return None
def resolve_focused_binding(self, config, account_id, context) -> object | None:
return None