microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.51k stars 2.45k forks source link

[Question] How to make a contextual conversation #4098

Closed etbuilder closed 6 years ago

etbuilder commented 6 years ago

Bot Info

First off, I do regret starting with .NET as I think its far more complex compared to node, I think node has more easy to understand approaches to contextual issues (ex triggerAction compared to Scorables), and AutoFac is simply a mess for intermediate developers who needs to understand bots logic and flow and also Autofac stuff.

I don't want to distract the reader here, so I will move on to the real challenge we are facing!

Issue Description

After weeks of research and work, I am not able to find a good answer on how to design the chatbot in C# in a way that it can handle contextual conversations, first off lets consider two scenarios, 1: with without LUIS, 2: using LUIS

(1) Without LUIS (Simple and controlled) :

How should I design a chatbot that can answer questions that are contextual to the current dialog. For example, if the user in settings dialog, and asks for help (the bot should give him help related to settings) but if he is in an another dialog that does not have a specific help, it would go to a generic help message. I know that I can use Scorables for global message handles, but how can I do this for the settings dialog that have specific message.

(2) Using LUIS :

How to implement a Lusi based contextual bot that is also hybrid (contains, cards, buttons, quick replies (suggested actions) and so on). I know that we can use ActionBinding examples, but still having everything hard codded does not make a lot of sense and its hard to track. here are two cases I can think of.

Case 1:

A bot will show cards to the user, and those cards do not disappear , so for example, he can press on a button that will show him a complete different service. what should we do in this case, should we use ActionBinding as the controller for the whole bot and based on that control whether to prompt him about change of state, and what about Scorables, how can we use them in conjunction with ActionBinding.

Case 2:

A user asked for gyms, the bot listed them down in Cards, and he selected one through a button...., then asked "what is the closing time", and he expects to see an answer about the current Gym he selected (we have the data to answer this specific question) but the question is how can we handle such case and know that the user selected this specific Gym and the question he asked is related. (please consider that we have a different facilities and services and each have different set of related questions the user might ask).

Finally, I hope its Ok to raise this here and not in StackoverFlow, as I need experts from Microsoft to guide us on on how to approach things especially that demos does not show how to do this (correct me if I am wrong) like demo-contoso flowers. its a basic bot, not a conversational one.

JasonSowers commented 6 years ago

Inside your context object you have 3 databags UserData, ConversationData, and PrivateConversationData. These are intended to be used to allow you to have contextual conversations. There is even a way to use these databags when you do not have the context object to work with. Code examples in this Stack Overflow Answer

There would be a number of ways to handle this using context. One example would be to have a "current topic" or similar key in you ConversationData that you could set the value to "settings" and write your code to handle the conversation within this context. This would be the general idea for all your questions and cases. Set a value in one of the databags and look for it, or initial a dialog based off of it.

fanidamj-zz commented 6 years ago

Closing the issue assuming it as resolved. Please reopen a new issue if it still persists.