在 DialogFlow 中为 Google Assistant 检测特定设备(带或不带屏幕)

Detect specific device (with or without screen) for Google Assistant in DialogFlow

我正在使用 DialogFlow 为 Google Assistant 创建一个应用,没有任何外部网络服务器。

一些答案重定向到 YouTube 视频(使用基本卡)。我想通过返回不同的答案(如 "please use the assistant on your phone to play the video")来处理无法播放 YT 视频的设备(如 Google Home/Nest),或者可能阻止设备上的完整意图可用没有屏幕。

有没有办法限制特定类型设备的意图?

谢谢。

您可以使用以下方法检查屏幕功能。

const conv = agent.conv();
const hasScreen = conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT');

您甚至还可以检查其他功能。检查文档 here.