我已经使用'api-ai-javascript‘sdk为我的机器人构建了一个自定义视图/网页。一切都很好,但是我无法从我的实现中拿回RichResponse (云函数)。这是我使用‘actions-on-google’的实现代码:
const { DialogflowApp } = require('actions-on-google');
...
if(hasScreen){
//hasScreen = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)
app.tell(app.buildRichResponse()
.addSimpleResponse('We found the perfect item for you! ' + product.title)
.addBasicCard(app.buildBasicCard( 'Your item is ' + product.title )
.setTitle('Your perfect item!')
.addButton('View Item', 'https://retailer.com/item/' + product.id)
.setImage(product.imgurl, 'Product Image')
.setImageDisplay('CROPPED')
)
)
} else if (hasAudio){
//hasAudio = app.hasSurfaceCapability(app.SurfaceCapabilities.AUDIO_OUTPUT)
app.tell('No screen buy yes audio.)
} else {
app.tell('No screen no audio.')
}但由于某些原因,在浏览器中测试时,我总是得到最后一个响应“没有屏幕,没有声音”。下面是使用api-ai-javascript (版本1)的客户端代码。
import {ApiAiClient} from "api-ai-javascript";
...
client.textRequest(text)
.then((response) => {
//here I only receive 'No scree no audio'
//I need the rich response here
})当我在Google中测试屏幕时,它工作得很好,但不是在我的网站上。如何获取RichResponse?
发布于 2018-01-19 05:15:13
"actions- on - Google“库仅用于处理Google Assistant发送的消息--从像Google Home这样的扬声器设备或通过移动设备上的Assistant应用程序发送的消息。
这听起来像是在使用Dialogflow Web Demo集成或使用Dialogflow API直接发送查询,这样就不会发送Assistant平台独有的附加信息。因此,当您使用Dialogflow处理自然语言处理时,您无法利用通过Assistant平台提供的功能。
https://stackoverflow.com/questions/48330082
复制相似问题