我想在我的中为用户添加建议。我正在使用API.ai进行bot开发和实现,我正在与后端进行数据通信。
我不能用建议芯片发送建议给我的机器人。
我遵循了这里的答复,Webhook response with "suggestion chips"以及https://developers.google.com/actions/assistant/responses#json的文档。但是,我在设备上和模拟器上只看到了在我的机器人上的简单文本响应。
我也在https://discuss.api.ai/t/google-assistant-rich-message-responses/5134/19查过了。但没有找到任何方法来切换到V1或V2。样例格式也不起作用!
以下是我的两个JSON:
at 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"
]
}
]python服务器
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"}]}}}]}}}'发布于 2017-06-07 11:25:04
您的JSON是错误的,删除数据对象之前的引号:
"data" : { ... }而不是
"data" : "{ ... }"因此,基本上,您是在发送一个包含对象的字符串,而不是JSON对象。
发布于 2017-06-07 16:01:33
使用格式解决,如这里所解释的,https://developers.google.com/actions/apiai/webhook
发布于 2017-06-09 04:03:55
将'expectUserResponse'添加到data -> google中
'expectUserResponse': true,
'isSsml': false,https://stackoverflow.com/questions/44409088
复制相似问题