编写云函数:

AIUI.create("v2",  function(aiui,  err){
// 获取 response
response = aiui.getResponse();
//托管
response.addDelegateDirective();
requestObject = aiui.getRequest().getObject();
// 打印获取当前意图名
intentName = requestObject.request.intents[0].name;
console.log("本次意图来自:"+intentName);
console.log("dialogState:"+requestObject.request.dialogState);
//获取所有语槽
slots = requestObject.request.intents[0].slots;
slots.dialogState=requestObject.request.dialogState;
response.setData(slots);
aiui.commit();
})

  

05-11 13:03