This commit is contained in:
Dina Berry 2018-01-29 14:36:32 -08:00 коммит произвёл GitHub
Родитель 91004a4cf3
Коммит 86db5c827d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 63 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,63 @@
/*-----------------------------------------------------------------------------
This template demonstrates how to use list entities
.
For a complete walkthrough of creating this type of bot see the article at
https://aka.ms/
-----------------------------------------------------------------------------*/
// NPM Dependencies
var request = require('request-promise');
// To run this sample, change these constants.
// Programmatic/starter key, available in www.luis.ai under Account Settings
const programmaticKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
// ID of your LUIS app to which you want to add an utterance
const appId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
// Version number of your LUIS app
const versionId = "0.1";
// Region of app
const region = "westus";
// Construct HTTP uri
const uri= `https://${region}.api.cognitive.microsoft.com/luis/api/v2.0/apps/${appId}/publish`;
// publish
var publish = async () => {
try {
// LUIS publish definition
var body = {
"versionId": "0.1",
"isStaging": false,
"region": "westus"
};
// HTTP request
var myHTTPrequest = request({
uri: uri,
method: 'POST',
headers: {
'Ocp-Apim-Subscription-Key': programmaticKey
},
json: true,
body: body
});
return await myHTTPrequest;
} catch (err) {
throw err;
}
}
// MAIN
publish().then( (response) => {
// return GUID of list entity model
console.log(response);
}).catch(err => {
console.log(`Error adding list entity: ${err.message} `);
});