fix(kb.gbapp): Fix importing packages.
This commit is contained in:
parent
e7a7b41531
commit
cbc3ca9fbf
1 changed files with 14 additions and 12 deletions
|
@ -667,18 +667,6 @@ export class KBService implements IGBKBService {
|
||||||
const subjectFile = urlJoin(localPath, 'subjects.json');
|
const subjectFile = urlJoin(localPath, 'subjects.json');
|
||||||
const menuFile = urlJoin(localPath, 'menu.xlsx');
|
const menuFile = urlJoin(localPath, 'menu.xlsx');
|
||||||
|
|
||||||
// Bot KB store clean up.
|
|
||||||
|
|
||||||
await GuaribasQuestion.destroy({
|
|
||||||
where: { instanceId: min.instance.instanceId }
|
|
||||||
});
|
|
||||||
await GuaribasAnswer.destroy({
|
|
||||||
where: { instanceId: min.instance.instanceId }
|
|
||||||
});
|
|
||||||
await GuaribasSubject.destroy({
|
|
||||||
where: { instanceId: min.instance.instanceId}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Imports menu.xlsx if any.
|
// Imports menu.xlsx if any.
|
||||||
|
|
||||||
if (Fs.existsSync(subjectFile) || Fs.existsSync(menuFile)) {
|
if (Fs.existsSync(subjectFile) || Fs.existsSync(menuFile)) {
|
||||||
|
@ -1031,6 +1019,20 @@ 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}`);
|
||||||
|
|
||||||
|
// Bot KB store clean up.
|
||||||
|
|
||||||
|
await GuaribasQuestion.destroy({
|
||||||
|
where: { instanceId: min.instance.instanceId }
|
||||||
|
});
|
||||||
|
await GuaribasAnswer.destroy({
|
||||||
|
where: { instanceId: min.instance.instanceId }
|
||||||
|
});
|
||||||
|
await GuaribasSubject.destroy({
|
||||||
|
where: { instanceId: min.instance.instanceId}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
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