-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a bubble button callback and rasa integration demo. #79
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shashwatrathod,
Thank you for this example! This tool was meant to be used with NLC from day one but I couldn't add an example yet. So thank you, this is very useful.
I've added a few comments to your code. It looks good, just a few changes to make for consistency and readability.
Most importantly, I'd like to learn about the tool you're using for NLC and be able to replicate your process. I think it would be helpful for all developers interested in this library to do this. Could you start a README_RASA.md
with basic info and steps on how to build the server (or perhaps a link to the RASA's relevant docs?)
I understand those changes may bee too much. If you don't have time to make them, I can apply them to your branch or a copy of your branch (depending on GH permissions) - unless you object.
Cheers,
-d.
component/Bubbles.js
Outdated
@@ -8,6 +8,7 @@ function Bubbles(container, self, options) { | |||
sidePadding = options.sidePadding || 6 // padding on both sides of chat bubbles | |||
recallInteractions = options.recallInteractions || 0 // number of interactions to be remembered and brought back upon restart | |||
inputCallbackFn = options.inputCallbackFn || false // should we display an input field? | |||
bubbleCallbackFn = options.bubbleCallbackFn || false // is there a callback function for when a user clicks on a bubble button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we name this responseCallbackFn
to match inputCallbackFn
naming a little closer?
examples/7-Rasa_demo.html
Outdated
// initialize by constructing a named function... | ||
// ...and add text processing plugin: | ||
function makeid() { | ||
var result = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the spacing in this file is a little different from the rest of the project. Can you either 1) adjust it so it matches the rest of the project a little better 2) add prettier
package so it does all of that automatically?
examples/7-Rasa_demo.html
Outdated
//A unique client id so that the data soesn't get mismatched | ||
const client_id = makeid() | ||
|
||
console.log(client_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please keep debug logs out of production code.
examples/7-Rasa_demo.html
Outdated
} | ||
|
||
//the port at which RASA is running | ||
port = '1001' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing variable keyword declaration var
examples/7-Rasa_demo.html
Outdated
|
||
var miss = function(text_inp = null){ | ||
let xhr = new XMLHttpRequest() | ||
let url = "http://localhost:"+port+"/webhooks/rest/webhook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this example requires running another server. I think we should explain how to start this server so that the example can be useful to all developers.
examples/7-Rasa_demo.html
Outdated
let xhr = new XMLHttpRequest() | ||
let url = "http://localhost:"+port+"/webhooks/rest/webhook" | ||
|
||
let input = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this project, we can only use var
for compatibility with older browsers. I haven't added any transpilers.
Hello, Thanks! |
Hello! |
Hi @shashwatrathod, thank you for the changes! I've tried to run the example on my machine but there are XHR errors both when I run the file from the filesystem and when I try to serve it with |
Hello,
I hope this solves your issue! Regards |
Hey @shashwatrathod, I merged your code in #85 with some minor tweaks. Turns out there were quotes missing from Thank you again for your work, I really appreciate your contribution! |
Hey! @dmitrizzle, thank you very much! I was also caught up in a couple of things this past month, so it was really generous of you to find that bug for me. chat-bubble is a nice project and it was fun to make this little contribution! Thanks! |
Bubbles.js
Added a callback function called bubbleCallbackFn which is called whenever a user clicks on a 'bubble-pick' element. This is useful for scenarios where the action to be taken is not necessarily known or defined in the 'convo', like NLC tasks.
7-Rasa_demo.html
It demonstrates the integration of a famous NLC framework - RASA with chat-bubble. It also provides a usecase for bubbleCallbackFn.
To use this, a RASA server has to set up. The port and URL have to be edited in the html file. After the ice, the user can enter any text and the output will be delivered through RASA.
I think chat-bubble is a very powerful and easy tool to use. These changes will help demonstrate the versatility of the project. Thanks
!