I'm using Luis.ai to create my neural network of intents and the Microsoft Bot Framework to create my chatbot, but I can not read a json that Luis is generating for me.
Luis's class:
public static async Task<LuisResult> GetResponse(string message)
{
using (var client = new HttpClient())
{
var url = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/06145033-fb92-485e-acd5-0bf432e892d5?subscription-key=a66048dcba8e4dcd845c91ebfff5a031&verbose=true&timezoneOffset=-180&q=" + message;
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode) return null;
var result = await response.Content.ReadAsStreamAsync();
var js = new DataContractJsonSerializer(typeof(LuisResult));
return (LuisResult)js.ReadObject(result);
}
}
As I'm calling you:
Console.WriteLine(luis.GetResponse(activity.Text.ToLower()).Result.Intents[0].Intent.ToString());
I'm doing everything locally.
EDIT:
When I debug, it stays infinitely in this line:
var response = await client.GetAsync(url);
I created another solution, I did the whole process of downloading Json, and in that new solution it worked perfectly ...