fix(kb.gbapp): Fix importing packages.

This commit is contained in:
Rodrigo Rodriguez 2023-09-13 21:02:33 -03:00
parent 917c8ac58e
commit e436c6e896
2 changed files with 18 additions and 3 deletions

View file

@ -662,6 +662,22 @@ export class GBDeployer implements IGBDeployer {
}
}
/**
* Removes the package from the storage and local work folders.
*/
public async undeployPackageFromPackageName(instance: IGBInstance, packageName: string) {
// Gets information about the package.
const packageType = Path.extname(packageName);
const p = await this.getStoragePackageByName(instance.instanceId, packageName);
const path = DialogKeywords.getGBAIPath(instance.botId, null, packageName);
const localFolder = Path.join('work', path);
return await this.undeployPackageFromLocalPath(instance, localFolder);
}
/**
* Removes the package from the storage and local work folders.
*/

View file

@ -1019,9 +1019,8 @@ export class KBService implements IGBKBService {
const packageName = Path.basename(localPath);
const instance = await core.loadInstanceByBotId(min.botId);
GBLog.info(`[GBDeployer] Importing: ${localPath}`);
await deployer.undeployPackageFromLocalPath(instance, localPath);
await deployer['undeployPackageFromPackageName'](instance, packageName);
const p = await deployer.deployPackageToStorage(instance.instanceId, packageName);
await this.importKbPackage(min, localPath, p, instance);
GBDeployer.mountGBKBAssets(packageName, min.botId, localPath);