【发布时间】:2017-01-30 20:40:36
【问题描述】:
在 Azure 的新机器人服务上部署了一个 LUIS 模板。在本地测试了代码,它运行良好。但是,在将相同的代码加载到机器人服务时,我无法检索 LUIS 生成的实体。
下面是这段代码:
bot.dialog('/', intents);
intents.matches('getWeather',[
function(session, args, next)
{
//session.send("Inside weather intent")
var intent = args.intent;
var location = builder.EntityRecognizer.findEntity(intent.entities, 'place');
我还尝试了以下方法:
var location = builder.EntityRecognizer.findEntity(args.entities, 'place');
最后:
var location = builder.EntityRecognizer.findEntity(args.intent.entities, 'place');
似乎无法检索实体。我在控制台上使用 i/o 在本地尝试了以下代码,它工作正常:
bot.dialog('/', dialog);
dialog.matches('getWeather',[
function(session, args, next)
{
console.log("Inside weather intent")
var location = builder.EntityRecognizer.findEntity(args.entities, 'place');
LUIS 模型已经过训练,我交叉检查了 API 变量。意图也被正确识别和触发。输出为“null”或“[object Object]”
【问题讨论】:
-
根据示例github.com/Microsoft/BotBuilder-Samples/blob/master/Node/…,我们需要使用
args.entities,顺便问一下,如果place,你能确定你有特定的类型吗? -
@GaryLiu-MSFT,是的,我已经交叉检查了这些实体。也针对不同的实体集尝试了其他意图。使用控制台在本地执行代码作为输出会产生所需的结果。但是,部署到 Bot Service 的代码似乎没有检测到实体。我已经尝试了 GItHub 上发布的示例列表以及主要文档中的所有可能组合,但无济于事。
标签: node.js azure botframework