Dialogflow es 谷歌的行动——突然间进入了回退权限
在我的设备上,它记得位置许可已经被接受,并且跟踪意图和其他一切都正常。但在模拟器上,它不想再记住了。它一直在说: 对不起,我不明白。马上,但首先,我需要你的 来自谷歌的当前位置。可以吗 不管你怎么说,不管你怎么说,都不会成功。 就好像他仍然在那个意图中请求位置许可一样。 这是我的webhook,提供了一些模拟器和调试的屏幕截图Dialogflow es 谷歌的行动——突然间进入了回退权限,dialogflow-es,actions-on-google,Dialogflow Es,Actions On Google,在我的设备上,它记得位置许可已经被接受,并且跟踪意图和其他一切都正常。但在模拟器上,它不想再记住了。它一直在说: 对不起,我不明白。马上,但首先,我需要你的 来自谷歌的当前位置。可以吗 不管你怎么说,不管你怎么说,都不会成功。 就好像他仍然在那个意图中请求位置许可一样。 这是我的webhook,提供了一些模拟器和调试的屏幕截图 app.intent('location_permission_question', (conv) => { if (conv.user.s
app.intent('location_permission_question', (conv) => {
if (conv.user.storage.currentReservationID) {
return conv.ask(`No can't do, you have an active reservation.`)
}
return conv.ask(new Permission({
context: `Right away but first`,
permissions:
['DEVICE_PRECISE_LOCATION'],
}));
});
app.intent('handler_permission_location_details', (conv, params, permissionGranted) => {
if (!permissionGranted) {
return conv.close(`I can't help you then.`);
}
const userLatitude = conv.device.location.coordinates.latitude;
const userLongitude = conv.device.location.coordinates.longitude;
conv.user.storage.currentUserLocationLatitude = userLatitude;
conv.user.storage.currentUserLocationLongitude = userLongitude;
return clientInitGetNewLocations(conv, userLatitude, userLongitude, false)
});
app.intent('choose_car', (conv, {carModel}) => {
if (!conv.data.cars[carModel]) {
if (conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')) {
conv.ask(new Suggestions('Next Location'));
}
return conv.ask(`I'm sorry but that car model isn't available at ${conv.data.currentLocation.name} you can choose between ${conv.data.carsNames.toString().replaceAll(',', ' and ')}. Which one do you want?`);
}
let car = conv.data.cars[carModel][0];
conv.user.storage.carWaitingForConfirmation = car;
let carName = car.carModelID.manufacturer;
const battery = car.batteryChargeLevel;
const pricePerKM = car.pricing.pricePerKM;
const pricePerMinDay = car.pricing.pricePerDayMin;
const pricePerMinNight = car.pricing.pricePerNightMin;
if (conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')) {
conv.ask(new Suggestions(['Yes', 'No']));
}
return conv.ask(`${carName} at ${conv.data.currentLocation.name} has ${battery}% of battery and costs ${pricePerMinDay}€ per minute and ${pricePerKM}€ per kilometer. Is that okay?`);
}
);
更新#1
我在真实的设备上测试了它,在那里它工作正常。看起来,问题在于谷歌的操作。奇怪的是,它可以在设备上工作,但不能在模拟器上工作 但实际上,我认为应该是
handler\u permission\u location\u details
intent在Dialogflow中声明事件actions\u intent\u permission
我还有一个代理,它可以执行位置许可来查找附近的超市。这是一个很有效的小片段。定位超市-解析权限
意图是对定位超市
的后续操作
app.intent('Locate supermarkets', conv => {
conv.ask(new aog.Permission({
permissions: 'DEVICE_PRECISE_LOCATION',
context: 'To look for supermarkets near you'
}));
});
app.intent('Locate supermarkets - Resolve permission', (conv) => {
if (!!conv.arguments.get('PERMISSION')) {
// permission granted
} else {
// permission NOT granted
}
});
是Locate-Resolve权限
声明了actions\u intent\u permission
事件并实现了结果处理程序
谢谢你,很抱歉,就像你说的那样,它应该可以工作:/,但是问题仍然存在于模拟器上,而在设备上它工作得很好。我感觉到了你的痛苦。我也经历过模拟器与设备不一样的情况。这令人沮丧,但可以理解,因为这是一个年轻的平台。如果您确信这是仿真器中的一个bug,那么可以创建一个问题报告。他们反应很快。不久前,我报告并确认了一个错误,它发生在非英语语言中。