发挥你想象力,BotUI – 聊天机器人 JS 框架
BotUI 是一个有趣的聊天 JS 框架,界面样式像是一个对话聊天界面,使用者可以创建一个对话内容与访客进行互动。

项目名称:BotUI
在线演示:演示1 | 演示2
下载地址:https://github.com/moinism/botui
当然,这个不是真的能与用户「真实」交流,而是创建者可以自己定制一些有意义、有趣的对话策略来与访客互动起来。


BotUI的对话设定是比较简单的,下面有一个例子,可以参考这个官方的 DEMO 来设置。
HTML 代码:
<div class="botui-app-container" id="botui-app"> <bot-ui></bot-ui> </div>
JS 设置:
var botui = new BotUI('botui-app'); // give it the id of container
botui.message.bot({ // show first message
delay: 200,
content: 'hello'
}).then(function () {
return botui.message.bot({ // second one
delay: 1000, // wait 1 sec.
content: 'how are you?'
});
}).then(function () {
return botui.action.button({ // let user do something
delay: 1000,
action: [
{
text: 'Good',
value: 'good'
},
{
text: 'Really Good',
value: 'really_good'
}
]
});
}).then(function (res) {
return botui.message.bot({
delay: 1000,
content: 'You are feeling ' + res.text + '!'
});
});
赞助商链接

喜欢这篇文章吗?欢迎分享到你的微博、QQ群,并关注我们的微博,谢谢支持。
版权:除非注明,本站文章均为原创文章,转载请联系我们授权,否则禁止转载。
版权:除非注明,本站文章均为原创文章,转载请联系我们授权,否则禁止转载。






