Tag: botframework

创build支持Microsoft Bot Framework中的两个LUIS应用程序的bot

我需要使用Node.js和Microsoft Bot框架来制作一个双语的机器人。 该机器人使用LUIS作为自然语言。 我使用标准的方式来插入LUIS: // Create bot, send welcome message: let bot = new builder.UniversalBot(connector, NoneIntentHandler); // Plug in LUIS: bot.recognizer(new builder.LuisRecognizer(config.luis.url)); 不过,我需要支持两种语言,英文和中文。 检测语言对我来说不是一个问题。 我有两个独立的LUIS应用程序,一个用于英文,一个用于中文,他们返回相同的意图和实体。 但问题是如何根据用户input的语言在两个不同的应用程序之间dynamic切换。 bot.recognizer不接受两个URL或任何其他参数。 所以似乎没有build立在这方面的支持。 有什么方法dynamic杀死和重新创build与另一个recognizer bot对象? 或者根据LUIS语言重新分配recognizer ? 或者有其他的办法吗?

FormFlow对话框可以使用Node.js构build吗?

Bot框架常见问题解答( http://docs.botframework.com/faq/#what-does-the-bot-builder-sdk-provide-to-developers-how-does-it-work )指出,Bot Builder SDK允许开发人员构build“FormFlow”对话框来帮助解决棘手的问题,例如多回合和消歧,但我只能在C#文档中findFormFlow。 FormFlow对话框是否可以使用Node.js SDK构build? 如果是这样,有人可以指点我的文档? 非常感谢。

C#:创build一个单一的机器人服务来支持多个机器人应用程序

此代码在此网站上https://www.microsoft.com/reallifecode/2017/01/10/creating-a-single-bot-service-to-support-multiple-bot-applications/#comment-148 我是bot框架的新手,已经在C#中编写了一个bot,想要为网页上显示的n个用户部署相同的bot。 但是给定的代码在Node.js 。 有什么办法可以在C#asp.net中编写相同的代码 var express = require('express'); var builder = require('botbuilder'); var port = process.env.PORT || 3978; var app = express(); // a list of client ids, with their corresponding // appids and passwords from the bot developer portal. // get this from the configuration, a remote API, etc. var customersBots = [ […]

Node.js的多选提示

我想在Node.js中创build一个select提示,允许用户进行多项select,就像在FormFlow for .NET中一样(请参阅Simple Sandwich Bot的提示提示)。 是否可能已经有一些我可以适应的示例代码? 这也可以用button而不是一个列表?

POST请求正文为空或空

我正在尝试向知识库发出POST请求。 我可以从这个请求中得到正确的答案,也许5-10%的时间。 所有其他时间,我从服务器得到标题中的错误: No argument passed{“Error”:{“Code”:“BadArgument”,“Message”:“Request body Is Null or Empty.”}} 我有一种感觉,这是由Node.jsasynchronous引起的,当请求通过时,我的variables仍然是未定义的。 虽然, req.write()如何包含variables? 也许我可以插入一个延迟来确保variables是在请求发送之前定义的? var https = require('https'); var resData = ""; var options = { host: "westus.api.cognitive.microsoft.com", port: 443, path: "/qnamaker/v2.0/knowledgebases/<kb-key>/generateAnswer", method : 'POST', headers: { 'Content-Type': 'application/json', "Ocp-Apim-Subscription-Key":"<sub-key>", }, }; bot.dialog('qnaReq', function (session, args) { //call QnA Bot and ask that bot […]

Facebook Messenger的微软Bot框架附件

在Facebook Messenger中带有button的微软Bot框架消息 我的问题涉及上面提到的问题。 我正在使用不使用bot构build器sdk的node.js编写一个bot。 我手动返回ms bot连接器服务的兼容响应。 这对于文本响应工作正常,但是我希望返回更复杂的响应,例如可以使用信使返回的button/旋转木马。 基于我上面链接的问题,我猜想了格式,并添加如下: response.attachments = [ { "Title": "Choose One: ", "Actions": [{ "Title": "Postback!", "Message": "Postback from button" }, { "Title": "Postback2!", "Message": "Postback2 from button" }] } ]; 顶层标题似乎什么都不做,只是操作呈现为回发typesbutton正确(他们发送消息作为回发内容)。 随着信使,你也可以select返回基于url的button,图像url。 据我所知,有关使用节点bot生成器sdk返回附件的零文档。 如果有的话,我只需要用sdk写bot就可以得到响应格式。 所以我的问题是,有没有人知道如何正确返回回发和基于URL的button到机器人连接器服务,包括附带的图像,有没有机器人build设者sdk? 更新05/05/2016 所以我find了下面的链接,你可以看到附件属性的定义: http://docs.botframework.com/sdkreference/nodejs/interfaces/_botbuilder_d_.imessage.html 如果你遵循IAttachment规范,这让我想知道为什么我的代码上面的工作呢? 作为这种格式的testing,我在下面写道: var att = {}; att.content = "I am content"; att.contentType […]

Skype bot nodejs没有正确运行

我正在试图build立Skype的机器人。 我遵循由Skype提供的文档,但没有使用它创build它。 无法从bot获得回复。 const fs = require('fs'); const restify = require('restify'); const skype = require('skype-sdk'); const botService = new skype.BotService({ messaging: { botId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx', serverUrl : "https://example.net", requestTimeout : 15000, appId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx', appSecret: 'xxxxxxxxxxxxxxxxxxxxxxxx' } }); botService.on('contactAdded', (bot, data) => { console.log("bot replay"); bot.reply('Hello ${data.fromDisplayName}!', true); }); botService.on('personalMessage', (bot, data) => { console.log("person replay"); bot.reply('Hey […]

Microsoft Bot框架:发送连接消息

我是新的微软Bot框架。 现在我正在模拟器上testing我的代码。 我想尽快发送你好消息。 以下是我的代码。 var restify = require('restify'); var builder = require('botbuilder'); 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: "– APP ID –", appPassword: "– APP PASS –" }); var bot = new builder.UniversalBot(connector); server.post('/api/message/',connector.listen()); bot.dialog('/', function […]

一个机器人支持数千个Facebook页面

我喜欢bot框架,但是我想要扩展以支持数百个Facebook页面(如果没有的话)都指向我的单个bot实例。 我的机器人实例通过传入的页面ID来区分function,或者我猜是通过MSFT App / Secret ID。 框架似乎要求MSFT托pipe的逻辑bot与FB页面之间的1:1对应关系,但是我的单个bot实例可以处理数千个这样的页面和应用程序。 看起来我可能需要为每个逻辑bot页面创build一个独特的ChatConnector和相关的UniversalBot实例。 这在我所build议的范围内是非常低效的。 解决这个问题的方法之一可能是扩展UniversalBot来接受我创build的所有MSFT App和Secret ID的列表,但是我还没有尝试过。 在审查了API之后,看起来像使用一个UniversalBot实例注册更多的连接器是可能的。 UniversalBot: /** * Registers or returns a connector for a specific channel. * @param channelId Unique ID of the channel. Use a channelId of '*' to reference the default connector. * @param connector (Optional) connector to register. If ommited the connector for […]