Пример #1
0
        public IActionResult ChatBot(Responce res)
        {
            res.Input = res.Input.Trim();
            if (res.Input != "" && res.Input.Length < 200)
            {
                List <Responce> responces = ResponceDB.GetSomeResponces(res.Input, context);
                if (responces.Count() == 0)
                {
                    Responce filler = new Responce();
                    filler.Input = res.Input;

                    /* ToDo: get a random responce out from the
                     * database istead of just having 'filler text' */
                    filler.Output = "Filler Text";
                    responces.Add(filler);
                }

                /* ToDo: set res to a random responce
                 * from responces instead of always [0] */
                Responce responce = responces[0];
                ViewData["Responce"] = responce.Output;
            }
            return(View(res));
        }