- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我面临一个问题,即在提示选择内时无法使用triggerAction 与luis 意图匹配。对于我当前的代码,如果用户键入的单词与我硬编码的确切语句(例如“Card1”)匹配,triggerAction 将开始对话框。
当用户到达card2对话框时,它将显示消息,然后是一个包含提示问题和选择的对话框(Card2Link)。
所需:如果用户决定他/她想要键入一个或多个随机单词,该单词应尝试与 luis 意图匹配并触发意图对话框。如果随机单词不符合任何 luis 意图或不符合任何 luis 意图,则会触发“请再次选择您的选择”。
实际:当用户输入随机单词时,它不会通过 luis 意图进行搜索,并立即提供错误消息“请选择您的选择。1. Card3”。
请就这个问题提出建议。我已经被这个问题困扰了很长一段时间。
var restify = require('restify');
var builder = require('botbuilder');
var botbuilder_azure = require("botbuilder-azure");
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
var connector = new builder.ChatConnector({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword,
openIdMetadata: process.env.BotOpenIdMetadata
});
server.post('/api/messages', connector.listen());
var tableName = 'dataBT';
var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, process.env['AzureWebJobsStorage']);
var tableStorage = new botbuilder_azure.AzureBotStorage({ gzipData: false }, azureTableClient);
bot.beginDialogAction('Card1', '/Card1')
// Make sure you add code to validate these fields
var luisAppId = process.env.LuisAppId;
var luisAPIKey = process.env.LuisAPIKey;
var luisAPIHostName = process.env.LuisAPIHostName || 'westus.api.cognitive.microsoft.com';
const LuisModelUrl = 'https://' + luisAPIHostName + '/luis/v1/application?id=' + luisAppId + '&subscription-key=' + luisAPIKey;
// Main dialog with LUIS
var recognizer = new builder.LuisRecognizer(LuisModelUrl);
var intents = new builder.IntentDialog({ recognizers: [recognizer] })
.matches('Card1', (session) => {
session.beginDialog('/Card1')
})
// Create your bot with a function to receive messages from the user
var bot = new builder.UniversalBot(connector);
bot.set('storage', tableStorage);
bot.dialog('/', intents);
bot.dialog('/cards', [
function (session) {
session.send('Test1');
var msg = new builder.Message(session)
.attachmentLayout(builder.AttachmentLayout.carousel)
.textFormat(builder.TextFormat.xml)
.attachments([
new builder.HeroCard(session)
.title('Test1')
.images([
builder.CardImage.create(session, 'imgURL')
])
.buttons([builder.CardAction.dialogAction(session, 'Card1', null, 'Here')
])
]);
msg.addAttachment (
new builder.HeroCard(session)
.title("Test2")
.images([
builder.CardImage.create(session, "imgUrl")
])
.buttons([
builder.CardAction.dialogAction(session, "Card2", null, "Here")
])
);
session.endDialog(msg)
}
]).triggerAction({ matches: /^hi/i });
//Adding of new card
bot.dialog('/Card1', [
function (session) {
var msg1 = new builder.Message(session).sourceEvent({
//specify the channel
facebook: {
text:"Card1"
}
});
session.endDialog(msg1)
session.beginDialog('/card1link');
}
]).triggerAction({ matches: /^Card1/i });
bot.dialog('/card1link', [
function (session, args, next) {
builder.Prompts.choice(session, '1. Card2\n2. Card3\n', ['1', '2'], {
retryPrompt: "Please pick your choice.\n1. Card2\n2. Card3\n",
maxRetries: 1
});
},
function (session, args, next) {
if (args.response) {
var choice = args.response.entity;
switch (choice) {
case '1':
session.replaceDialog('Card2');
break;
case '2':
session.replaceDialog('Card3');
break;
}
}
else{
session.send("Sorry");
}
}
]);
bot.dialog('/Card2', [
function (session) {
var msg1 = new builder.Message(session).sourceEvent({
//specify the channel
facebook: {
text:"Card2"
}
});
session.endDialog(msg1)
session.beginDialog('/card2link');
}
]).triggerAction({ matches: /^Card2/i });
bot.dialog('/card2link', [
function (session, args, next) {
builder.Prompts.choice(session, '1. Card3\n', ['1'], {
retryPrompt: "Please pick your choice.\n1. Card3\n",
maxRetries: 1
});
},
function (session, args, next) {
if (args.response) {
var choice = args.response.entity;
switch (choice) {
case '1':
session.replaceDialog('Card3');
break;
}
}
else{
session.send("Sorry");
}
}
]);
最佳答案
您可以为此使用同义词。
builder.Prompts.choice(
session,
"Selection one option",
[
{
value: "1",
synonyms: ["Card1", "Card 1"]
},
{
value: "2",
synonyms: ["Card2", "Card 2"]
}
],
{
listStyle: builder.ListStyle.button,
retryPrompt: 'Selection one option.'
}
)
关于node.js - 无法使用 TriggerAction 与 Microsoft Bot 框架 (node.js) 中的 LUIS 意图匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49645144/
我通过 spring ioc 编写了一些 Rest 应用程序。但我无法解决这个问题。这是我的异常(exception): org.springframework.beans.factory.BeanC
我对 TestNG、Spring 框架等完全陌生,我正在尝试使用注释 @Value通过 @Configuration 访问配置文件注释。 我在这里想要实现的目标是让控制台从配置文件中写出“hi”,通过
为此工作了几个小时。我完全被难住了。 这是 CS113 的实验室。 如果用户在程序(二进制计算器)结束时选择继续,我们需要使用 goto 语句来到达程序的顶部。 但是,我们还需要释放所有分配的内存。
我正在尝试使用 ffmpeg 库构建一个小的 C 程序。但是我什至无法使用 avformat_open_input() 打开音频文件设置检查错误代码的函数后,我得到以下输出: Error code:
使用 Spring Initializer 创建一个简单的 Spring boot。我只在可用选项下选择 DevTools。 创建项目后,无需对其进行任何更改,即可正常运行程序。 现在,当我尝试在项目
所以我只是在 Mac OS X 中通过 brew 安装了 qt。但是它无法链接它。当我尝试运行 brew link qt 或 brew link --overwrite qt 我得到以下信息: ton
我在提交和 pull 时遇到了问题:在提交的 IDE 中,我看到: warning not all local changes may be shown due to an error: unable
我跑 man gcc | grep "-L" 我明白了 Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more inf
我有一段代码,旨在接收任何 URL 并将其从网络上撕下来。到目前为止,它运行良好,直到有人给了它这个 URL: http://www.aspensurgical.com/static/images/a
在过去的 5 个小时里,我一直在尝试在我的服务器上设置 WireGuard,但在完成所有设置后,我无法 ping IP 或解析域。 下面是服务器配置 [Interface] Address = 10.
我正在尝试在 GitLab 中 fork 我的一个私有(private)项目,但是当我按下 fork 按钮时,我会收到以下信息: No available namespaces to fork the
我这里遇到了一些问题。我是 node.js 和 Rest API 的新手,但我正在尝试自学。我制作了 REST API,使用 MongoDB 与我的数据库进行通信,我使用 Postman 来测试我的路
下面的代码在控制台中给出以下消息: Uncaught DOMException: Failed to execute 'appendChild' on 'Node': The new child el
我正在尝试调用一个新端点来显示数据,我意识到在上一组有效的数据中,它在数据周围用一对额外的“[]”括号进行控制台,我认为这就是问题是,而新端点不会以我使用数据的方式产生它! 这是 NgFor 失败的原
我正在尝试将我的 Symfony2 应用程序部署到我的 Azure Web 应用程序,但遇到了一些麻烦。 推送到远程时,我在终端中收到以下消息 remote: Updating branch 'mas
Minikube已启动并正在运行,没有任何错误,但是我无法 curl IP。我在这里遵循:https://docs.traefik.io/user-guide/kubernetes/,似乎没有提到关闭
每当我尝试docker组成任何项目时,都会出现以下错误。 我尝试过有和没有sudo 我在这台机器上只有这个问题。我可以在Mac和Amazon WorkSpace上运行相同的容器。 (myslabs)
我正在尝试 pip install stanza 并收到此消息: ERROR: No matching distribution found for torch>=1.3.0 (from stanza
DNS 解析看起来不错,但我无法 ping 我的服务。可能是什么原因? 来自集群中的另一个 Pod: $ ping backend PING backend.default.svc.cluster.l
我正在使用Hibernate 4 + Spring MVC 4当我开始 Apache Tomcat Server 8我收到此错误: Error creating bean with name 'wel
我是一名优秀的程序员,十分优秀!