Tag: botframework

Botframework findEntity()问题

我遇到了一个奇怪的问题。 最初我有这个让我的实体,它正常工作。 x = builder.EntityRecognizer.findEntity(args.entities, 'get_x'); 然而,由于某种原因,我似乎无法弄清楚为什么,它停止了工作,我不得不改变它添加一个额外的intent ,让它再次工作。 x = builder.EntityRecognizer.findEntity(args.intent.entities, 'get_x'); 当我认为这开始发生时,我正在改变我对LUIS的一个意图。 然后我立即撤消所有的意图的变化,但是我所有的意图都受到了某种影响,因为我需要为findEntity()方法的实体参数添加另一个附加intent 。 有什么我改变,可能会导致这个? 编辑:实际上改变我的LUIS意图不应该有影响,因为我有另一个机器人使用相同的LUIS模型,它仍然正常工作。 编辑2:我的args返回我这个: { action: '*:SomeIntent', intent: { score: 0.999846458, intent: 'SomeIntent', intents: [ [Object], [Object], [Object], [Object], [Object], [Object], [Object] ], entities: [ [Object], [Object], [Object], [Object] ] }, libraryName: '*' } 最初我可以使用args.entitiesfind我的实体,但现在格式改变了,我必须使用args.intent.entitiesfind我的实体。 我find了这个使用args.entities例子,而这个使用了args.intent.entities 。 我知道这并不影响我,因为我可以改变我的代码,但我很想知道为什么会发生这种情况? 谢谢。

为什么微软僵尸框架不可扩展?

集群后,它不能按预期工作,一次又一次地问我的名字。 我错过了什么吗? 这是我的微软bot框架的代码。 server.js var worker = require('./worker'); var cluster = require('cluster'); var spawnWorker = function() { worker.createServer(); }; var createCluster = function() { if(cluster.isMaster) { var cpus = require('os').cpus().length; for(var i = 0; i < cpus; i++) { cluster.fork(); } cluster.on('online', function(wkr) { console.log('Worker started', wkr.process.pid); }); cluster.on('exit', function(wkr) { console.log('Worker died, respawing', wkr.process.pid); […]

如何在Microsoft Bot Framework的node.js版本中“退出”?

我想调用session.endDialog,只要用户input“退出”作为消息。 目前,我的机器人有很多types的对话,但是我希望机器人在用户键入“退出”时结束对话,而不pipe用户当前在哪个对话中。 有没有办法做到这一点?

testingMicrosoft Bot Frameworkasynchronous回复

我正在使用Mocha和Chai(BDD模式)testing我的Bot。 我想从事件发射器收听,看看我收到了哪些回复,并根据我发送的文本判断是否有意义。 我的testing通常遵循这个模式: beforeEach(function (done) { bot = require('myModule').textBot; bot.removeAllListeners('reply'); done(); }); describe('', function(){ it('', function (done) { bot.on('reply', function (message) { assert.include(message.text.toLowerCase(), ''); done(); }); bot.processMessage({text: 'message_that_will_trigger'}); }); }); 我有多个描述和多个我的testing。 有时,错误的回复回复会触发回复(即使我重置beforeEach上的所有callback),所以testing将会失败。 如果我只运行特定的testing。 他们通过。 这是testing这个最好的方法吗? 我该如何解决这个问题?

由用户退出CommandDialog

我试图find一种方式退出CommandDialog对话框时,用户使用back或cancel或以其他方式改变主意。 var startCommands = new builder.CommandDialog(); bot.add('/', [ function (session, results) { session.send('Hello %s', session.userData.name); // starting a dialog based on CommandDialog session.beginDialog('/begin'); }, function (session, results) { // This is where I want to be when dialog cancel of back is initiated by a user inside /begin session.send("you are back at the main dialog, […]

错误:与MS botframework调用session.endDialog()太多

我有一个这样的游戏来创build一个虚构的公用事业公司,并看着使用LUIS来解释我的回应,并传回信息。 我很高兴LUIS的一面。 如果我问“我的天然气合同什么时候开始”,我得到以下回复: { "query": "when did my gas contract start", "intents": [ { "intent": "StartDate", "score": 0.9994442 } ], "entities": [ { "entity": "gas", "type": "ProductType", "startIndex": 12, "endIndex": 14, "score": 0.998134553 } ] } 所以一个“startdate”和一个实体“gas”的意图。 在我的app.js中,我有以下行: dialog.on('StartDate', [askProduct, answerQuestion('StartDate', prompts.answerStartDate)]); 当我(我认为)做瀑布部分时,我得到标题中的错误。 我不确定这是否与我的generics瀑布答案,我无耻地从基础multiTurn的例子偷走了。 所以我的答案代码如下: function answerQuestion(field, answerTemplate) { return function (session, results) { // […]

bot.beginDialog到特定的用户和频道

我希望我的机器人能够在未来的某个时候与其他用户开始新的对话。 而不是像Bot连接器Node.js文档中的传入POST消息启动的,我试图从对话本身开始。 对于Node:使用require('botconnector') , ConnectorClient()或Bot连接器REST API,推荐使用哪种方法还不太清楚。 然而,基于run-async和LUIS的例子,我注意到beginDialog实际上允许你指定目标地址: bot.beginDialog(address, '/run-async/runner', { name: name }); 或者cortanaBot.beginDialog({ from: alarm.from, to: alarm.to }, '/notify', alarm); 我认为这是相当直接和清晰的方法,但是,僵尸简单地停止响应,当我包含这样的参数(它的工作原理,如果我只是使用session.beginDialog('/myalarm', { alarm: "some alarm" }); )。 我错过了什么吗? require('dotenv').config(); var restify = require('restify'); var builder = require('botbuilder'); // Get secrets from server environment var botConnectorOptions = { appId: process.env.BOTFRAMEWORK_APPID, appSecret: process.env.BOTFRAMEWORK_APPSECRET }; // Create […]

微软Botframework Prompts.choice没有得到validation响应

我正在使用chatconnector将我的Bot连接到前端聊天应用程序,并将机器人的响应写入我自己的数据库。 问题是,当我validation提示机器人响应,但没有API让我抓住validation响应。 bot.dialog('/', [ function (session) { builder.Prompts.choice(session, "Which color?", "red|green|blue"); }, function (session, results, next) { //after the user respond, the bot validates the input, if it's not //one of the choices, this next function in the waterfall doesn't //even run, therefore I have no way to write the bot response //into my own […]

Docker上的Bot框架模拟器和其他Node.js中Bot Builder的问题

我努力使bot-framework-emulator和Node.js Builder的Bot Builder在Linux下工作。 由于Linux的bot-framework-emulator需要mono,所以我决定在Docker下面用Dockerfile运行它: FROM mono:latest EXPOSE 9000 COPY . BotFrameworkEmulator-Console/ CMD [ "mono", "./BotFrameworkEmulator-Console/BFEmulator.exe" ] 我用命令启动它(也暴露端口9000): docker run -it –rm -p 9000:9000 bfemulator 它开始很好,似乎工作。 这是第一个问题。 bot-framework-emulator页面声明: 对于在Mac和Linux上开发的人,我们已经创build了一个仅使用单声道的控制台版本。 这是否意味着它不包含web界面作为bot变种bot emu? 因为netstat -al报告比BFEmulator.exe正在监听端口9000,但在访问localhost:9000时无法从docker主机访问。 从Docker容器内部不能访问。 第二个问题是比我甚至不能使用BFEmulator的控制台模式。 在我的主机上,我正在运行nodejs docker bot示例,在部署到“Microsoft Bot Framework”时工作正常。 以下是示例代码: var restify = require('restify'); var builder = require('botbuilder'); //========================================================= // Bot Setup //========================================================= // Setup […]

在Facebook Messenger上使用Bing Speech Recognition API和node.js Bot Framework

当使用Facebook Messenger中的录音(麦克风)button与我的node.js chatbot聊天时,我想使用Bing语音识别API将语音转换为文本。 我设法使用BotBuilder-Samples的说明将语音转换为文本。 但是,根据Speech API的文档 ,只有audio/ wav编解码器被支持。 我已经检查了Messenger中audiologging附件的内容types,并将它们编码为audio / aac。 我想问你是否有一个很好的方法来将audio / aac转换为audio / wav,或者是否有其他方法让Messenger能够使用Bing Speech Recognition API。 理想情况下,已经有了现有的node.js代码,可以适应我现有的聊天机器人。 谢谢,最好的问候!