新增了Alexa渠道的所有核心功能模块,包括配置管理、请求校验、会话管理、安全验证、去重、响应格式化、渐进式响应、主动推送、提醒功能、配对绑定以及Webhook端点,并完成了插件注册和配置项定义。
32 lines
946 B
Python
32 lines
946 B
Python
import logging
|
|
|
|
from yuxi.channel.protocols import ChannelAccountSnapshot
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class AlexaStatus:
|
|
|
|
def __init__(self, account=None):
|
|
self._account = account
|
|
|
|
async def probe(self, account: dict | None = None) -> bool:
|
|
configured = (
|
|
self._account
|
|
and self._account.application_id
|
|
)
|
|
return configured
|
|
|
|
def build_summary(self, snapshot: object) -> dict:
|
|
return {
|
|
"channel": "alexa",
|
|
"mode": "request_response",
|
|
"output_format": "ssml",
|
|
"streaming": False,
|
|
}
|
|
|
|
def build_account_snapshot(self, account, config, runtime=None, probe_result=None, audit=None) -> ChannelAccountSnapshot:
|
|
return ChannelAccountSnapshot(
|
|
account_id=getattr(account, "account_id", "default"),
|
|
configured=bool(probe_result) if probe_result is not None else False,
|
|
) |