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
|
||||
// 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));
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue