[英]Action on Google working, but with a Dialogflow agent broken
I have a project with Actions on Google
, Dialogflow
& an AWS Lambda
to manage the fulfilment. 我
Actions on Google
, Dialogflow
和AWS Lambda
Actions on Google
有一个带有Actions on Google
的项目来管理实现。 On the backend (NodeJs) I use actions-on-google
(v2) 在后端(NodeJ),我使用
actions-on-google
(v2)
const {dialogflow} = require('actions-on-google');
const app = dialogflow({debug: true});
app.intent('StartIntent', (conv) => {
console.log('Hello AWS');
conv.ask('Hello AWS');
});
exports.handler = app
Dialogflow is configured with one Intent StartIntent
& with webhook fulfilment. Dialogflow配置了一个Intent
StartIntent
和StartIntent
实现。
Everything seems to work fine when I test with the Actions on Google simulator. 当我在Google模拟器上使用Actions进行测试时,一切似乎都正常运行。 I got the expected answer 'Hello AWS'.
我得到了预期的答案“ Hello AWS”。
However, it doesn't work with the dialogflow simulator. 但是,它不适用于dialogflow模拟器。 There is no answer, although I can read "Webhook execution successful" in the Diagnostic Info, with the correct fulfilment response:
尽管我可以在Diagnostic Info中读取“ Webhook执行成功”,但响应正确,但没有答案:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Hello AWS"
}
}
]
},
"userStorage": "{\"data\":{}}"
}
},
"outputContexts": [
{
"name": "projects..../_actions_on_google",
"lifespanCount": 99,
"parameters": {
"data": "{}"
}
}
]
}
This seems really strange to me, as the Actions on Google just make a call to dialogflow and that return a good response. 这对我来说真的很奇怪,因为Google上的Actions只是调用了dialogflow并且返回了很好的响应。 Whereas testing dialogflow alone doesn't work.
而仅测试dialogflow无效。
Any idea ? 任何想法 ?
This is expected. 这是预期的。 The actions-on-google library has its output tuned for the Google Assistant integration.
Google动作库已针对Google Assistant集成调整了输出。 It doesn't try to include output that would be used by generic Dialogflow agents, which is what the Dialogflow test field uses.
它不会尝试包含通用Dialogflow代理将使用的输出,这是Dialogflow测试字段使用的输出。
If it works in the Assistant Simulator - you should be good. 如果它在助手模拟器中有效-您应该会很好。
Update 更新
To be specific, the actions-on-google library sets values in payload.google.richResponse
in the JSON response which set the messages that are displayed by the Google Assistant. 具体来说,“ Google-Actions”库在JSON响应中的
payload.google.richResponse
中设置值,这些值设置了Google助手显示的消息。 As the name suggests, this is Google-specific output, so the Dialogflow test side-bar (as well as other agents that work with Dialogflow) ignore this section. 顾名思义,这是Google特定的输出,因此Dialogflow测试侧栏(以及与Dialogflow配合使用的其他代理)将忽略此部分。
Dialogflow has generic ways of sending messages back including the fulfillmentText
and fulfillmentMessages
fields in the JSON response. Dialogflow具有发送消息回包括通用方式
fulfillmentText
和fulfillmentMessages
在JSON响应领域。 The Dialogflow test side-bar uses these fields to display results. Dialogflow测试侧栏使用这些字段来显示结果。 The actions-on-google library does not set, or use, these fields, so results aren't available.
Google动作库未设置或使用这些字段,因此结果不可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.