diff --git a/packages/admin.gbapp/services/GBAdminService.ts b/packages/admin.gbapp/services/GBAdminService.ts index 7a70a505..df74e5c2 100644 --- a/packages/admin.gbapp/services/GBAdminService.ts +++ b/packages/admin.gbapp/services/GBAdminService.ts @@ -170,7 +170,7 @@ export class GBAdminService implements IGBAdminService { // .gbot packages are handled using storage API, so no download // of local resources is required. const gbai = DialogKeywords.getGBAIPath(min.instance.botId); - await deployer['undeployPackageFromPackageName'](min.instance, packageName); + await deployer['downloadFolder'](min, Path.join('work', `${gbai}`), Path.basename(localFolder)); diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index 7d755ea0..7c552bc8 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -662,7 +662,15 @@ 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. */ diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index dc9ba736..66a9af2b 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -1019,7 +1019,7 @@ export class KBService implements IGBKBService { const packageName = Path.basename(localPath); const instance = await core.loadInstanceByBotId(min.botId); GBLog.info(`[GBDeployer] Importing: ${localPath}`); - + await deployer['cleanupPackage'](min.instance, packageName); const p = await deployer.deployPackageToStorage(instance.instanceId, packageName); await this.importKbPackage(min, localPath, p, instance); GBDeployer.mountGBKBAssets(packageName, min.botId, localPath);