-
-
Save peted70/4bf0584301c7d4d2750463a2da4fce12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task<MSHealthUserText> ParseUserInput(string input) | |
{ | |
string escaped = Uri.EscapeDataString(input); | |
using (var http = new HttpClient()) | |
{ | |
string key = Environment.GetEnvironmentVariable("MSHEALTHBOT_LUIS_API_KEY"); | |
string id = Environment.GetEnvironmentVariable("MSHEALTHBOT_LUIS_APP_ID"); | |
string uri = $"https://api.projectoxford.ai/luis/v1/application?id={id}&subscription-key={key}&q={escaped}"; | |
var resp = await http.GetAsync(uri); | |
resp.EnsureSuccessStatusCode(); | |
var strRes = await resp.Content.ReadAsStringAsync(); | |
var data = JsonConvert.DeserializeObject<MSHealthUserText>(strRes); | |
return data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment