示例#1
0
        public EntityIdentifiedDto SetEntityinResponse(EntityIdentifiedDto dto)
        {
            string      entityName = dto.EntityName;
            string      response   = dto.ChatResponse;
            int         counter    = 0;
            HttpContext context    = HttpContext.Current;

            while (response.IndexOf("[") != -1 && response.IndexOf("]") != -1)
            {
                string replace = ExtractBetween(response, "[", "]", counter);
                string entity  = (context.Session[replace] != null ? context.Session[replace].ToString() : replace);
                response = response.Replace("[" + replace + "]", entity);
            }
            dto.ChatResponse = response;
            return(dto);
        }
示例#2
0
        public EntityIdentifiedDto HasOneChildIntentWithOneEntity(ChatEntity entity, ChatIntent intent)
        {
            var hasEntity             = db.ChatEntity.Where(x => x.ChatIntentId == Node);
            EntityIdentifiedDto dto   = new EntityIdentifiedDto();
            string      finalResponse = string.Empty;
            HttpContext context       = HttpContext.Current;

            finalResponse = intent.Response;

            dto.EntityName      = entity.EntityName;
            dto.EntityValue     = EntityPatternMatch(entity);
            dto.MatchConfidence = "high";
            dto.ChatResponse    = finalResponse;

            dto = SetEntityinResponse(dto);

            //phoneNumber = (context.Session["phone"] != null ? context.Session["phone"].ToString() : "980 000 000");
            //message = (context.Session["datetime"] != null ? context.Session["datetime"].ToString() : "12:00 AM EST");
            //finalResponse = finalResponse.Replace("paramphonenumber", phoneNumber);
            //finalResponse = finalResponse.Replace("paramappointmenttime", message);
            //dto.ChatResponse = finalResponse;
            return(dto);
        }