This repository was archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathindex.js
More file actions
50 lines (42 loc) · 1.47 KB
/
index.js
File metadata and controls
50 lines (42 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var path = require('path');
const download = require('./_download');
const parse = require('./_parse');
const upload = require('./_upload');
// TBD: CHANGE THESE VALUES
const LUIS_subscriptionKey = "YOUR_SUBSCRIPTION_KEY";
const LUIS_appId = "YOUR_APP_ID";
const LUIS_versionId = "0.1";
// NOTE: final output of upload api named utterances.upload.json
const downloadFile= "./utterances.csv";
const uploadFile = "./utterances.json"
/* download configuration */
var configDownload = {
LUIS_subscriptionKey: LUIS_subscriptionKey,
LUIS_appId: LUIS_appId,
outFile: path.join(__dirname, downloadFile),
uri: "https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/querylogs".replace("{appId}",LUIS_appId)
};
/* upload configuration */
var configUpload = {
LUIS_subscriptionKey: LUIS_subscriptionKey,
LUIS_appId: LUIS_appId,
LUIS_versionId: LUIS_versionId,
inFile: path.join(__dirname, uploadFile),
batchSize: 100,
uri: "https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/examples".replace("{appId}", LUIS_appId).replace("{versionId}", LUIS_versionId)
};
/* parse configuration */
var configParse = {
inFile: path.join(__dirname, downloadFile),
outFile: path.join(__dirname, uploadFile)
};
download(configDownload)
.then(() => {
return parse(configParse);
}).then(() => {
return upload(configUpload);
}).then(() => {
console.log("process done");
}).catch(err => {
console.log(err);
});