microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.59k stars 1.54k forks source link

Any plan to enable auto suggest or auto complete when user typing #476

Closed ryzam closed 5 years ago

ryzam commented 7 years ago

Hi,

One of the good features for web chat if it can support auto suggestion when user is typing. This kind of feature really benefit to guide user what type of questions can be asked in general.

billba commented 7 years ago

How would that work? Where do the suggestions come from? Where do they go?

ryzam commented 7 years ago

the suggestions can come from external data source(database) access through web api, Let say for close domain chat bot that handle trouble shooting network answer, we can predefined suggestion questions that can be asked by users.

billba commented 7 years ago

Can you be more specific? You seem to have a clear picture in your mind but I'm not really sure what you're suggesting. As a piece of user experience what does this look like? When are suggestions proffered? Where do they appear?

Most bots do suggestions as messages to the user, e.g. "you can say 'sell stock' or 'buy stock". We can already show suggested answers to questions, e.g. "What would you like to do - Buy Stock / Sell Stock". How does what you're suggested differ from these and (presumably) improve upon them?

ryzam commented 7 years ago

autosuggestion

Something like this ...

billba commented 7 years ago

That's an interesting mashup of bots and autocomplete. I'm not sure how to have a bot easily generate a list of possible questions. I suppose, as you say, it could just be a list of predefined questions in a database. I'd be interested in what others had to say about this proposed feature.

ryzam commented 7 years ago

I have a set of questions to train in LUIS . Let say i train this question - "What is the weather in Paris?" as get weather intent. User can ask for example "Give me the current weather in Sydney" or "What is the weather tomorrow?" which is also have same intent as get weather intent, so once the intent is correct then we will save it into database as possible questions.

When user type "What is the" , bot can perform auto suggest "What is the weather in Paris?" , "What is the weather tomorrow?"

ghost commented 7 years ago

There is this new API (in preview) Web Language Model (WebLM) API that can be used to automate a variety of natural language processing tasks, such as word frequency or next-word prediction, using advanced language modeling algorithms.

Maybe this could help you achieve this... https://westus.dev.cognitive.microsoft.com/docs/services/55de9ca4e597ed1fd4e2f104/operations/55de9ca4e597ed19b0de8a50

billba commented 7 years ago

I don't think the blocker here is the underlying autocomplete technology. It's more to do with who the client is communicating with, and how. Is it talking to LUIS? The bot? A third thing?

I don't think it makes sense to define any of that. Let the developer decide where the responses are coming from, and how.

I think the right solution would be to add a new property to ChatProps called suggestResponses which is a callback returning a Promise of responses (an array of strings). Then a new epic would be added which hooks on to 'Update_Input' actions, and calls suggestResponses. The responses, if any, would then be displayed to the user. The latter is the "hard" part, in that it would require adding a new component and getting the lifecycle right for making it appear, disappear, etc.

However to date @ryzam is the only person asking for this feature. So if you're not @ryzam, you should definitely add your comments and/or reactions to this issue.

ghost commented 7 years ago

Agree with you on that @billba, it should be a developer's call. It is a good to have feature as it would ease the user from typing and more importantly guide the user for apt inputs so that the bot can actually narrow down the intent more quickly and precisely... So voting in for this feature too..

alisrael commented 7 years ago

I could use this feature in the current bot I'm creating where I need to ask the user what school they need contact information for.

billba commented 7 years ago

This is an interesting UX question. On the one hand we have cards that let you suggest options to the user. But I can see that when the potential result set is large - e.g. thousands of schools - then autocomplete is the only way to go.

danmarshall commented 7 years ago

If people are implementing their own autocomplete solutions, we may need to provide a way for them to programmatically populate the textbox.

an0o0nym commented 7 years ago

I would also be interested in seeing autocomplete feature implemented into the WebChat.

ghost commented 7 years ago

Would there be any update on this feature request? or maybe directions on how to achieve it?

billba commented 7 years ago

(First of all, please let me give you some advice: across all repos everywhere, no updates to an issue means "no updates to report". Not helpful to keep asking if there are any updates.)

As for how to achieve it, there are many ways such a feature could be exposed.

I'm sure there are multiple React components that plug replace a text input with an identical-but-autosuggest-enhanced version. If so, the hard/interesting part of this is probably how it gets the suggestions.

We could probably learn something from MS Teams' great compose extension feature. This is a more structured approach on both the client and server, and it has different strengths and weaknesses than classic autocomplete.

I suspect their approach of using an "invoke" activity to fetch suggestions is the right one, because by definition you would want suggestions to have as much context as possible, and "invoke" is essentially "make an arbitrary query of the the current user context in the bot".

This is potentially a powerful feature but probably not a super urgent one for the product team. This is a great opportunity for a motivated developer to make a big impact to this project.

krusejan commented 6 years ago

Hi @billba & @danmarshall . Hi All.

+1 for this request!

Im my experience one of the most commons scenarios nowadays in bots is the FAQ-scenario. This feature would be great benefit for users and successful bot conversations, as it reduces the failure rate of users not asking the questions in the "right way", so in the exact way LUIS (trained utterances of the FAQ intent) and underlying knowledge DB (e.g. QNAMaker or using Azure Search with some DB) need it to have a correct match with highest score. In projects we spend a lot of time of defining questions, and many alternative questions, to a particular answer, and testing all that E2E.

I think the autocomplete approach would largely impact the probability of enabling users to ask the "right" question and find their answer quickly. Also it helps to guide the user and manage his expectations in terms of what QNAs the bot can actually handle (closed world scenario).

Regarding how this could be done: The following article looks promising, using a combination of Azure Search and Twitters typeahead.js library: https://azure.microsoft.com/de-de/blog/azure-search-how-to-add-suggestions-auto-complete-to-your-search-applications/ However, this is designed for the web, not sure about integration into Microsofts Botframework WebChat?

Also I am wondering if in terms of performance doing a REST API call for every character or word being typed in by the user is feasible.

Thanks and best regards Jan

tbolsh commented 6 years ago

I would LOVE to see this feature implemented ASAP - otherwise, we will either implement it ourselves or switch to different bot framework ...

gmdfalk commented 6 years ago

The "Who"-Bot in Microsoft Teams is implementing this functionality. Does anyone know how they do it? I imagine it's suggested actions. Any bot could profit from an autocomplation/suggestion like this.

screen shot 2018-04-13 at 14 18 47 screen shot 2018-04-13 at 14 19 02

billba commented 6 years ago

That is a feature of Teams. This proposal is about adding similar functionality to Web Chat.

eklavyamirani commented 6 years ago

I was working on implementing this in my fork. Here is an initial change (based on @billba's original suggestion): https://github.com/eklavyamirani/BotFramework-WebChat/pull/1

Autosuggest control in webchat

Here's the exposed hook to fetch suggestions: samples/fullwindow/index.html#L58

I am still far from done (i.e. not PR ready) but just wanted to throw it out for some initial feedback.

bgedik commented 6 years ago

@eklavyamirani in terms of the exposed hook:

eklavyamirani commented 6 years ago

@bgedik Your questions makes sense. :)

I have been thinking about this, and (in fact, another comment also points to this), it makes sense to keep this as a different kind of interaction that we (debounce and) send via the conversation channel. I'll modify the PR accordingly.

Thank you!

mrPrateek95 commented 6 years ago

I think that this feature can benefit by the use of Event Activity (or backchannel?)

The bot is the best way to source suggestions as suggestions have to be context specific or else it won't make sense and the bot and client can communicate with each other by passing event activities to and fro.

Let's say the Bot is in a particular action in a Dialog where it is expecting the user to input a country. Along with the message "Which country are you from?" that we send, we also send an event with name 'RequestSuggestions' and value "{'context': 'country'}" to the client. On the client side on receiving the above event, we send a 'SendSuggestions' event with value "{'context': 'country', 'input': 'in'}" On the bot side (in the MessagesController in C#), we handle the event activity and send the suggestions with another event 'Suggestions' with value being the string array.

When we are in an action where suggestions are not required, the 'RequestSuggestions' event's value "{'context': 'none'}" or can be null to indicate to the client that it doesn't need to ask for suggestions.

Now I do not know how this approach can be translated into React or in what way this can be done or if it can be done in the WebChat. Probably a new Activity type called 'Suggestions' can be created in Bot Builder but I guess this is too much of an ask.

@danmarshall @billba Please let me know if I am missing something.

christian-vorhemus commented 6 years ago

We are currently working on a customer project where we have added a custom written autocomplete component to the WebChat.

ezgif-3-9f6f1262f7

The C# bot sends an event to the GUI (written in TypeScript) so that it knows at which point in the flow the autocomplete component is expected to become visible. The suggestions are coming from an Azure Search Index, for the sake of speed we're calling Azure Search directly from the GUI. The tricky part was to make the user's speech bubble appear when clicking on a suggestion. For now, I used the hack described in #680 to solve this but would appreciate if this feature finding its way into the official API.

bgedik commented 6 years ago

@eklavyamirani Did you have a chance to find an approach that uses the 'conversation channel'?

eklavyamirani commented 6 years ago

@bgedik I haven't yet. Unfortunately, I am tied up for a bit and I will pick this up after 2 weeks.

neelamkhilari commented 6 years ago

Is there any update on autocomplete @eklavyamirani ?

Rykimaruh commented 6 years ago

Is this possible for Teams?

sivanandh commented 5 years ago

Hi, I achieved basic auto suggest using HTML5 and datalist(HTML5 feature) or we can use Jquery Flexdatalist for basic auto suggest.

kiranparasa commented 5 years ago

Looks like this is old topic.. Must have context management framework in the backend, without that the chatbot frameworks is more of rule engine waiting to bomb at some or the other point of time... And if complete site map is not fed properly in the rule engine, there are chances user will not waste time to probe site ( visually ) if autosuggestions didn't give informative results..

robinlestagiaire commented 5 years ago

Hi @sivanandh, do you have a link to your code? @tdurnford found a -yet not perfect- approach on Stackoverflow

robinlestagiaire commented 5 years ago

I managed to replace the original sendBox with my own react-select element on Stackoverflow, using #1826 and @tdurnford response on my post.

cwhitten commented 5 years ago

We're going to close this issue for now - there is no plans in the roadmap to implement this functionality. Please reference the stack overflow links above to workarounds. Thank you!

faridmovsumov commented 4 years ago

I recently implemented an auto-complete feature on the bot creation tool that I am working on. I was wondering if I am one who invented it actually because I have never seen this feature in any other chatbot platform before. If you are interested you can check it here https://botmake.io/page/faq-chatbot

chatbot

IamGiel commented 2 years ago

New to msbot framework, but is that possible on the emulator ? How are you doing this? Is this written in the waterfall steps ? Can you share ? thanks