fix(kb.gbapp): Fix importing packages.
This commit is contained in:
parent
ac865497f0
commit
e39c33b8f7
3 changed files with 11 additions and 3 deletions
|
@ -170,7 +170,7 @@ export class GBAdminService implements IGBAdminService {
|
||||||
// .gbot packages are handled using storage API, so no download
|
// .gbot packages are handled using storage API, so no download
|
||||||
// of local resources is required.
|
// of local resources is required.
|
||||||
const gbai = DialogKeywords.getGBAIPath(min.instance.botId);
|
const gbai = DialogKeywords.getGBAIPath(min.instance.botId);
|
||||||
await deployer['undeployPackageFromPackageName'](min.instance, packageName);
|
|
||||||
await deployer['downloadFolder'](min,
|
await deployer['downloadFolder'](min,
|
||||||
Path.join('work', `${gbai}`),
|
Path.join('work', `${gbai}`),
|
||||||
Path.basename(localFolder));
|
Path.basename(localFolder));
|
||||||
|
|
|
@ -662,6 +662,14 @@ export class GBDeployer implements IGBDeployer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the package local files from cache.
|
||||||
|
*/
|
||||||
|
public async cleanupPackage(instance: IGBInstance, packageName: string) {
|
||||||
|
const path = DialogKeywords.getGBAIPath(instance.botId, null, packageName);
|
||||||
|
const localFolder = Path.join('work', path);
|
||||||
|
rimraf.sync(localFolder);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the package from the storage and local work folders.
|
* Removes the package from the storage and local work folders.
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ export class KBService implements IGBKBService {
|
||||||
const packageName = Path.basename(localPath);
|
const packageName = Path.basename(localPath);
|
||||||
const instance = await core.loadInstanceByBotId(min.botId);
|
const instance = await core.loadInstanceByBotId(min.botId);
|
||||||
GBLog.info(`[GBDeployer] Importing: ${localPath}`);
|
GBLog.info(`[GBDeployer] Importing: ${localPath}`);
|
||||||
|
await deployer['cleanupPackage'](min.instance, packageName);
|
||||||
const p = await deployer.deployPackageToStorage(instance.instanceId, packageName);
|
const p = await deployer.deployPackageToStorage(instance.instanceId, packageName);
|
||||||
await this.importKbPackage(min, localPath, p, instance);
|
await this.importKbPackage(min, localPath, p, instance);
|
||||||
GBDeployer.mountGBKBAssets(packageName, min.botId, localPath);
|
GBDeployer.mountGBKBAssets(packageName, min.botId, localPath);
|
||||||
|
|
Loading…
Add table
Reference in a new issue