gpt4 book ai didi

dialogflow-es - Actions on Google - 突然进入后备权限

转载 作者:行者123 更新时间:2023-12-04 00:04:18 24 4
gpt4 key购买 nike

在我的设备上,它会记住位置许可已被接受并跟进意图,其他一切正常。但是在模拟器上它不想再记住了。它一直在说:

Sorry, I didn't understand. Right away but first, I need to get your current location from Google. Is that alright?



无论如何,如果你说是,不管它不会去。
就像他要求位置许可的意图仍然存在。
这是我的 webhook,并提供了一些模拟器和调试的屏幕截图。
    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?`);
}
);

enter image description here
enter image description here
enter image description here
enter image description here

更新 #1
我在真实设备上对其进行了测试,并且可以正常工作。看起来,问题在于对谷歌的操作。

最佳答案

它适用于设备但不适用于模拟器,这似乎很奇怪。

但实际上,我认为它应该是handler_permission_location_details声明事件的意图 actions_intent_PERMISSION在对话流中。

我还有一个代理,可以实现位置权限以查找附近的超市。这是一个有效的简短片段。 Locate supermarkets - Resolve permission意图是对 Locate supermarkets 的跟进.

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 supermarkets - Resolve permission声明 actions_intent_PERMISSION事件并实现结果的处理程序

enter image description here

关于dialogflow-es - Actions on Google - 突然进入后备权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53650536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com