新增 KakaoTalk 渠道扩展,支持在 Yuxi 平台中集成 KakaoTalk 即时通讯渠道。 包含以下功能模块: - bot: Bot 客户端封装 - config: 渠道配置管理 - gateway: SSE/WebSocket 网关接入 - webhook: Webhook 事件处理 - outbound: 外发消息管理 - streaming: 流式消息处理 - pairing: 用户配对与绑定 - security: 安全校验 - dedupe: 消息去重 - monitor: 渠道状态监控 - status: 会话状态管理 - card_builder: KakaoTalk 卡片消息构建 - quick_reply: 快捷回复处理 - types: 类型定义
21 lines
635 B
Python
21 lines
635 B
Python
from __future__ import annotations
|
|
|
|
from yuxi.channel.extensions.kakaotalk.types import KakaoQuickReply
|
|
|
|
|
|
class QuickReplyBuilder:
|
|
|
|
@staticmethod
|
|
def quick_reply(label: str, message_text: str = "", action: str = "message") -> dict:
|
|
qr = {"label": label, "action": action}
|
|
if message_text:
|
|
qr["messageText"] = message_text
|
|
return qr
|
|
|
|
@staticmethod
|
|
def web_link(label: str, url: str) -> dict:
|
|
return {"label": label, "action": "webLink", "webLinkUrl": url}
|
|
|
|
@staticmethod
|
|
def build(items: list[dict], max_count: int = 10) -> list[dict]:
|
|
return items[:max_count] |