microsoft / botframework-sdk

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

PromptDialog doesn't call ResumeAfter() method #757

Closed jamesrlewis closed 8 years ago

jamesrlewis commented 8 years ago

I have a LUIS dialog class with expected intents. One of my intents are as follows:

[LuisIntent("Greet")]
        public async Task Greet(IDialogContext context, LuisResult result)
        {
                    Authentication auth = new Authentication();
                    context.Call(auth, SetAuthentication);
         }

Authentication is an IDialog class with the following StartAsync method:

        public async Task StartAsync(IDialogContext context)
        {
            PromptDialog.Confirm(context, GetUsername, "You need to login before I can get that info for you. Do you want to log in?");
        }

The PromptDialog should call GetUsername, which will call another GetPassword which will log the user in. SetAuthentication is to be called after the Authentication class is run, and it has the following:

        public async Task SetAuthentication(IDialogContext context, IAwaitable<bool> result)
        {
            bool response = await result;
            context.PrivateConversationData.SetValue("Authentication", response);
            context.Wait(MessageReceived);
        }

My issue is that context.Call(auth, SetAuthorization) calls the StartAsync method, but then immediately exits, without continuing to call GetUsername. Further, SetAuthorization isn't called either.

Any suggestions as to why this is happening?

ankitbko commented 8 years ago

PromptDialog.Confirm should prompt user with the message you specified. GetUsername will be called once user replies yes/no to that prompt. Are you not getting prompt for yes/no?

jamesrlewis commented 8 years ago

It prompts the user for yes/no but then doesn't call into the GetUsername method.

ankitbko commented 8 years ago

It should call once the user replies back. GetUsername in this case will be callback function containing text that user has entered. Have you tried replying yes and check if the method is called?

willportnoy commented 8 years ago

I would break on thrown exceptions (or look in your output window) and see if there are any issues serializing your dialog state on the completion of the incoming http request to the bot.

willportnoy commented 8 years ago

I'm going to close this issue, but feel free to open a new issue for further discussions.

v-madhal commented 4 years ago

Hello,

I am having the similar case. I am having a BOT application which is being developed using Microsoft BOT Framework V3 and WebChat Framework V4. In one of the scenario where user sends a particular utterance say "I want to place an order" which goes to LUIS and then BOT replies user to choose some choice using PromptDialog.Choice(context,choiceSelection,message). E.g. "Home Delivery", "Self Pickup"

Now when user clicks on one of the button (Say "Home Delivery"), then technically the choiceSelection method should be invoked but instead of that BOT takes that choice as a new utterances and calls the LUIS to which no intent is mapped and hence the scenario does not complete with expected result.

Also I have checked with using BOT WebChat V3 version, the scenario works absolutely fine without failing. But due to client requirement, I would like to go with WebChat v4 instead of WebChat v3 framework.

Any suggestions, work around will be highly appreciated.