dialogflow-es - 尝试在 Dialogflow 中获取用户的当前位置时遇到错误
问题描述
我需要在对话流中获取用户的当前位置。为此,我创建了一个意图 - UseMyLocation,然后是后续意图并在其中添加了事件 GOOGLE_ASSISTANT PERMISSION
function requestPermission(agent) {
agent.requestSource = agent.ACTIONS_ON_GOOGLE;
let conv = agent.conv();
console.log('conv '+conv);
conv.ask(new Permission({
context: 'to locate you',
permissions: 'DEVICE_PRECISE_LOCATION',
}));
}
intentMap.set('movie.book.ticket - UseMyLocation',requestPermission);
agent.handleRequest(intentMap);
It should ask for user's permission for the location instead it is throwing exception:
Error: No responses defined for platform: ACTIONS_ON_GOOGLE
at V2Agent.sendResponses_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:243:13)
at WebhookClient.send_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:505:17)
at promise.then (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:316:38)
at <anonymous>
包.json
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.6.0"
}
请帮忙
解决方案
请尝试以下解决方案,您缺少 agent.add(conv);
function requestPermission(agent)
{
agent.requestSource = agent.ACTIONS_ON_GOOGLE;
let conv = agent.conv();
console.log('conv '+conv);
conv.ask(new Permission({
context: 'to locate you',
permissions: 'DEVICE_PRECISE_LOCATION',
}));
agent.add(conv); // Please add this
}
推荐阅读
- r - 具有性别的人口金字塔并与 ggplot2 比较两个时间段
- c# - 如何解决 502 Bad Gateway 错误
- ios - Flurry iOS 测试推送通知因 UnrecognizedDeviceId 而失败
- docker - Confluent 的 Docker 映像 - 添加 Confluent Hub 连接器
- python-3.x - 从 django 查询集中的日期时间字典中提取日期
- docusignapi - 删除 DocuSign Payment 的 Send without Payment 能力
- python - 不和谐 | 嵌入间距
- function - Haskell 给出“变量不在范围内:[Integer] -> t
- react-native - 如何反应原生 Flatlist 动态高度网格?
- git - 如果提交消息包含特殊字符,则通过完全匹配提交消息来搜索 git 提交