1 回答
TA贡献1847条经验 获得超11个赞
我最终让它工作。我缺少的主要部分是我需要将“expectUserResponse”设置为 True 并提供建议筹码。由于缺少建议筹码,当前文档中的示例(截至 2019 年 2 月)将无法播放。我"expectUserResponse": true 从示例中删除并让它播放,但它没有发送actions.intent.MEDIA_STATUS响应。重新引入"expectUserResponse": true和添加建议芯片确实起到了作用
我无法包含我发送的实际响应,但这里是文档中代码示例的编辑版本。具体来说,我在https://developers.google.com/actions/assistant/responses#media_responses提供的 DIALOGFLOW JSON 选项卡的“示例代码”部分下的示例中添加了建议芯片:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"mediaResponse": {
"mediaType": "AUDIO",
"mediaObjects": [
{
"contentUrl": "https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3",
"description": "A funky Jazz tune",
"icon": {
"url": "https://storage.googleapis.com/automotive-media/album_art.jpg",
"accessibilityText": "Ocean view"
},
"name": "Jazz in Paris"
}
]
}
}
],
"suggestions": [
{
"title": "pause"
},
{
"title": "start over"
}
]
},
"userStorage": "{\"data\":{}}"
}
},
"outputContexts": [
{
"name": "/contexts/_actions_on_google",
"lifespanCount": 99,
"parameters": {
"data": "{}"
}
}
]
}
感谢https://github.com/actions-on-google/actions-on-google-nodejs/issues/247#issuecomment-439617878中的 BoneGoat 提出在 node.js 端寻找用户响应的重要性东西的。希望这个问题能帮助其他 Java 开发人员!
添加回答
举报
