fix(core.gbapp): .gbot download from tabular is now OK.
This commit is contained in:
parent
201b8c7dac
commit
a7fce94545
5 changed files with 32 additions and 47 deletions
|
@ -86,7 +86,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
public static async getADALCredentialsFromUsername(username: string, password: string) {
|
public static async getADALCredentialsFromUsername(username: string, password: string) {
|
||||||
return await msRestAzure.loginWithUsernamePassword(username, password);
|
return await msRestAzure.loginWithUsernamePassword(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getMobileCode() {
|
public static getMobileCode() {
|
||||||
const passwordGenerator = new PasswordGenerator();
|
const passwordGenerator = new PasswordGenerator();
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -101,7 +101,6 @@ export class GBAdminService implements IGBAdminService {
|
||||||
return passwordGenerator.generatePassword(options);
|
return passwordGenerator.generatePassword(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static getRndPassword(): string {
|
public static getRndPassword(): string {
|
||||||
const passwordGenerator = new PasswordGenerator();
|
const passwordGenerator = new PasswordGenerator();
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -168,7 +167,6 @@ export class GBAdminService implements IGBAdminService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async acquireElevatedToken(instanceId: number): Promise<string> {
|
public async acquireElevatedToken(instanceId: number): Promise<string> {
|
||||||
|
|
||||||
// TODO: Use boot bot as base for authentication.
|
// TODO: Use boot bot as base for authentication.
|
||||||
|
|
||||||
let botId = GBConfigService.get('BOT_ID');
|
let botId = GBConfigService.get('BOT_ID');
|
||||||
|
@ -227,9 +225,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
return path.indexOf('sharepoint.com') > 0;
|
return path.indexOf('sharepoint.com') > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {
|
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {}
|
||||||
|
|
||||||
}
|
|
||||||
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
|
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
|
||||||
const packageName = text.split(' ')[1];
|
const packageName = text.split(' ')[1];
|
||||||
|
|
||||||
|
@ -239,24 +235,22 @@ export class GBAdminService implements IGBAdminService {
|
||||||
throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.');
|
throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.');
|
||||||
}
|
}
|
||||||
await deployer.deployPackage(min, urlJoin(additionalPath, packageName));
|
await deployer.deployPackage(min, urlJoin(additionalPath, packageName));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let siteName = text.split(' ')[1];
|
let siteName = text.split(' ')[1];
|
||||||
let folderName = text.split(' ')[2];
|
let folderName = text.split(' ')[2];
|
||||||
|
|
||||||
let packageType = Path.extname(folderName);
|
let s = new GBSharePointService();
|
||||||
if (packageType !== '.gbot') {
|
|
||||||
let s = new GBSharePointService();
|
|
||||||
|
|
||||||
let localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(folderName));
|
let localFolder = Path.join('work', `${min.instance.botId}.gbai`, Path.basename(folderName));
|
||||||
GBLog.warn(`${GBConfigService.get('CLOUD_USERNAME')} must be authorized on SharePoint related site`);
|
GBLog.warn(`${GBConfigService.get('CLOUD_USERNAME')} must be authorized on SharePoint related site`);
|
||||||
await s.downloadFolder(localFolder, siteName, folderName,
|
await s.downloadFolder(
|
||||||
GBConfigService.get('CLOUD_USERNAME'), GBConfigService.get('CLOUD_PASSWORD'))
|
localFolder,
|
||||||
await deployer.deployPackage(min, localFolder);
|
siteName,
|
||||||
}
|
folderName,
|
||||||
else {
|
GBConfigService.get('CLOUD_USERNAME'),
|
||||||
await deployer.deployPackage(min, folderName);
|
GBConfigService.get('CLOUD_PASSWORD')
|
||||||
}
|
);
|
||||||
|
await deployer.deployPackage(min, localFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: IGBDeployer) {
|
public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: IGBDeployer) {
|
||||||
|
@ -271,7 +265,4 @@ export class GBAdminService implements IGBAdminService {
|
||||||
const service = await AzureDeployerService.createInstance(deployer);
|
const service = await AzureDeployerService.createInstance(deployer);
|
||||||
service.syncBotServerRepository(min.instance.botId, serverName);
|
service.syncBotServerRepository(min.instance.botId, serverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,10 @@ export class GBConversationalService {
|
||||||
|
|
||||||
let nlp: RecognizerResult;
|
let nlp: RecognizerResult;
|
||||||
try {
|
try {
|
||||||
|
const saved = step.context.activity.text
|
||||||
|
step.context.activity.text = text;
|
||||||
nlp = await model.recognize(step.context);
|
nlp = await model.recognize(step.context);
|
||||||
|
step.context.activity.text = saved;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// tslint:disable:no-unsafe-any
|
// tslint:disable:no-unsafe-any
|
||||||
if (error.statusCode === 404) {
|
if (error.statusCode === 404) {
|
||||||
|
|
|
@ -247,23 +247,14 @@ export class GBDeployer implements IGBDeployer {
|
||||||
|
|
||||||
public async publishNLP(instance: IGBInstance): Promise<void> {
|
public async publishNLP(instance: IGBInstance): Promise<void> {
|
||||||
const service = new AzureDeployerService(this);
|
const service = new AzureDeployerService(this);
|
||||||
const res = await service.publishNLP(
|
const res = await service.publishNLP(instance.cloudLocation, instance.nlpAppId, instance.nlpAuthoringKey);
|
||||||
instance.cloudLocation,
|
if (res.status !== 200 && res.status !== 201) throw res.bodyAsText;
|
||||||
instance.nlpAppId,
|
|
||||||
instance.nlpAuthoringKey,
|
|
||||||
);
|
|
||||||
if(res.status !== 200 && res.status !== 201) throw res.bodyAsText;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async trainNLP(instance: IGBInstance): Promise<void> {
|
public async trainNLP(instance: IGBInstance): Promise<void> {
|
||||||
const service = new AzureDeployerService(this);
|
const service = new AzureDeployerService(this);
|
||||||
const res = await service.trainNLP(
|
const res = await service.trainNLP(instance.cloudLocation, instance.nlpAppId, instance.nlpAuthoringKey);
|
||||||
instance.cloudLocation,
|
if (res.status !== 200 && res.status !== 202) throw res.bodyAsText;
|
||||||
instance.nlpAppId,
|
|
||||||
instance.nlpAuthoringKey,
|
|
||||||
);
|
|
||||||
if(res.status !== 200 && res.status !== 202) throw res.bodyAsText;
|
|
||||||
let sleep = ms => {
|
let sleep = ms => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
setTimeout(resolve, ms);
|
setTimeout(resolve, ms);
|
||||||
|
@ -274,15 +265,14 @@ export class GBDeployer implements IGBDeployer {
|
||||||
|
|
||||||
public async refreshNLPEntity(instance: IGBInstance, listName, listData): Promise<void> {
|
public async refreshNLPEntity(instance: IGBInstance, listName, listData): Promise<void> {
|
||||||
const service = new AzureDeployerService(this);
|
const service = new AzureDeployerService(this);
|
||||||
const res = await service.refreshEntityList(
|
const res = await service.refreshEntityList(
|
||||||
instance.cloudLocation,
|
instance.cloudLocation,
|
||||||
instance.nlpAppId,
|
instance.nlpAppId,
|
||||||
listName,
|
listName,
|
||||||
instance.nlpAuthoringKey,
|
instance.nlpAuthoringKey,
|
||||||
listData
|
listData
|
||||||
);
|
);
|
||||||
if(res.status !== 200) throw res.bodyAsText;
|
if (res.status !== 200) throw res.bodyAsText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,7 +285,7 @@ export class GBDeployer implements IGBDeployer {
|
||||||
await this.deployBotFull(instance, publicAddress);
|
await this.deployBotFull(instance, publicAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async loadParamsFromExcel(min: GBMinInstance): Promise<any> {
|
public async loadParamsFromTabular(min: GBMinInstance): Promise<any> {
|
||||||
let token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
let token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||||
|
|
||||||
let siteId = process.env.STORAGE_SITE_ID;
|
let siteId = process.env.STORAGE_SITE_ID;
|
||||||
|
@ -417,11 +407,12 @@ export class GBDeployer implements IGBDeployer {
|
||||||
|
|
||||||
switch (packageType) {
|
switch (packageType) {
|
||||||
case '.gbot':
|
case '.gbot':
|
||||||
if (Fs.existsSync(localPath)) {
|
if (process.env.ENABLE_PARAMS_ONLINE === 'false') {
|
||||||
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
|
if (Fs.existsSync(localPath)) {
|
||||||
}
|
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
|
||||||
if (process.env.ENABLE_PARAMS_ONLINE === 'true') {
|
}
|
||||||
min.instance.params = await this.loadParamsFromExcel(min);
|
} else {
|
||||||
|
min.instance.params = await this.loadParamsFromTabular(min);
|
||||||
}
|
}
|
||||||
await this.core.saveInstance(min.instance);
|
await this.core.saveInstance(min.instance);
|
||||||
|
|
||||||
|
|
|
@ -794,7 +794,7 @@ export class GBMinService {
|
||||||
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
|
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
|
||||||
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
||||||
query,
|
query,
|
||||||
'pt'
|
'en'
|
||||||
);
|
);
|
||||||
GBLog.info(`Translated text: ${query}.`);
|
GBLog.info(`Translated text: ${query}.`);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ export class AskDialog extends IGBDialog {
|
||||||
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
|
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
|
||||||
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
||||||
query,
|
query,
|
||||||
'pt'
|
'en'
|
||||||
);
|
);
|
||||||
GBLog.info(`Translated text: ${query}.`);
|
GBLog.info(`Translated text: ${query}.`);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue