Hello,
First of all thank you for implementing this control!
I'm doing some tests to see how it works, etc. and I'm facing the next issue. I think right now the control is lacking some kind of natural behavior. Maybe not everyone may want this, but I think some of us would like to have the feeling that we're talking somehow to a person instead of a bot.
I've modified your code in the demos for the function renderMessages to give it a more natural feeling:
renderMessages:
function
(messages) {
var
that =
this
;
var
msg = messages;
function
renderWithDelay() {
var
message = msg[0];
switch
(message.type) {
case
0:
that.chat.renderMessage({ type:
"text"
, text: message.speech, timestamp: that._timestamp }, that.userInfo);
break
;
case
2:
that.renderSuggestedActions(message.replies.map(
function
(reply) {
return
{ title: reply, value: reply }; }));
break
;
default
:
}
msg.splice(0, 1);
if
(msg.length > 0) {
var
newMessage = msg[0];
if
(message.type == 0) setTimeout(renderWithDelay, newMessage.speech.length * 12);
else
renderWithDelay();
}
}
renderWithDelay();
}
However to really achieve this natural feeling when talking to the bot, I think it would be really useful to have an option, that could accept a boolean or JSON object, that would work as follows:
a) If it is a boolean and it is true, on the delay it will show a bubble saying that "Bot name is typing..."
b) If it is a JSON object, would work as if true, and let the user enter the message to appear in the bubble
Thank you!