新增 Slack 渠道扩展,支持在 Yuxi 平台中集成 Slack 团队协作平台。 包含以下功能模块: - config: 渠道配置管理 - gateway: SSE/WebSocket 网关接入 - outbound: 外发消息管理 - streaming: 流式消息处理 - pairing: 用户配对与绑定 - security: 安全校验 - monitor: 渠道状态监控 - status: 会话状态管理 - actions: 交互动作处理 - interactive: 交互式消息 - commands: 斜杠指令 - threading: 线程管理 - mentions: @提及 - constants: 常量定义 - types: 类型定义
17 lines
759 B
Python
17 lines
759 B
Python
from yuxi.channel.extensions.slack.constants import SLACK_MENTION_PATTERN
|
|
from yuxi.channel.extensions.slack.format import extract_mentions, strip_mentions
|
|
|
|
|
|
class SlackMentions:
|
|
def extract_mentions(self, raw_message: dict) -> list[str]:
|
|
return extract_mentions(raw_message.get("text", ""))
|
|
|
|
def strip_mentions(self, text: str, ctx: object, config: dict | None = None, agent_id: str | None = None) -> str:
|
|
return strip_mentions(text)
|
|
|
|
def strip_regexes(self, ctx: object, config: dict | None = None, agent_id: str | None = None) -> list:
|
|
return [SLACK_MENTION_PATTERN]
|
|
|
|
def strip_patterns(self, ctx: object, config: dict | None = None, agent_id: str | None = None) -> list[str]:
|
|
return [SLACK_MENTION_PATTERN]
|