botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Bug] FormFlow on LuisDialog not working after version 3.8.5

Open khs3141 opened this issue 9 years ago • 2 comments

System Information (Required)

  • SDK Language: .NET/C#
  • SDK Version: 3.8.5
  • Development Environment: LOCALHOST, AZURE_APP_SERVICE

Issue Description

Formflow on LuisDialog. It works on version 3.8.4, but not on 3.8.5.

Code Example

[Serializable]
    public class FlightStatusLuisDialog : LuisDialog<object>
    {
        private const string PickDepartureDateEntityType = "date";
        private const string PickDepartureEntityType = "itinerary::from";
        private const string PickArrivalEntityType = "itinerary::to";
        private const string PickFlightEntityType = "flight_no";


        public FlightStatusLuisDialog(ILuisService luis) : base(luis)
        {

        }

        [LuisIntent("")]
        [LuisIntent("None")]
        public async Task None(IDialogContext context, LuisResult result)
        {
            await context.PostAsync(Resources.Common.FlightStatusLuisDialog_NotUnderstood);
            context.Wait(MessageReceived);
        }

        [LuisIntent("flight_status_search")]
        [LuisIntent("itinerary_search")]
        public async Task QueryLuis(IDialogContext context, LuisResult result)
        {
            var entities = new List<EntityRecommendation>();
            SearchOptions searchOption = SearchOptions.ByRoute;
            foreach (var entity in result.Entities)
            {
                switch (entity.Type)
                {
                    case PickDepartureDateEntityType:
                        entities.Add(new EntityRecommendation(type: nameof(FlightStatusForm.DepartureDate)) { Entity = entity.Entity.Replace(" ", "") });
                        break;
                    case PickDepartureEntityType:
                        entities.Add(new EntityRecommendation(type: nameof(FlightStatusForm.Departure)) { Entity = entity.Entity.Replace(" ", "") });
                        break;
                    case PickArrivalEntityType:
                        entities.Add(new EntityRecommendation(type: nameof(FlightStatusForm.Arrival)) { Entity = entity.Entity.Replace(" ", "") });
                        break;
                    case PickFlightEntityType:
                        entities.Add(new EntityRecommendation(type: nameof(FlightStatusForm.Flight)) { Entity = entity.Entity.Replace(" ", "") });
                        searchOption = SearchOptions.ByFlight;
                        break;
                    default:
                        break;
                }
            }

            if (entities.Count > 0)
            {
                entities.Add(new EntityRecommendation(type: nameof(FlightStatusForm.SearchOption)) { Entity = searchOption.ToString() });
            }

            var flightStatusForm = new FormDialog<FlightStatusForm>(new FlightStatusForm(), FlightStatusForm.BuildLocalizedForm, FormOptions.PromptInStart, entities);
            context.Call(flightStatusForm, FlightStatusComplete);
        }

        private async Task FlightStatusComplete(IDialogContext context, IAwaitable<FlightStatusForm> result)
        {
            var searchQuery = await result;
            ....
        }
    }

Steps to Reproduce the Issue

  1. Connect the emulator
  2. Write Flight Status Question. (ex. Did you arrive from Incheon to Bangkok on July 19?)
  3. Receive LuisResult and Call FlightStatusForm
  4. FormCanceledException error occurred

Expected Behavior

FormFlow on LuisDialog

Actual Results

image

khs3141 avatar Jul 19 '17 00:07 khs3141

Is there any planned date to resolve this issue?

srinivasnarula avatar Jul 23 '17 20:07 srinivasnarula

This bug has been fixed. Please refer to the attached code.

image

khs3141 avatar Jul 23 '17 23:07 khs3141