我正在使用 api.ai webhook 来执行 Google 上的操作。我正在遵循此处记录的请求和响应格式
我从 webhook 发回的响应是
{
"speech": "Ok I am doing the stuff",
"displayText": "Ok I am doing the stuff",
"data": {
"google": {
"expect_user_response": false,
"is_ssml": false,
"permissions_request": {
"opt_context": "",
"permissions": []
}
}
},
"contextOut": []
}
当我在 Google Home 的 Web 模拟器上对此进行测试时,它显示“您的代理现在没有响应。请稍后再试”,并带有以下响应 JSON
{
"response": "Car Bot isn’t responding right now. Try again soon.\n",
"audioResponse": "//NExAASW..."content_copy,
"debugInfo": {
"sharedDebugInfo": [
{
"name": "ExecutionResponse",
"debugInfo": "Failed to..."
}
]
}
}
响应中的调试信息是
"无法从 http_response 解析 SDKResponse: 'HTTP/1.1 200 OK\r\nContent-Type: application/json;charset=UTF-8\r\nContent-Length: 218\r\nConnection: keep-alive\r\nDate : Sun, 08 Jan 2017 21:47:00 GMT\r\nServer: nginx/1.11.2\r\nAccess-Control-Allow-Credentials: true\r\nAssistant-Interaction-Error-Code: 1\r\nAssistant -Interaction-Error-Message: Empty speech response\r\nCache-control: no-cache=\"set-cookie\"\r\nSet-Cookie: AWSELB=9D5B4D210CCFFAF1BE1E0CD7C7E6FCBD7B46140CAA45DBF2953C1CA6A2C5B5AD15740DAC3D9FC21AE7E6356E101785BA33F8274D819A39085F4BDBBE52D3F44CD1BB461230;PATH=/\r\nX-Cache: Miss从云端\r\n通过:1.1 51c76241371dfc20d25094a51b4759eb.cloudfront.net (CloudFront)\r\nX-Amz-Cf-Id: bP2EaYL-00IkMABSCWhwbaDr5GU7sIgC02OB-31LGojecexWQayetQ==\r\n\r\n{\"消息"空语音响应\",\"apiResponse\":{\"id\":\"ac3551e9-1f71-4f38-8ef7-efa8acff78aa\",\"timestamp\":\"2017-01-08T21:47:00.191 Z\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1483912013331 \"}}'"
我不明白这里有什么问题。
更新:
我已将语音消息转换为 ASCII 字符,但现在 Home 正在响应以下消息。
I'll just need to get your from Google. Is that ok?
而不是我在附加到语音标签的响应中发送的内容。模拟器中显示的 JSON 也不是我从 webhook 返回的内容。