新增快手(Kuaishou)渠道扩展,支持在 Yuxi 平台中集成快手客服渠道。 包含以下功能模块: - api: 快手 API 客户端封装 - accounts: 账户管理 - config: 渠道配置管理 - gateway: SSE/WebSocket 网关接入 - webhook: Webhook 事件处理 - outbound: 外发消息管理 - streaming: 流式消息处理 - pairing: 用户配对与绑定 - security: 安全校验 - signature: 请求签名验证 - dedupe: 消息去重 - monitor: 渠道状态监控 - status: 会话状态管理 - media: 媒体资源处理 - types: 类型定义
22 lines
626 B
Python
22 lines
626 B
Python
from __future__ import annotations
|
|
|
|
from .types import InboundKuaishouMessage
|
|
|
|
|
|
def to_unified_message(inbound: InboundKuaishouMessage) -> dict:
|
|
return {
|
|
"message_id": inbound.msg_id,
|
|
"channel_type": "kuaishou",
|
|
"sender": {
|
|
"id": inbound.open_id,
|
|
"name": inbound.nickname,
|
|
"avatar_url": inbound.avatar_url,
|
|
},
|
|
"message_type": inbound.msg_type,
|
|
"content": inbound.content,
|
|
"timestamp": inbound.create_time,
|
|
"chat_type": inbound.chat_type,
|
|
"group_id": inbound.group_id,
|
|
"raw_event": inbound.raw_event,
|
|
}
|