예제 #1
0
        //------ Posting the Tasks ----------------
        public async Task Selection(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var           message   = await argument;
            Task <Intent> getIntent = Task.Run(() => LUISAPI.GetAsync(LUISAPI.Selection + message.Text));

            getIntent.Wait();
            switch (getIntent.Result.topScoringIntent.intent)
            {
            case "Reviews":
                entities = getIntent.Result.entities;
                context.Call <object>(new Review(), AfterChildDialogIsDone);
                break;

            case "AnotherCity":
                ciudad = getIntent.Result.entities[0].city;
                await this.Attracions(context);

                break;

            case "Local":
                ciudad = EchoDialog.munic;
                await this.Attracions(context);

                break;

            default:
                response.Speak = response.Text = "I did not get that. Things to do";
                await context.PostAsync(response);

                context.Wait(Selection);
                break;
            }
        }
예제 #2
0
        public async Task Selection(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var message = await argument;

            try
            {
                Task <Intent> getIntent = Task.Run(() => LUISAPI.GetAsync(LUISAPI.Selection + message.Text));
                getIntent.Wait();
                switch (getIntent.Result.topScoringIntent.intent)
                {
                case "AnotherCity":
                    string ciudad = getIntent.Result.entities[0].city;
                    context.Call <object>(new ThingsToDo(ciudad), AfterChildDialogIsDone);
                    break;

                case "Local":
                    context.Call <object>(new ThingsToDo(munic), AfterChildDialogIsDone);
                    break;

                case "PriceFlightAnotherCity":
                    response.Text = response.Speak = "Flight with 2 cities" + getIntent.Result.entities[0].city + " " + getIntent.Result.entities[1].city;
                    await context.PostAsync(response);

                    context.Wait(Selection);
                    break;

                case "PriceFlightLocal":
                    response.Text = response.Speak = "flight from " + munic;
                    await context.PostAsync(response);

                    context.Wait(Selection);
                    break;

                default:
                    response.Text = response.Speak = "I did not quite get that. Echo Dialog";
                    await context.PostAsync(response);

                    context.Wait(Selection);
                    break;
                }
            }
            catch (Exception ex1)
            {
                response.Speak = response.Text = "Luis stopped working. Exception: " + ex1.Message;
                await context.PostAsync(response);

                context.Wait(Selection);
            }
        }
예제 #3
0
        public async Task Options(IDialogContext context, IAwaitable <IMessageActivity> argument)
        {
            var           message   = await argument;
            Task <Intent> getIntent = Task.Run(() => LUISAPI.GetAsync(LUISAPI.Reviews + message.Text));

            getIntent.Wait();
            switch (getIntent.Result.topScoringIntent.intent)
            {
            case "Back":
                context.Done <object>(new object());
                break;

            case "Details":
                entitiesDetails = getIntent.Result.entities;
                await this.DetailsComments(context);

                break;

            case "Email":
                if (getIntent.Result.entities[0].city.ToLower().Contains("daniel"))
                {
                    context.Call <object>(new EmailDialog("*****@*****.**", "Let's go here\n" + ThingsToDo.places + "\nBy TripAdvisor."), AfterChildDialogIsDone);
                }
                else
                {
                    response.Speak = response.Text = "I don't know that contact";
                    await context.PostAsync(response);

                    context.Wait(Options);
                }
                break;

            default:
                response.Speak = response.Text = "I did not get that option.";
                await context.PostAsync(response);

                context.Wait(Options);
                break;
            }
        }