新增快手(Kuaishou)渠道扩展,支持在 Yuxi 平台中集成快手客服渠道。 包含以下功能模块: - api: 快手 API 客户端封装 - accounts: 账户管理 - config: 渠道配置管理 - gateway: SSE/WebSocket 网关接入 - webhook: Webhook 事件处理 - outbound: 外发消息管理 - streaming: 流式消息处理 - pairing: 用户配对与绑定 - security: 安全校验 - signature: 请求签名验证 - dedupe: 消息去重 - monitor: 渠道状态监控 - status: 会话状态管理 - media: 媒体资源处理 - types: 类型定义
76 lines
2.6 KiB
Python
76 lines
2.6 KiB
Python
from __future__ import annotations
|
||
|
||
COMMON_CONFIG_SCHEMA = {
|
||
"$schema": "https://json-schema.org/draft-07/schema#",
|
||
"type": "object",
|
||
"title": "快手渠道配置",
|
||
"properties": {
|
||
"appId": {
|
||
"type": "string",
|
||
"title": "App ID",
|
||
"description": "快手开放平台应用 ID (https://open.kuaishou.com)",
|
||
},
|
||
"appSecret": {
|
||
"type": "string",
|
||
"title": "App Secret",
|
||
"x-ui-password": True,
|
||
"description": "快手开放平台应用密钥",
|
||
},
|
||
"redirectUri": {
|
||
"type": "string",
|
||
"title": "OAuth 回调地址",
|
||
"description": "快手 OAuth 授权回调地址,用于 authorization_code 模式(API 未开放前无需配置)",
|
||
"default": "",
|
||
},
|
||
"scopes": {
|
||
"type": "string",
|
||
"title": "授权范围",
|
||
"description": "快手 OAuth 授权范围,默认 user_info(API 未开放前无需配置)",
|
||
"default": "user_info",
|
||
},
|
||
"webhookToken": {
|
||
"type": "string",
|
||
"title": "Webhook 验证 Token",
|
||
"x-ui-password": True,
|
||
"description": "用于验证快手服务器回调的签名 (预留,API 未开放前无需配置)",
|
||
},
|
||
"webhookPath": {
|
||
"type": "string",
|
||
"title": "Webhook 回调路径",
|
||
"default": "/webhook/kuaishou/callback",
|
||
},
|
||
"dmPolicy": {
|
||
"type": "string",
|
||
"title": "DM 安全策略",
|
||
"enum": ["open", "pairing", "allowlist", "disabled"],
|
||
"default": "open",
|
||
"description": "私信安全策略(本地逻辑,无需 API 即可生效)",
|
||
},
|
||
"streaming": {
|
||
"type": "boolean",
|
||
"title": "启用流式输出",
|
||
"default": True,
|
||
"description": "块级流式输出(API 未开放前无实际效果)",
|
||
},
|
||
"maxTextLength": {
|
||
"type": "integer",
|
||
"title": "单条消息最大字符数",
|
||
"default": 2000,
|
||
"maximum": 2000,
|
||
"description": "单条消息最大长度限制(本地逻辑)",
|
||
},
|
||
"httpTimeoutMs": {
|
||
"type": "integer",
|
||
"title": "HTTP 请求超时(毫秒)",
|
||
"default": 15000,
|
||
},
|
||
"enabled": {
|
||
"type": "boolean",
|
||
"title": "启用",
|
||
"default": False,
|
||
"description": "当前快手 API 尚未开放 IM 能力,启用后仅作占位",
|
||
},
|
||
},
|
||
"required": ["appId", "appSecret"],
|
||
}
|