public string GetMessage(BotResponse response)
        {
            var ctx = response.Result.Contexts.First(x => x.name == "execute_math_calc");
            var z1  = ctx.parameters["math_binary_operand_left"];
            var z2  = ctx.parameters["math_binary_operand_right"];
            var op  = ctx.parameters["math_operator_binary_operator"];

            return($"Das Ergebnis von {z1} {Operator.Map(op)} {z2} ist " + Operator.TryParse(z1, z2, op));
        }
        public bool IsValid(BotResponse response)
        {
            var z2 = response.Result.Contexts.First(x => x.name == "execute_math_calc").parameters["math_binary_operand_right"];

            if (z2 == "0")
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        public bool ValidateResponse(BotResponse response)
        {
            IBotIntentHandler handler;

            if (handlers.TryGetValue(response.Result.Metadata.IntentName, out handler))
            {
                return(handler.IsValid(response));
            }

            return(false);
        }
예제 #4
0
        public string ProcessResponse(BotResponse response)
        {
            IBotIntentHandler handler;

            if (handlers.TryGetValue(response.Result.Metadata.IntentName, out handler))
            {
                return(handler.GetMessage(response));
            }

            return(null);
        }
예제 #5
0
        public Dialog GetBasicDialog(BotResponse response)
        {
            IBotIntentHandler handler;

            if (handlers.TryGetValue(response.Result.Metadata.IntentName, out handler))
            {
                return(handler.GetDialog(response));
            }

            return(null);
        }
예제 #6
0
        public List <BotResponseContext> GetValidContexts(BotResponse response)
        {
            IBotIntentHandler handler;

            if (handlers.TryGetValue(response.Result.Metadata.IntentName, out handler))
            {
                return(handler.GetValidContextsFromCompleteIntent(response));
            }

            return(null);
        }
        public List <BotResponseContext> GetValidContextsFromCompleteIntent(BotResponse response)
        {
            var c1 = new BotResponseContext
            {
                name       = "testcontext",
                parameters = new Dictionary <string, string>
                {
                    { response.Result.Parameters.Keys.ToList()[0], response.Result.Parameters.Values.ToList()[0] },
                    { response.Result.Parameters.Keys.ToList()[0] + ".original", response.Result.Parameters.Values.ToList()[0] },

                    { response.Result.Parameters.Keys.ToList()[1], "" },
                    { response.Result.Parameters.Keys.ToList()[1] + ".original", "" },

                    { response.Result.Parameters.Keys.ToList()[2], response.Result.Parameters.Values.ToList()[2] },
                    { response.Result.Parameters.Keys.ToList()[2] + ".original", response.Result.Parameters.Values.ToList()[2] },
                }
            };
            var contexts = new List <BotResponseContext>();

            contexts.Add(c1);
            return(contexts);
        }
 public string GetMessage(BotResponse response)
 {
     return(null);
 }
 public Dialog GetDialog(BotResponse response)
 {
     return(new Dialog().AddTextPanel("Haben wir Ihnen geholfen?", "text1").AddButton("Ja", "yes").AddButton("Nein", "no").AddTextPanel("Grund", "reasonp").AddTextInput("reason"));
 }
 public List <BotResponseContext> GetValidContextsFromCompleteIntent(BotResponse response)
 {
     return(null);
 }
 public bool IsValid(BotResponse response)
 {
     return(true);
 }
 public Dialog GetDialog(BotResponse response)
 {
     return(null);
 }
예제 #13
0
 public bool DoesHandlerExist(BotResponse response)
 {
     return(handlers.ContainsKey(response.Result.Metadata.IntentName));
 }