我想在我的 Google Assistant Bot 中为用户添加建议。我正在使用 API.ai 进行机器人开发并使用实现,我正在与我的后端进行数据通信。
我无法使用建议芯片向我的机器人发送建议。
我已按照此处的回答使用“建议芯片”
以及https://developers.google.com/actions/assistant/responses#json上的文档进行Webhook 响应。但是,我仍然只能在设备和模拟器上的机器人上看到简单的文本响应。
我还查看了https://discuss.api.ai/t/google-assistant-rich-message-responses/5134/19。但是没有找到任何方法切换到V1或V2。示例格式也不起作用!
这是我的 2 个 JSON:在 API.ai
"fulfillment": {
"speech": "want to proceed further?",
"messages": [
{
"type": 0,
"speech": "want to proceed further?"
}
],
"data": {
"google": {
"conversationToken": "[\"AS-PER-JSON-FROM-SIMULATOR\"]",
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "want to proceed further?",
"displayText": "want to proceed further?"
}
}
],
"suggestions": [
{
"title": "Yes"
},
{
"title": "No"
}
]
}
}
}
]
}
}
},
在 Google 上采取行动
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "want to proceed?"
}
}
]
},
"noMatchPrompts": [],
"noInputPrompts": []
},
"possibleIntents": [
{
"intent": "assistant.intent.action.TEXT"
}
],
"speechBiasingHints": [
"$subject",
"$answer"
]
}
]
蟒蛇服务器
return = '{"speech":"want to proceed?", "data": {"google":{"expectedInputs":[{"inputPrompt":{"richInitialPrompt":{"items":[{"simpleResponse":{"textToSpeech":"want to proceed?","displayText":"want to proceed?"}}],"suggestions":[{"title":"Yes"},{"title":"No"}]}}}]}}}'