1 回答
TA贡献1890条经验 获得超9个赞
当在意图 2 中发生时,在意图 1 中看不到清除用户存储或更新。所做的工作是在 regio_kiezen 意图中创建一个新的用户存储变量。创建一个全局变量来存储该值。在 Regio 意图中检查该变量是否未定义,然后选择选择用户存储或创建的变量。我知道这可能不是很清楚,所以请看一下代码:
app.intent('regio_kiezen', (conv, params) => {
console.log(`user1: ${conv.user.storage.regio}`);
p = 0;
r++;
conv.user.storage.regio = '';
conv.user.storage.regio = params['regio'];
test = conv.user.storage.regio;
test2 = params['regio'];
conv.user.storage.regio2 = test2;
tert = conv.user.storage.regio2;
console.log("testt: " + test + " test2: " + test2);
console.log(`tert: ${conv.user.storage} en ${conv.user.storage.regio2} en ${tert}`);
conv.followup('Regio');
console.log("intent: regio kiezen intent");
return tert;
});
app.intent('Regio', (conv) => {
p++;
console.log("regio intent");
console.log(`tertt: ${conv.user.storage.regio2} en ${tert}`);
//console.log("test: " + test + " test2: " + test2);
console.log(`doebiedushi: ${conv.user.storage.regio}`);
if (tert === undefined) {
var regioo = conv.user.storage.regio;
} else {
var regioo = tert;
}
conv.ask(new Suggestions(['Regio veranderen', 'Meer nieuws']));
return axios.get(`https:url/${regioo}`)
.then((result) => { //rest of code
这有效并存储在会话和对话之间!
添加回答
举报