从瀑布对话框中的用户响应获取意图
我正在和LuisDialog合作。 对于一个特定的意图,我有一个瀑布对话框来获取来自用户的信息。 在这个过程中,我想用LUISparsing用户的句子/响应。
luisDialog.on('orderItem', [ function (session, args) { builder.Prompts.text(session, "Please enter your item ID:"); }, function (session, results) { // parse user's response with LUIS // User can text: "1245" or "my item ID is 1245" // Need to get "1245" as item_number which is an entity in LUIS train model } ]);
有什么办法可以达到这个目的吗?
我不知道是否有一种方法可以直接使用node.js. 但是,LUIS有一个REST接口。 这将使您能够调用服务并手动处理返回的JSON以获取所需的数据。
所以你可以打电话给
使用您select的REST客户端。 你会得到一个JSON响应,你可以处理提取你需要的数据。 applicationid和subscriptionkey应该replace为适合你的Luis Model的值
你可以这样做。
bot.dialog("/schedule", [ (session, args, next)=>{ builder.Prompts.text(session,"When do you prefer new appoitment"); }, (session,results,next)=>{ session.sendTyping(); builder.LuisRecognizer.recognize(results.response,model, (err,intents,entities)=>{ if(err){ console.log("Some error occurred in calling LUIS"); } console.log(intents); console.log("=================="); console.log(entities); }); } ]);