@microsoft/bf-lu
Advanced tools
Comparing version 4.11.0-dev.20200904.ed789e7 to 4.11.0-dev.20200907.c063415
@@ -25,2 +25,3 @@ "use strict"; | ||
const recognizerType = require('./../utils/enums/recognizertypes'); | ||
const maxVersionCount = 100; | ||
class Builder { | ||
@@ -131,3 +132,3 @@ constructor(handler) { | ||
} | ||
async build(luContents, recognizers, authoringKey, endpoint, botName, suffix, fallbackLocale, deleteOldVersion, isStaging, multiRecognizers, settings, crosstrainedRecognizers, dialogType, luisAPITPS, timeBucketOfRequests, retryCount, retryDuration) { | ||
async build(luContents, recognizers, authoringKey, endpoint, botName, suffix, fallbackLocale, keptVersionCount, isStaging, multiRecognizers, settings, crosstrainedRecognizers, dialogType, luisAPITPS, timeBucketOfRequests, retryCount, retryDuration) { | ||
// luis api TPS which means 5 concurrent transactions to luis api in 1 second | ||
@@ -176,3 +177,3 @@ // can set to other value if switched to a higher TPS(transaction per second) key | ||
// To see if need update the model | ||
needTrainAndPublish = await this.updateApplication(currentApp, luBuildCore, recognizer, timeBucket, deleteOldVersion); | ||
needTrainAndPublish = await this.updateApplication(currentApp, luBuildCore, recognizer, timeBucket, keptVersionCount !== null && keptVersionCount !== void 0 ? keptVersionCount : maxVersionCount); | ||
} | ||
@@ -203,3 +204,6 @@ else { | ||
if (settings) { | ||
settings.luis[content.name.split('.').join('_').replace(/-/g, '_')] = recognizer.getAppId(); | ||
settings.luis[content.name.split('.').join('_').replace(/-/g, '_')] = { | ||
"appId": recognizer.getAppId(), | ||
"version": recognizer.versionId | ||
}; | ||
} | ||
@@ -297,3 +301,3 @@ })); | ||
} | ||
async updateApplication(currentApp, luBuildCore, recognizer, timeBucket, deleteOldVersion) { | ||
async updateApplication(currentApp, luBuildCore, recognizer, timeBucket, keptVersionCount) { | ||
await delay(timeBucket); | ||
@@ -315,6 +319,8 @@ const appInfo = await luBuildCore.getApplicationInfo(recognizer.getAppId()); | ||
await luBuildCore.importNewVersion(recognizer.getAppId(), currentApp, options); | ||
if (deleteOldVersion) { | ||
await delay(timeBucket); | ||
const versionObjs = await luBuildCore.listApplicationVersions(recognizer.getAppId()); | ||
for (const versionObj of versionObjs) { | ||
// get all available versions | ||
await delay(timeBucket); | ||
const versionObjs = await luBuildCore.listApplicationVersions(recognizer.getAppId()); | ||
if (keptVersionCount < versionObjs.length) { | ||
const versionObjsToDelete = versionObjs.reverse().splice(0, versionObjs.length - keptVersionCount); | ||
for (const versionObj of versionObjsToDelete) { | ||
if (versionObj.version !== newVersionId) { | ||
@@ -396,3 +402,6 @@ this.handler(`${recognizer.getLuPath()} deleting old version=${versionObj.version}`); | ||
for (const appName of Object.keys(luisAppsMap)) { | ||
settings.luis[appName] = luisAppsMap[appName]; | ||
settings.luis[appName] = { | ||
"appId": luisAppsMap[appName]["appId"], | ||
"version": luisAppsMap[appName]["version"] | ||
}; | ||
} | ||
@@ -399,0 +408,0 @@ } |
@@ -13,6 +13,7 @@ "use strict"; | ||
this.id = `LUIS_${targetFileName.split('.')[0]}`; | ||
this.applicationId = `=settings.luis.${targetFileName.split('.').join('_').replace(/-/g, '_')}`; | ||
this.applicationId = `=settings.luis.${targetFileName.split('.').join('_').replace(/-/g, '_')}.appId`; | ||
this.endpoint = '=settings.luis.endpoint'; | ||
this.endpointKey = '=settings.luis.endpointKey'; | ||
this.versionId = '0.1'; | ||
this.version = `=settings.luis.${targetFileName.split('.').join('_').replace(/-/g, '_')}.version`; | ||
this.versionId = "0.1"; | ||
this.$schema = schema; | ||
@@ -37,2 +38,3 @@ } | ||
applicationId: this.applicationId, | ||
version: this.version, | ||
endpoint: this.endpoint, | ||
@@ -39,0 +41,0 @@ endpointKey: this.endpointKey |
{ | ||
"name": "@microsoft/bf-lu", | ||
"version": "4.11.0-dev.20200904.ed789e7", | ||
"version": "4.11.0-dev.20200907.c063415", | ||
"author": "Microsoft", | ||
@@ -5,0 +5,0 @@ "bugs": "https://github.com/microsoft/botframework-cli/issues", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
849945
19009