【发布时间】:2018-12-01 20:43:28
【问题描述】:
我想在不使用 azure 平台的情况下创建机器人服务。使用 microsoft bot 平台和 luis 的 bot 应用程序。
有什么解决办法吗??
【问题讨论】:
标签: azure botframework chatbot azure-language-understanding
我想在不使用 azure 平台的情况下创建机器人服务。使用 microsoft bot 平台和 luis 的 bot 应用程序。
有什么解决办法吗??
【问题讨论】:
标签: azure botframework chatbot azure-language-understanding
没有。为了使用 Bot Service 或 LUIS,您需要 Azure(这两者都是必需的)。
【讨论】:
您可以使用 Luis 和 Visual Studio 创建聊天机器人,然后使用机器人模拟器。您可以在 Luis 中创建意图和实体,并将它们添加到 c# 代码中。但是要发布机器人,您应该在 azure 中订阅。
【讨论】:
同样的结论 - 你必须在 Azure 上创建一个帐户 - 订阅它 - 提供你的信用卡,最后你可以发布你的机器人(在线)。
在 GitHub 上发布项目以最终使其成为免费增值是很奇怪的。 希望Ms能够在框架V4中实现。
【讨论】:
没有 Azure 订阅就不可能拥有 MS Bot,因为您必须在 Azure 中注册该 bot,这不花一分钱。谈到成本,问题是您是否可以使用其他托管服务商。
我有一个 botbuilder@4.0.0-preview1.2 在 DigitalOcean 上运行没有问题。 不幸的是,目前@4.1.2 版本并非如此。我倾向于说官方版本没有解决方案,尽管它在模拟器中工作。
尝试使用 botbuilder@4.1.7 进行下面的更改会导致:“向您的机器人发送此消息时出错:HTTP 状态代码 ServiceUnavailable”
为了使“botbuilder@4.0.0-preview1.2”正常工作,我对来自此示例https://github.com/Microsoft/BotBuilder-Samples/blob/master/samples/javascript_typescript/13.basic-bot/src/index.ts 的 index.ts 和 bot.ts 进行了以下更改。
1) 删除此导入 (index.ts)
// import { BotConfiguration, IEndpointService } from 'botframework-config';
2) 删除此配置(index.ts)
// const BOT_FILE = path.join(__dirname, '..', (process.env.botFilePath || ''));
// let botConfig: BotConfiguration;
// try {
// // Read bot configuration from .bot file.
// botConfig = BotConfiguration.loadSync(BOT_FILE, process.env.botFileSecret);
// } catch (err) {
// console.error(`\nError reading bot file. Please ensure you have valid botFilePath and botFileSecret set for your environment.`);
// console.error(`\n - The botFileSecret is available under appsettings for your Azure Bot Service bot.`);
// console.error(`\n - If you are running this bot locally, consider adding a .env file with botFilePath and botFileSecret.`);
// console.error(`\n - See https://aka.ms/about-bot-file to learn more about .bot file its use and bot configuration.\n\n`);
// process.exit();
// }
3) 摆脱这个 (index.ts)
// const BOT_CONFIGURATION = (process.env.NODE_ENV || DEV_ENVIRONMENT);
// const endpointConfig = <IEndpointService>botConfig.findServiceByNameOrId(BOT_CONFIGURATION);
4) 替换 (index.ts)
// const adapter : BotFrameworkAdapter = new BotFrameworkAdapter({
// appId: endpointConfig.appId || process.env.microsoftAppID,
// appPassword: endpointConfig.appPassword || process.env.microsoftAppPassword
// });
有
const adapter : BotFrameworkAdapter = new BotFrameworkAdapter({
appId: process.env.microsoftAppID,
appPassword: process.env.microsoftAppPassword
});
5) 替换 (index.ts)
// let bot: BasicBot;
// try {
// bot = new BasicBot(conversationState, userState, botConfig);
// } catch (err) {
// console.error(`[botInitializationError]: ${ err }`);
// process.exit();
// }
有
let bot: BasicBot;
try {
bot = new BasicBot(conversationState, userState);
} catch (err) {
console.error(`[botInitializationError]: ${ err }`);
// process.exit();
}
6) 现在在 bot.ts 中通过删除第三个参数“botConfig”https://github.com/Microsoft/BotBuilder-Samples/blob/master/samples/javascript_typescript/13.basic-bot/src/bot.ts 来更改 Bot 构造函数的签名。
替换
// constructor(conversationState: ConversationState, userState: UserState, botConfig: BotConfiguration) {...
有
constructor(conversationState: ConversationState, userState: UserState) {...
7) 删除 bot.ts 中对 botConfig 的所有引用,因为这似乎只用于其他 Azure 服务
// if (!botConfig) throw ('Missing parameter. botConfig is required');
//
// add the LUIS recognizer
// let luisConfig: LuisService;
// luisConfig = <LuisService>botConfig.findServiceByNameOrId(LUIS_CONFIGURATION);
// if (!luisConfig || !luisConfig.appId) throw ('Missing LUIS configuration. Please follow README.MD to create required LUIS applications.\n\n');
// this.luisRecognizer = new LuisRecognizer({
// applicationId: luisConfig.appId,
//
// CAUTION: Its better to assign and use a subscription key instead of authoring key here.
// endpointKey: luisConfig.authoringKey,
// endpoint: luisConfig.getEndpoint()
// });
8) 不要忘记根据bot.ts中步骤7的已删除变量删除所有逻辑。
【讨论】: