diff --git a/.gitignore b/.gitignore index 7e58350..d056d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -238,7 +238,7 @@ FakesAssemblies/ # Node.js Tools for Visual Studio .ntvs_analysis.dat node_modules/ -.env +#.env # Typescript v1 declaration files typings/ diff --git a/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Dockerfile b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Dockerfile new file mode 100644 index 0000000..0d23b58 --- /dev/null +++ b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Dockerfile @@ -0,0 +1,21 @@ +# BUILD IMAGE +# $ docker build --no-cache -t luis-endpoint-csharpcore . +# +# RUN CODE +# +# WINDOWS BASH COMMAND +# $ winpty docker run -it --rm --name luis-endpoint-csharpcore luis-endpoint-csharpcore +# +# NON-WINDOWS +# $ docker run -it --rm --name luis-endpoint-csharpcore luis-endpoint-csharpcore tail + +FROM microsoft/dotnet:latest +WORKDIR /app +COPY . /app + +RUN ls + +# build +RUN dotnet build + +ENTRYPOINT ["dotnet", "run"] diff --git a/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Program.cs b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Program.cs new file mode 100644 index 0000000..b8f0e0b --- /dev/null +++ b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/Program.cs @@ -0,0 +1,43 @@ +using System; +using System.Net.Http; + +/* + + You can use the authoring key instead of the endpoint key. + The authoring key allows 1000 endpoint queries a month. + +*/ + +namespace ConsoleLuisEndpointSample +{ + class Program + { + static void Main(string[] args) + { + MakeRequest(); + Console.WriteLine("Hit ENTER to exit..."); + Console.ReadLine(); + } + + static async void MakeRequest() + { + var client = new HttpClient(); + + // This app ID is for a public sample app that recognizes requests to turn on and turn off lights + var luisAppId = "df67dcdb-c37d-46af-88e1-8b97951ca1c2"; + var endpointKey = "YOUR-KEY"; + + // The request header contains your subscription key + client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", endpointKey); + + // The "q" parameter contains the utterance to send to LUIS + var endpointUri = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/" + luisAppId + "?q=" + "turn on the left light"; + var response = await client.GetAsync(endpointUri); + + var strResponseContent = await response.Content.ReadAsStringAsync(); + + // Display the JSON result from LUIS + Console.WriteLine(strResponseContent.ToString()); + } + } +} diff --git a/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/analyze-text.csproj b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/analyze-text.csproj new file mode 100644 index 0000000..aa6c7b1 --- /dev/null +++ b/documentation-samples/quickstarts/analyze-text/csharp-core/analyze-text/analyze-text.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp2.1 + analyze_text + + + + + + + diff --git a/documentation-samples/quickstarts/analyze-text/node/.env b/documentation-samples/quickstarts/analyze-text/node/.env new file mode 100644 index 0000000..2326c29 --- /dev/null +++ b/documentation-samples/quickstarts/analyze-text/node/.env @@ -0,0 +1,2 @@ +LUIS_APP_ID=df67dcdb-c37d-46af-88e1-8b97951ca1c2 +LUIS_ENDPOINT_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file diff --git a/documentation-samples/quickstarts/analyze-text/node/call-endpoint.js b/documentation-samples/quickstarts/analyze-text/node/call-endpoint.js index 8cf2576..d1826be 100644 --- a/documentation-samples/quickstarts/analyze-text/node/call-endpoint.js +++ b/documentation-samples/quickstarts/analyze-text/node/call-endpoint.js @@ -21,7 +21,7 @@ function getLuisIntent(utterance) { // Read LUIS key from environment file ".env" // You can use the authoring key instead of the endpoint key. // The authoring key allows 1000 endpoint queries a month. - var endpointKey = "process.env.LUIS_ENDPOINT_KEY"; + var endpointKey = process.env.LUIS_ENDPOINT_KEY; // Create query string var queryParams = {