部署 botbuilder 聊天机器人通过 WebChat 到本地的步骤

huangapple go评论73阅读模式
英文:

Steps to deploy botbuilder chatbot locally through webchat

问题

我想在Java中使用Microsoft Bot Builder框架构建一个机器人。我正在尝试这里提供的示例链接。我想知道如何在WebChat上本地部署使用botbuilder-java框架开发的机器人。

我已经盲目尝试了在另一个ST链接中列出的HTML,如下所示:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->
window.WebChat.renderWebChat({
    directLine: window.WebChat.createDirectLine({
        secret: '',
        token: '',
        domain: 'http://localhost:8080/directline',
        webSocket: false // 默认为true
    })
})

<!-- end snippet -->

但是在控制台上出现了各种错误。请指导我如何继续。请注意,我的机器人和WebChat客户端都需要在本地部署(不是在模拟器上)。不涉及Azure部署。

谢谢。

英文:

I want to build a bot in java using the the microsoft bot builder framework. I am trying out the samples provided here. I would like to know how can I locally deploy a bot developed using botbuilder-java framework on webchat.

I have blindly tried the html listed on another ST link as below

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

window.WebChat.renderWebChat({
    directLine: window.WebChat.createDirectLine({
        secret: &#39;&#39;,
        token: &#39;&#39;,
        domain: &#39;http://localhost:8080/directline&#39;,
        webSocket: false // defaults to true
    })})

<!-- end snippet -->

but that that fails with various errors on console. Kindly guide me on how could I proceed. Note my bot and the web chat clients needs to be deployed locally (not on emulator). No azure deployments.

Thanks.

答案1

得分: 0

我发现 JavaScript 代码是不完整的。完整的代码如下:

window.WebChat.renderWebChat({
    directLine: window.WebChat.createDirectLine({
        secret: '',
        token: '',
        domain: 'http://localhost:7070/directline',
        webSocket: false // 默认为 true
    }),
    styleOptions: {
        hideUploadButton: true
    }
}, document.getElementById('webchat'));
英文:

I figured out that javascript code was incomplete. The complete code is

window.WebChat.renderWebChat({
        directLine: window.WebChat.createDirectLine({
            secret: &#39;&#39;,
            token: &#39;&#39;,
            domain: &#39;http://localhost:7070/directline&#39;,
            webSocket: false // defaults to true
        }),
        styleOptions: {
            hideUploadButton: true
        }
    }, document.getElementById(&#39;webchat&#39;))

huangapple
  • 本文由 发表于 2020年10月13日 19:29:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/64334376.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定