新增腾讯短信(Tencent SMS)渠道扩展,支持在 Yuxi 平台中集成腾讯云短信渠道。 包含以下功能模块: - client: 腾讯云短信 API 客户端封装 - plugin: 渠道插件核心 - config: 渠道配置管理 - gateway: SSE/WebSocket 网关接入 - webhook: Webhook 事件处理 - outbound: 外发消息管理 - streaming: 流式消息处理 - security: 安全校验 - dedupe: 消息去重 - delivery: 送达状态回调 - compliance: 合规管理 - frequency: 频率控制 - templates: 短信模板 - agent_prompt: Agent 提示词 - types: 类型定义
16 lines
425 B
Python
16 lines
425 B
Python
from __future__ import annotations
|
|
|
|
from .types import TencentSmsAccount
|
|
|
|
|
|
def check_allowlist(account: TencentSmsAccount, phone: str):
|
|
allow = account.allow_from
|
|
if not allow:
|
|
return
|
|
if phone not in allow:
|
|
raise PermissionError(f"\u53f7\u7801 {phone[:6]}*** \u4e0d\u5728\u767d\u540d\u5355\u4e2d")
|
|
|
|
|
|
def resolve_dm_policy(account: TencentSmsAccount) -> str:
|
|
return account.dm_policy or "open"
|