示例#1
0
        private async Task <LuisEntity> SetLuisEntity(string id)
        {
            var result = await _tableWrapper.Get <LuisEntity>(LuisEntity.STR_PARTITION_KEY, id);

            ViewBag.LuisEntity = result;

            return(result);
        }
示例#2
0
        /// <summary>
        /// Inicializador do gerenciador do LUIS
        /// </summary>
        /// <returns></returns>
        public async Task InitAsync()
        {
            //seta o AppID
            LuisAppId = ConfigurationManager.AppSettings["LuisAppId"];

            //Testa se existe
            if (String.IsNullOrEmpty(LuisAppId))
            {
                throw new ArgumentNullException("LuisAppId", "Cahve do web.config LuisAppId nao prenchida");
            }

            //recuera a entidade do tables com as configuracoes do LUIS
            var luisEntity = await table.Get <LuisEntity>(LuisEntity.STR_PARTITION_KEY, LuisAppId);

            //verifica se existe
            if (luisEntity == null)
            {
                throw new ArgumentNullException("luisEntity", "Nao existe configuracao para esse AppId do LUIS");
            }

            //recupera o NOME
            LuisNome = luisEntity.Nome;

            //Recupera a App Key
            LuisApiKey = luisEntity.ApiKey;

            //Recupera ao Host Region
            LuisHostRegion = luisEntity.HostRegion;

            //recupera as KB relacionadas a esse LUIS AppID
            var luisKBs = await table.List <QnAKBEntity>(LuisAppId);

            //percorre a lista de KBs
            foreach (var luisKB in luisKBs)
            {
                try
                {
                    //Adiciona ao dicionario os servicos
                    QnaService.Add
                    (
                        luisKB.LuisIntent,
                        new QnAMakerService
                        (
                            "https://" + luisKB.QnADomain + ".azurewebsites.net",
                            luisKB.QnAKBID,
                            luisKB.QnAEndPointKey
                        )
                    );
                }
                catch (Exception)
                {
                    await table.Delete <QnAKBEntity>(luisKB);
                }
            }
        }
示例#3
0
        public async Task <ActionResult> Edit(string id)
        {
            var result = await _tableWrapper.Get <LuisEntity>(LuisEntity.STR_PARTITION_KEY, id);

            return(View(result));
        }