简体   繁体   English

如何在不注册 Microsoft 或 Azure 的情况下托管 Microsoft Bot?

[英]How to host a Microsoft Bot without registering with Microsoft or Azure?

I've been attempting to find an alternative to registering and hosting my Microsoft Bot with Microsoft/Azure.我一直在尝试寻找在 Microsoft/Azure 上注册和托管我的 Microsoft Bot 的替代方法。 I'm aware that I can host the bot locally and simply register it with Microsoft to gain access to the various available channels but I'm looking to host my bot entirely separate from Microsoft's registration.我知道我可以在本地托管机器人,只需在 Microsoft 注册即可访问各种可用渠道,但我希望完全独立于 Microsoft 的注册来托管我的机器人。

My basic goal is to expose a directline endpoint/api that can communicate with my bot without having to register said bot with Microsoft.我的基本目标是公开一个可以与我的机器人通信的直接端点/api,而无需向 Microsoft 注册所述机器人。 I'm sure this could be accomplished with some sort of middleware but I'm having trouble finding resources that help.我确信这可以通过某种中间件来完成,但我很难找到有帮助的资源。 I've attempted to utilize a nodejs package, offline-directline , with no success.我尝试使用 nodejs package, offline-directline ,但没有成功。 I believe the package is out of date and no longer works as expected.我相信 package 已经过时,不再按预期工作。 For the time being I'm using this package as a reference to attempt to concoct my own solution but any alternative resources would be helpful.目前我正在使用这个 package 作为参考来尝试炮制我自己的解决方案,但任何替代资源都会有所帮助。

A few final details about the this project.关于这个项目的一些最终细节。 The bot is written in.Net utilizing Microsoft's Bot Framework.该机器人是使用 Microsoft 的 Bot Framework 在.Net 中编写的。 I [need] a solution that works specifically with.Net bots but I'm open to one that can work with.Net [and] Nodejs bots.我 [需要] 一种专门与 .Net 机器人配合使用的解决方案,但我愿意接受可以与 .Net [和] Nodejs 机器人配合使用的解决方案。 Thank you for any help and I'll be happy to answer any additional questions as they come up.感谢您的帮助,我很乐意回答任何其他问题。


In relation to the offline-directline repo the following is the current state of my setup.关于离线直接回购,以下是我设置的当前 state。 I'm attempting to get a barebones version working by utilitizing the EchoBot sample from Microsoft.我试图通过利用 Microsoft 的 EchoBot 示例来获得一个准系统版本。 I connect to the webchat using this url http://localhost:8080/?domain=http://localhost:3000/directline .我使用此 url http://localhost:8080/?domain=http://localhost:3000/directline连接到网络聊天。 The following are the code snippets for my nodejs app and the client webchat.以下是我的 nodejs 应用程序和客户端网络聊天的代码片段。

app.js应用程序.js

const directline = require("offline-directline");
const express = require("express");

const app = express();
directline.initializeRoutes(app, 3000, "http://127.0.0.1:3978/api/messages");

index.html索引.html

<!DOCTYPE html>
<html>
   <body>
      <div id="webchat" role="main"></div>
      <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
      <script>

        function getUrlVars() {
          var vars = {};
          var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
            vars[key] = value;
          });
          return vars;
        }
        let params = getUrlVars();
        console.log(params);
        window.WebChat.renderWebChat({
          directLine: window.WebChat.createDirectLine({
            token: params['s'],
            secret: params['t'],
            domain: params['domain'],
            webSocket: false
          }),
        },
        document.getElementById('webchat')
        );
      </script>
   </body>
</html>

Errors错误

Console-Errors控制台错误

Not sure how much refactoring you would need but Botkit might give you what you're looking for.不确定您需要进行多少重构,但Botkit可能会为您提供所需的内容。

Botkit is just one part of a bigger set of developer tools and SDKs that encompass the Microsoft Bot Framework. Botkit 只是包含 Microsoft Bot Framework 的一组更大的开发人员工具和 SDK 的一部分。 The Bot Framework SDK provides the base upon which Botkit is built. Bot Framework SDK 提供了构建 Botkit 的基础。 It is available in multiple programming languages!它有多种编程语言!

Or if you're daring enough, you could ask the folk over at Microsoft opencode@microsoft.com if you can pull their Bot Framework SDK and rip out the Azure bits?或者,如果您足够大胆,您可以通过 Microsoft opencode@microsoft.com 向人们询问您是否可以拉出他们的 Bot Framework SDK 并撕掉 Z3A580F142203677F1F0BC30898ZF6 位?

Regarding the "offline-directline" package, it isn't out-of-date.关于“离线-直接”package,它并没有过时。 My suspicion there is you are not configuring it correctly.我怀疑你没有正确配置它。 This following code sample is enough to get the package running.以下代码示例足以让 package 运行。 Then you just need to point your bot to it.然后你只需要将你的机器人指向它。

const directline = require('offline-directline');
const express = require('express');

const app = express();

directline.initializeRoutes(app, 4000, "http://127.0.0.1:3978/api/messages");

If you continue to struggle, another option is the "browser bot" which you can find on the Botbuilder-Samples repo here .如果您继续挣扎,另一种选择是“浏览器机器人”,您可以在此处的 Botbuilder-Samples 存储库中找到它。 In this setup, the bot is hosted entirely within the browser and does not require using Direct Line.在此设置中,机器人完全托管在浏览器中,不需要使用 Direct Line。 Setup is only slightly different and will require you to play with configurations some, as a result.设置只是略有不同,因此需要您使用一些配置。 But, it's worth a look.但是,值得一看。

Hope of help!希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Microsoft Azure中托管bot? - How to host a bot in Microsoft Azure? 如何在 Azure 中向 Microsoft Teams Bot 添加授权 - How to add authorization to Microsoft Teams Bot in Azure 我可以使用LUIS创建和部署Microsoft机器人,但不使用Azure服务吗? - Can I create and deploy Microsoft bot with LUIS but without azure services? 我们可以在没有Azure的IIS中部署Microsoft bot应用程序吗? - Can We deploy Microsoft bot Application in IIS without Azure? Microsoft Azure:服务一直说正在注册 - Microsoft Azure: Service keeps saying Registering 如何在 Azure 虚拟机中部署 Microsoft Bot Framework 应用程序? - How to deploy Microsoft Bot Framework app in Azure Virtual machine? 如何通过 Microsoft Bot Framework 将记录插入 Azure 表存储? - How to insert records to Azure Table Storage via Microsoft Bot Framework? 从Web客户端调用Microsoft Bot Framework机器人而无需在Azure上托管 - Call Microsoft Bot Framework bot from Web Client without hosting on Azure 什么是?如何在Microsoft Azure中找到主机URI? - What is and how do I find the host URI in Microsoft Azure? Microsoft Azure QnA机器人的问题存储在哪里? - where are questions for a Microsoft Azure QnA bot stored?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM