使用dialogflow检测来自Google Home的请求 [英] Detect request coming from google home using dialogflow
问题描述
如何检测来自Google家用设备的dialogflow请求。
How to detect the request coming to dialogflow from google home devices.
对于Google助手,Facebook和其他所有人,我使用了来源
来自 originalRequest
节点的参数。
For google assistant,Facebook and all, I used the source
parameter from the originalRequest
node.
{"originalRequest":{"source":"google","data":{"sender":{"id":"3"},"recipient":{"id":"3"},"message":{"mid":"mid","text":"apple iphone 8","seq":3},"timestamp":1522229806857}}
但是对于Google Home,我也将源参数设为 google 本身。
But for google home also I am getting the source parameter as google itself.
那么是否有任何参数可以检测到来自Google主页的请求,以便我可以相应地更改响应?
So Is there any parameter to detect the request coming from google home, so that I can change the response accordingly?
推荐答案
是,不是。
首先-助手在很大程度上相同所有平台,因此您应该问为什么要尝试确定用户使用的是带屏幕的助手还是不带屏幕的助手。即使对于带有屏幕的设备,您也应该始终将语音作为主要的交互方法,并为其添加视觉效果而不是依靠它们。
First - The Assistant is largely the same on all platforms, so you should be asking why you're trying to identify if the user is using an Assistant with a screen vs one without a screen. You should always be targeting voice as the primary interaction method, even for devices with a screen, and supplement it with visuals rather than relying on them.
但是,要确定什么您正在使用的设备具有的功能,您应该查看 originalRequest.data.surface.capabilities
数组。它包含具有 name
参数的对象数组。该参数列出了此特定设备可以处理的功能。如果其中一个值是 actions.capability.SCREEN_OUTPUT
,则它支持屏幕(即-当前是移动设备。这也可能是为智能显示器。)。如果不存在,则可能是扬声器(当前唯一可用的没有屏幕的设备)。
However, to determine what capabilities the device you're talking with has, you should look at the originalRequest.data.surface.capabilities
array. This contains an array of objects with a name
parameter. That parameter lists the capabilities that this specific device can handle. If one of the values is actions.capability.SCREEN_OUTPUT
, then it supports a screen (ie - it is a mobile device currently. This will likely also be what is set for the Smart Displays.). If this is absent, then it is likely a speaker (the only device currently available that doesn't have a screen).
这篇关于使用dialogflow检测来自Google Home的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!