csharp-core docker & node fix
This commit is contained in:
Родитель
33ceb607e8
Коммит
d13b2a3b35
|
@ -238,7 +238,7 @@ FakesAssemblies/
|
|||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
.env
|
||||
#.env
|
||||
|
||||
# Typescript v1 declaration files
|
||||
typings/
|
||||
|
|
|
@ -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"]
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<RootNamespace>analyze_text</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,2 @@
|
|||
LUIS_APP_ID=df67dcdb-c37d-46af-88e1-8b97951ca1c2
|
||||
LUIS_ENDPOINT_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
@ -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 = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче