コード例 #1
0
        public async Task NoneIntent(IDialogContext context, LuisResultWithComposite result)
        {
            string message = $"None Intent";
            await context.PostAsync(message);

            context.Wait(this.MessageReceivedAsync);
        }
コード例 #2
0
        public async Task PretIntent(IDialogContext context, LuisResultWithComposite result)
        {
            var    count   = result.CompositeEntities?.Count ?? 0;
            string message = $"I found {count}  intents.";
            await context.PostAsync(message);

            foreach (var intentCount in result.Intents)
            {
                string intentValue = "";
                intentValue += intentCount.Intent + " ";
                await context.PostAsync(intentValue);
            }

            context.Wait(this.MessageReceivedAsync);
        }
コード例 #3
0
        public async Task <LuisResultWithComposite> GetLuisResult(string query)
        {
            var luisApiPath = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/7add24bb-eebf-4f9b-adf6-38672603f2ae?subscription-key=28ab94f3060743eb84ff011b156e860b&verbose=true&timezoneOffset=0&q=";

            LuisResultWithComposite result = null;
            var path   = luisApiPath + "" + query;
            var client = new HttpClient();

            HttpResponseMessage response = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                result = JsonConvert.DeserializeObject <LuisResultWithComposite>(await response.Content.ReadAsStringAsync());
            }

            return(result);
        }