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) {
|
||||
return await msRestAzure.loginWithUsernamePassword(username, password);
|
||||
}
|
||||
|
||||
|
||||
public static getMobileCode() {
|
||||
const passwordGenerator = new PasswordGenerator();
|
||||
const options = {
|
||||
|
@ -101,7 +101,6 @@ export class GBAdminService implements IGBAdminService {
|
|||
return passwordGenerator.generatePassword(options);
|
||||
}
|
||||
|
||||
|
||||
public static getRndPassword(): string {
|
||||
const passwordGenerator = new PasswordGenerator();
|
||||
const options = {
|
||||
|
@ -168,7 +167,6 @@ export class GBAdminService implements IGBAdminService {
|
|||
}
|
||||
|
||||
public async acquireElevatedToken(instanceId: number): Promise<string> {
|
||||
|
||||
// TODO: Use boot bot as base for authentication.
|
||||
|
||||
let botId = GBConfigService.get('BOT_ID');
|
||||
|
@ -227,9 +225,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
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) {
|
||||
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.');
|
||||
}
|
||||
await deployer.deployPackage(min, urlJoin(additionalPath, packageName));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
let siteName = text.split(' ')[1];
|
||||
let folderName = text.split(' ')[2];
|
||||
|
||||
let packageType = Path.extname(folderName);
|
||||
if (packageType !== '.gbot') {
|
||||
let s = new GBSharePointService();
|
||||
let s = new GBSharePointService();
|
||||
|
||||
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`);
|
||||
await s.downloadFolder(localFolder, siteName, folderName,
|
||||
GBConfigService.get('CLOUD_USERNAME'), GBConfigService.get('CLOUD_PASSWORD'))
|
||||
await deployer.deployPackage(min, localFolder);
|
||||
}
|
||||
else {
|
||||
await deployer.deployPackage(min, 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`);
|
||||
await s.downloadFolder(
|
||||
localFolder,
|
||||
siteName,
|
||||
folderName,
|
||||
GBConfigService.get('CLOUD_USERNAME'),
|
||||
GBConfigService.get('CLOUD_PASSWORD')
|
||||
);
|
||||
await deployer.deployPackage(min, localFolder);
|
||||
}
|
||||
}
|
||||
public static async rebuildIndexPackageCommand(min: GBMinInstance, deployer: IGBDeployer) {
|
||||
|
@ -271,7 +265,4 @@ export class GBAdminService implements IGBAdminService {
|
|||
const service = await AzureDeployerService.createInstance(deployer);
|
||||
service.syncBotServerRepository(min.instance.botId, serverName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -477,7 +477,10 @@ export class GBConversationalService {
|
|||
|
||||
let nlp: RecognizerResult;
|
||||
try {
|
||||
const saved = step.context.activity.text
|
||||
step.context.activity.text = text;
|
||||
nlp = await model.recognize(step.context);
|
||||
step.context.activity.text = saved;
|
||||
} catch (error) {
|
||||
// tslint:disable:no-unsafe-any
|
||||
if (error.statusCode === 404) {
|
||||
|
|
|
@ -247,23 +247,14 @@ export class GBDeployer implements IGBDeployer {
|
|||
|
||||
public async publishNLP(instance: IGBInstance): Promise<void> {
|
||||
const service = new AzureDeployerService(this);
|
||||
const res = await service.publishNLP(
|
||||
instance.cloudLocation,
|
||||
instance.nlpAppId,
|
||||
instance.nlpAuthoringKey,
|
||||
);
|
||||
if(res.status !== 200 && res.status !== 201) throw res.bodyAsText;
|
||||
|
||||
const res = await service.publishNLP(instance.cloudLocation, instance.nlpAppId, instance.nlpAuthoringKey);
|
||||
if (res.status !== 200 && res.status !== 201) throw res.bodyAsText;
|
||||
}
|
||||
|
||||
public async trainNLP(instance: IGBInstance): Promise<void> {
|
||||
const service = new AzureDeployerService(this);
|
||||
const res = await service.trainNLP(
|
||||
instance.cloudLocation,
|
||||
instance.nlpAppId,
|
||||
instance.nlpAuthoringKey,
|
||||
);
|
||||
if(res.status !== 200 && res.status !== 202) throw res.bodyAsText;
|
||||
const res = await service.trainNLP(instance.cloudLocation, instance.nlpAppId, instance.nlpAuthoringKey);
|
||||
if (res.status !== 200 && res.status !== 202) throw res.bodyAsText;
|
||||
let sleep = ms => {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
|
@ -274,15 +265,14 @@ export class GBDeployer implements IGBDeployer {
|
|||
|
||||
public async refreshNLPEntity(instance: IGBInstance, listName, listData): Promise<void> {
|
||||
const service = new AzureDeployerService(this);
|
||||
const res = await service.refreshEntityList(
|
||||
const res = await service.refreshEntityList(
|
||||
instance.cloudLocation,
|
||||
instance.nlpAppId,
|
||||
listName,
|
||||
instance.nlpAuthoringKey,
|
||||
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);
|
||||
}
|
||||
|
||||
public async loadParamsFromExcel(min: GBMinInstance): Promise<any> {
|
||||
public async loadParamsFromTabular(min: GBMinInstance): Promise<any> {
|
||||
let token = await min.adminService.acquireElevatedToken(min.instance.instanceId);
|
||||
|
||||
let siteId = process.env.STORAGE_SITE_ID;
|
||||
|
@ -417,11 +407,12 @@ export class GBDeployer implements IGBDeployer {
|
|||
|
||||
switch (packageType) {
|
||||
case '.gbot':
|
||||
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);
|
||||
if (process.env.ENABLE_PARAMS_ONLINE === 'false') {
|
||||
if (Fs.existsSync(localPath)) {
|
||||
await this.deployBotFromLocalPath(localPath, GBServer.globals.publicAddress);
|
||||
}
|
||||
} else {
|
||||
min.instance.params = await this.loadParamsFromTabular(min);
|
||||
}
|
||||
await this.core.saveInstance(min.instance);
|
||||
|
||||
|
|
|
@ -794,7 +794,7 @@ export class GBMinService {
|
|||
min.instance.translatorKey ? min.instance.translatorKey : minBoot.instance.translatorKey,
|
||||
min.instance.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
||||
query,
|
||||
'pt'
|
||||
'en'
|
||||
);
|
||||
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.translatorEndpoint ? min.instance.translatorEndpoint : minBoot.instance.translatorEndpoint,
|
||||
query,
|
||||
'pt'
|
||||
'en'
|
||||
);
|
||||
GBLog.info(`Translated text: ${query}.`);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue