Botframework 未找到适用于区域设置的LUIS模型';en';
当尝试使用BotFramework模拟器在本地调试我的聊天机器人时,当机器人尝试响应时,我在控制台中得到以下输出Botframework 未找到适用于区域设置的LUIS模型';en';,botframework,azure-language-understanding,Botframework,Azure Language Understanding,当尝试使用BotFramework模拟器在本地调试我的聊天机器人时,当机器人尝试响应时,我在控制台中得到以下输出 Session.beginDialog(/) console.pub.js:42 Error: LUIS model not found for locale 'en'. console.pub.js:42 at LuisRecognizer.onRecognize (c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\LuisR
Session.beginDialog(/)
console.pub.js:42
Error: LUIS model not found for locale 'en'.
console.pub.js:42
at LuisRecognizer.onRecognize (c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\LuisRecognizer.js:71:26)
at c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\IntentRecognizer.js:18:23
at next (c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\IntentRecognizer.js:50:17)
at LuisRecognizer.IntentRecognizer.isEnabled (c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\IntentRecognizer.js:53:9)
at LuisRecognizer.IntentRecognizer.recognize (c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\IntentRecognizer.js:10:14)
at LuisRecognizer.recognizer.recognize (c:\Bots\sdk3\node_modules\botbuilder-instrumentation\dist\main.js:224:32)
at c:\Bots\sdk3\node_modules\botbuilder\lib\dialogs\IntentRecognizerSet.js:68:28
at c:\Bots\sdk3\node_modules\botbuilder\node_modules\async\lib\async.js:181:20
at replenish (c:\Bots\sdk3\node_modules\botbuilder\node_modules\async\lib\async.js:319:21)
at c:\Bots\sdk3\node_modules\botbuilder\node_modules\async\lib\async.js:330:15
/ - ERROR: LUIS model not found for locale 'en'.
console.pub.js:42
/ - Session.endConversation()
我正在通过将模拟器连接到我的聊天机器人,从我看到的错误似乎与“Locale:”字段有关。然而,无论我做了什么改变,我都会得到一个与上面类似的错误。我的代码中是否有需要更改的地方,或者这纯粹是仿真器的问题
下面是导致问题的代码段。当试图将q_BBApps意图与代码中的任何其他应用程序一起使用时,它会抛出上述错误。在azure中或使用webchat频道时,此功能可以正常工作
var restify = require('restify');
var builder = require('botbuilder');
var azure = require('botbuilder-azure');
const instrumentation = require('botbuilder-instrumentation');
// Setting up advanced instrumentation
let logging = new instrumentation.BotFrameworkInstrumentation({
instrumentationKey: process.env.APPINSIGHTS_INSTRUMENTATION_KEY,
sentiments: {
key: process.env.CG_SENTIMENT_KEY,
},
// Will omit the user name from the logs for anonimization
omitUserName: false,
// Application insights options, all set to false by default
autoLogOptions: {
autoCollectConsole: true,
autoCollectExceptions: true,
autoCollectRequests: true,
autoCollectPerf: true // (auto collect performance)
}
});
// LUIS Link
var model = process.env.LUIS_URL;
let recognizer = new builder.LuisRecognizer(model);
logging.monitor(bot, recognizer);
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Table storage setup
var tableName = process.env.AZURE_TABLE_NAME; // You define
var storageName = process.env.AZURE_STORAGE_NAME; // Obtain from Azure Portal
var storageKey = process.env.AZURE_STORAGE_KEY; // Obtain from Azure Portal
var azureTableClient = new azure.AzureTableClient(tableName, storageName, storageKey);
var tableStorage = new azure.AzureBotStorage({
gzipData: false
}, azureTableClient);
// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword,
stateEndpoint: process.env.BotStateEndpoint,
openIdMetadata: process.env.BotOpenIdMetadata
});
// Listen for messages from users
server.post('/api/messages', connector.listen());
// help messages and welcome messages
var helpMessage = "\n * Looking for help with Oracle R12, SharePoint or Yammer? Just start asking a question \n * If you're after anything specific choose one of the options below \n * If you need assistance at any point type 'Help' to bring up the help menu \n * You can cancel an action at any point by typing Cancel";
// Setup bot with default dialog
var bot = new builder.UniversalBot(connector)
.set('storage', tableStorage);
// Enable Conversation Data persistence
bot.set('persistConversationData', true);
// sets up the luis intent searching
var intents = new builder.IntentDialog({
recognizers: [recognizer]
});
//=========================================================
// Bots Events
//=========================================================
//Sends greeting message when the bot is first added to a conversation
bot.on('event', function(message) {
if(message.name == 'requestWelcomeDialog'){
bot.beginDialog(message.address, 'welcome');
}
});
// sets the default intent. this is needed for the welcome message to pass users into a normal conversation
bot.dialog('/', intents);
//Rest API call to the BBApps QnA service which & return results in cards
intents.matches('q_BBApps', [
function (session) {
var SPQuestion = session.message.text;
var request = require('request');
request({
method: 'Post',
headers: {
'Content-Type': 'application/json',
'Authorization': 'EndpointKey ' + process.env.QNA_endpointKey
},
body: {
"question": SPQuestion,
"top": 1
},
uri: process.env.QNA_BBAPPS_URL,
json: true
}, function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
var isCardFormat = body.answers[0].answer.includes('///');
if (!isCardFormat) {
// Not semi colon delimited, send a normal text response
let customEventName = 'BBApps - Non Card';
logging.trackCustomEvent(customEventName, session.message);
session.send(body.answers[0].answer);
} else if (body.answers && body.answers[0].score >= 0.1) {
var qnaAnswer = body.answers[0].answer;
var qnaAnswerData = qnaAnswer.split('///');
var title = qnaAnswerData[0];
var description = qnaAnswerData[1];
var url = qnaAnswerData[2];
var imageURL = qnaAnswerData[3];
var msg = new builder.Message(session);
msg.attachments([
new builder.HeroCard(session)
.title(title)
.text(description)
.images([builder.CardImage.create(session, imageURL)])
.buttons([
builder.CardAction.openUrl(session, url, "Learn More")
])
]);
}
let customEventName = 'BBApps';
logging.trackCustomEvent(customEventName, session.message);
session.send(msg);
session.endDialog();
});
}
]);
//Rest API call to raise an issue within gitlab
intents.matches('l_issue.Raiser', [
function(session) {
if (session.message && session.message.value) {
// A Card's Submit Action obj was received
processSubmitAction(session, session.message.value);
return;
}
var card = {
'contentType': 'application/vnd.microsoft.card.adaptive',
'content': {
'$schema': 'http://adaptivecards.io/schemas/adaptive-card.json',
'type': 'AdaptiveCard',
'version': '1.0',
'body': [
{
'type': 'Container',
'items': [
{
'type': 'ColumnSet',
'columns': [
{
'type': 'Column',
'width': 'stretch',
'items': [
{
'type': 'TextBlock',
'text': 'Welcome to the Issue Raiser!',
'speak': '<s>Welcome to the Issue Raiser! Please note that this skill is not to raise issues with the knowledge of BB Bot.</s>',
'weight': 'bolder',
'size': 'large'
},
{
'type': 'TextBlock',
'text': 'Please note that this skill is not to raise issues with the knowledge of BB Bot.',
'wrap': true,
'speak': '<s>Please note that this skill is not to raise issues with the knowledge of BB Bot.</s>'
},
{
'type': 'TextBlock',
'text': 'Please enter a title for your issue:*'
},
{
'type': 'Input.Text',
'id': 'issueTitle',
'speak': '<s>Please enter a title for your issue</s>',
'style': 'text'
},
{
'type': 'TextBlock',
'text': 'Please write a description for your issue:*'
},
{
'type': 'Input.Text',
'id': 'issueDescription',
'speak': '<s>Please write a description for your issue</s>',
'style': 'text'
},
{
'type': 'TextBlock',
'text': 'What is your email address?*'
},
{
'type': 'Input.Text',
'id': 'issueEmail',
'speak': '<s>What is your email address?</s>',
'style': 'text'
}
]
}
]
}
]
}
],
'actions': [
{
'type': 'Action.Submit',
'title': 'OK',
'data' : {
'type':'issueRaiser'
}
}
]
}
};
var msg = new builder.Message(session)
.addAttachment(card);
session.send(msg);
}
]);
//Allows the user to cancel the currently running command.
bot.dialog('issue-raiser', (session, issueRaiser) => {
var bugTitle = issueRaiser.issueTitle;
var bugDesc = issueRaiser.issueDescription;
var bugEmail = issueRaiser.issueEmail;
session.send("Function Started" + bugDesc + bugEmail + bugTitle)
session.endDialog();
});
function processSubmitAction(session, value) {
var defaultErrorMessage = "Please complete all of the required fields."
switch (value.type) {
case 'issueRaiser':
if (validateIssueRaiser(value)) {
session.beginDialog('issue-raiser', value);
}
break;
}
}
function validateIssueRaiser(issueRaiser) {
if (!issueRaiser) {
return false;
}
// Issue Description
var hasissueDescription = typeof issueRaiser.issueDescription === 'string' && issueRaiser.issueDescription.length > 3;
// Issue Title
var hasissueTitle = typeof issueRaiser.issueTitle === 'string' && issueRaiser.issueTitle.length > 3;
// Issue Email
var hasissueEmail = typeof issueRaiser.issueEmail === 'string' && issueRaiser.issueEmail.length > 3;
return hasissueDescription && hasissueTitle && hasissueEmail;
};
/*-----------------------------------------------------------------------------
Bot Dialogs
-----------------------------------------------------------------------------*/
// Welcome message - gets sent at the start of a convo
bot.dialog('welcome', function (session) {
//Send a help message
// Add the help dialog to the top of the dialog stack
// (override the default behavior of replacing the stack)
var msg = new builder.Message(session);
msg.attachmentLayout(builder.AttachmentLayout.carousel);
msg.attachments([
new builder.HeroCard(session)
.title("Help")
.text("Hi. I'm BB Bot and i can help you with the following: %s", helpMessage)
.buttons([
builder.CardAction.imBack(session, "I'd like to get an update on a ticket", "ServiceNow Status Update"),
builder.CardAction.imBack(session, "I'd like to search the Service Now Knowledge Base", "ServiceNow Knowledge Base Search"),
builder.CardAction.postBack(session, "/feedback", "Provide feedback")
]),
]);
session.send(msg);
session.endDialog();
let customEventName = 'Welcome';
logging.trackCustomEvent(customEventName, session.message);
session.endDialog();
})
// Once triggered, will start a new dialog as specified by
// the 'onSelectAction' option.
.triggerAction({
matches: /help/i,
});
//Allows the user to cancel the currently running command.
bot.dialog('/cancel', (session) => {
let customEventName = 'Cancel';
logging.trackCustomEvent(customEventName, session.message);
session.send('The current actioned has been cancelled. either try again or type "Help"');
//return session.beginDialog('/');
session.endDialog();
})
.triggerAction({
matches: /cancel/i,
});
// Ends the currently running speach and launches the Help menu
bot.dialog('help', function (session) {
//Send a help message
// Add the help dialog to the top of the dialog stack
// (override the default behavior of replacing the stack)
var msg = new builder.Message(session);
msg.attachmentLayout(builder.AttachmentLayout.carousel);
msg.attachments([
new builder.HeroCard(session)
.title("Help")
.text("looks like you've requested some help. Here's a list of handy options you can choose to talk to me about. Please select one below %s", helpMessage)
.buttons([
builder.CardAction.imBack(session, "I'd like to get an update on a ticket", "ServiceNow Status Update"),
builder.CardAction.imBack(session, "I'd like to search the Service Now Knowledge Base", "ServiceNow Knowledge Base Search"),
builder.CardAction.postBack(session, "/feedback", "Provide feedback")
]),
]);
session.send(msg);
session.endDialog();
let customEventName = 'Help';
logging.trackCustomEvent(customEventName, session.message);
session.endDialog("Global help menu.");
})
// Once triggered, will start a new dialog as specified by
// the 'onSelectAction' option.
.triggerAction({
matches: /help/i,
});
// feedback function - asks user for feedback and then submits to the database
// This is pulled out in the powerbi report
bot.dialog('/feedback', [
function (session) {
builder.Prompts.text(session, "Please type in your feedback");
},
function (session, results) {
session.dialogData.feedbackData = results.response;
builder.Prompts.text(session, "Please provide your name");
},
function (session, results) {
session.dialogData.feedbackName = results.response;
// Process request and display reservation details
session.send('Thank you. Your feedback has been sent');
session.conversationData.feedback = session.dialogData.feedbackData;
session.conversationData.feedbackUser = session.dialogData.feedbackName;
session.save();
let customEventName = 'Feedback';
let customEventData = {
feedback: session.dialogData.feedbackData,
feedbackUser: session.dialogData.feedbackName
};
logging.trackCustomEvent(customEventName, customEventData, session);
session.endDialog();
}
])
.triggerAction({
matches: /feedback/i,
});
// Default message is a LUIS intent isnt found for the given text
intents.onDefault([
function (session) {
session.send("Sorry, i didn't understand that. Could you try rephrasing your question?");
}
]);
var restify=require('restify');
var builder=require('botbuilder');
var azure=require('botbuilder-azure');
const instrumentation=require('botbuilder-instrumentation');
//建立先进的仪器
let logging=new instrumentation.BotFrameworkInstrumentation({
instrumentationKey:process.env.APPINSIGHTS_INSTRUMENTATION_KEY,
感想:{
关键字:process.env.CG\u情绪\u关键字,
},
//将从日志中省略用户名以进行命名
用户名:false,
//Application insights选项,默认情况下全部设置为false
自动选择:{
autoCollectConsole:正确,
autoCollectExceptions:true,
自动采集器要求:正确,
autoCollectPerf:true/(自动采集性能)
}
});
//路易斯链接
var模型=process.env.LUIS_URL;
让识别器=新的构建器。路易斯识别器(模型);
日志记录。监视器(机器人、识别器);
//安装Restify服务器
var server=restify.createServer();
侦听(process.env.port | process.env.port | 3978,函数(){
console.log(“%s正在侦听%s”、server.name、server.url);
});
//表存储设置
var tableName=process.env.AZURE_TABLE_NAME;//你定义
var storageName=process.env.AZURE_STORAGE_NAME;//从Azure门户获取
var storageKey=process.env.AZURE_STORAGE_KEY;//从Azure门户获取
var azureTableClient=new azure.azureTableClient(tableName、storageName、storageKey);
var tableStorage=new azure.AzureBotStorage({
gzipData:false
},azureTableClient);
//创建聊天连接器以与Bot框架服务通信
var connector=new builder.ChatConnector({
appId:process.env.MicrosoftAppId,
appPassword:process.env.MicrosoftAppPassword,
stateEndpoint:process.env.BotStateEndpoint,
openIdMetadata:process.env.BotOpenIdMetadata
});
//侦听来自用户的消息
server.post('/api/messages',connector.listen());
//帮助信息和欢迎信息
var helpMessage=“\n*正在寻找有关Oracle R12、SharePoint或Yammer的帮助?只需开始问一个问题\n*如果您需要任何特定的帮助,请选择下面的选项之一\n*如果您在任何时候需要帮助,请键入“帮助”以打开“帮助”菜单\n*您可以通过键入“取消”在任何时候取消操作”;
//使用默认对话框设置bot
var bot=new builder.UniversalBot(连接器)
.set(“存储”,表存储);
//启用会话数据持久性
bot.set('persistConversationData',true);
//设置路易斯意图搜索
var intents=新建生成器.IntentDialog({
识别器:[识别器]
});
//=========================================================
//机器人事件
//=========================================================
//首次将bot添加到对话时发送问候消息
在('event',函数(message){
如果(message.name==“requestWelcomeDialog”){
bot.beginDialog(message.address,'welcome');
}
});
//设置默认意图。这是欢迎消息将用户传递到正常对话中所必需的
bot.dialog(“/”,意图);
//对BBApps QnA服务的restapi调用,返回卡片结果(&R)
意向匹配('q_BBApps'[
职能(会议){
var SPQuestion=session.message.text;
var请求=要求(“请求”);
请求({
方法:“Post”,
标题:{
“内容类型”:“应用程序/json”,
“授权”:“EndpointKey”+process.env.QNA_EndpointKey
},
正文:{
"问题":,
“顶级”:1
},
uri:process.env.QNA_BBAPPS_URL,
json:true
},函数(错误、响应、正文){
console.log('error:',error);//如果发生错误,请打印错误
var isCardFormat=body.answers[0]。answer.includes('//');
如果(!isCardFormat){
//不以分号分隔,发送普通文本响应
让customEventName='BBApps-非卡';
logging.trackCustomEvent(customEventName,session.message);
session.send(body.answers[0].answer);
}else if(body.answers&&body.answers[0]。分数>=0.1){
var qnaAnswer=body.answers[0]。answer;
var qnaAnswerData=qnaAnswer.split('//');
var title=qnaAnswerData[0];
var description=qnaAnswerData[1];
var url=qnaAnswerData[2];
var-imageURL=qnaAnswerData[3];
var msg=newbuilder.Message(会话);
msg.attachments([
新建builder.HeroCard(会话)
.头衔(头衔)
.文本(说明)
.images([builder.CardImage.create(会话,图像URL)])
.按钮([
builder.CardAction.openUrl(会话,url,“了解更多”)
])
]);
}
让customEventName='BBApps';
logging.trackCustomEvent(customEventName,session.message);
session.send(msg);
session.endDialog();
});
}
]);
//RESTAPI调用在gitlab中引发问题
意图.匹配('l_issue.Rais