fix(services): refactor GBOService instantiation and update template listing logic
Some checks failed
GBCI / build (push) Has been cancelled
Some checks failed
GBCI / build (push) Has been cancelled
This commit is contained in:
parent
0e74502cc1
commit
ba750a289f
7 changed files with 232 additions and 175 deletions
|
@ -1028,7 +1028,7 @@ export class GBVMService extends GBService {
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!GBConfigService.get('GBVM')) {
|
if (GBConfigService.get('GBVM') !== false) {
|
||||||
return await (async () => {
|
return await (async () => {
|
||||||
return await new Promise((resolve) => {
|
return await new Promise((resolve) => {
|
||||||
sandbox['resolve'] = resolve;
|
sandbox['resolve'] = resolve;
|
||||||
|
|
|
@ -86,7 +86,7 @@ export class GBConfigService {
|
||||||
value = this.getServerPort();
|
value = this.getServerPort();
|
||||||
break;
|
break;
|
||||||
case 'GBVM':
|
case 'GBVM':
|
||||||
value = false;
|
value = true;
|
||||||
break;
|
break;
|
||||||
case 'STORAGE_NAME':
|
case 'STORAGE_NAME':
|
||||||
value = null;
|
value = null;
|
||||||
|
|
|
@ -113,7 +113,7 @@ export class GBCoreService implements IGBCoreService {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.adminService = new GBAdminService(this);
|
this.adminService = new GBAdminService(this);
|
||||||
}
|
}
|
||||||
public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) {}
|
public async ensureInstances(instances: IGBInstance[], bootInstance: any, core: IGBCoreService) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets database config and connect to storage. Currently two databases
|
* Gets database config and connect to storage. Currently two databases
|
||||||
|
@ -338,7 +338,7 @@ STORAGE_SYNC_ALTER=true
|
||||||
ENDPOINT_UPDATE=true
|
ENDPOINT_UPDATE=true
|
||||||
`;
|
`;
|
||||||
|
|
||||||
await fs.writeFile('.env', env);
|
await fs.writeFile('.env', env);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -548,7 +548,7 @@ await fs.writeFile('.env', env);
|
||||||
* Verifies that an complex global password has been specified
|
* Verifies that an complex global password has been specified
|
||||||
* before starting the server.
|
* before starting the server.
|
||||||
*/
|
*/
|
||||||
public ensureAdminIsSecured() {}
|
public ensureAdminIsSecured() { }
|
||||||
|
|
||||||
public async createBootInstance(
|
public async createBootInstance(
|
||||||
core: GBCoreService,
|
core: GBCoreService,
|
||||||
|
@ -732,7 +732,7 @@ await fs.writeFile('.env', env);
|
||||||
isEdit = true; // We are in editing mode
|
isEdit = true; // We are in editing mode
|
||||||
break;
|
break;
|
||||||
} else if (!result && lastEmptyRow === -1) {
|
} else if (!result && lastEmptyRow === -1) {
|
||||||
lastEmptyRow = i ; // Store the first empty row if no match is found
|
lastEmptyRow = i; // Store the first empty row if no match is found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,8 +904,11 @@ await fs.writeFile('.env', env);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async syncBotStorage(instances: any, botId: any, deployer: GBDeployer, libraryPath: string) {
|
private async syncBotStorage(instances: any, botId: any, deployer: GBDeployer, libraryPath: string) {
|
||||||
|
|
||||||
|
|
||||||
let instance = instances.find(p => p.botId.toLowerCase().trim() === botId.toLowerCase().trim());
|
let instance = instances.find(p => p.botId.toLowerCase().trim() === botId.toLowerCase().trim());
|
||||||
|
|
||||||
|
if (process.env.GB_MODE === 'local') {
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
GBLog.info(`Importing package ${botId}.gbai...`);
|
GBLog.info(`Importing package ${botId}.gbai...`);
|
||||||
|
|
||||||
|
@ -922,6 +925,7 @@ await fs.writeFile('.env', env);
|
||||||
fs.mkdir(gbaiPath, { recursive: true });
|
fs.mkdir(gbaiPath, { recursive: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,7 @@ export class GBDeployer implements IGBDeployer {
|
||||||
secretKey: process.env.DRIVE_SECRET,
|
secretKey: process.env.DRIVE_SECRET,
|
||||||
});
|
});
|
||||||
|
|
||||||
const bucketName = process.env.DRIVE_BUCKETPREFIX + min.botId + '.gbai';
|
const bucketName = process.env.DRIVE_ORG_PREFIX + min.botId + '.gbai';
|
||||||
|
|
||||||
if (!(await GBUtil.exists(localPath))) {
|
if (!(await GBUtil.exists(localPath))) {
|
||||||
await fs.mkdir(localPath, { recursive: true });
|
await fs.mkdir(localPath, { recursive: true });
|
||||||
|
@ -670,7 +670,7 @@ export class GBDeployer implements IGBDeployer {
|
||||||
await this.cleanupPackage(min.instance, packageName);
|
await this.cleanupPackage(min.instance, packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GBConfigService.get('GB_MODE') !== 'legacy') {
|
if (GBConfigService.get('GB_MODE') === 'local') {
|
||||||
const filePath = path.join(GBConfigService.get('STORAGE_LIBRARY'), gbai, packageName);
|
const filePath = path.join(GBConfigService.get('STORAGE_LIBRARY'), gbai, packageName);
|
||||||
await GBUtil.copyIfNewerRecursive(filePath, packageWorkFolder);
|
await GBUtil.copyIfNewerRecursive(filePath, packageWorkFolder);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,7 +116,7 @@ export class NewUserDialog extends IGBDialog {
|
||||||
return await step.replaceDialog('/welcome_saas_bottemplate', step.activeDialog.state.options);
|
return await step.replaceDialog('/welcome_saas_bottemplate', step.activeDialog.state.options);
|
||||||
} else {
|
} else {
|
||||||
step.activeDialog.state.options.templateName = template;
|
step.activeDialog.state.options.templateName = template;
|
||||||
debugger;
|
|
||||||
await NewUserDialog.createBot(step, min, true);
|
await NewUserDialog.createBot(step, min, true);
|
||||||
|
|
||||||
return await step.replaceDialog('/ask', { isReturning: true });
|
return await step.replaceDialog('/ask', { isReturning: true });
|
||||||
|
@ -252,7 +252,7 @@ export class NewUserDialog extends IGBDialog {
|
||||||
'12',
|
'12',
|
||||||
'99',
|
'99',
|
||||||
'1234',
|
'1234',
|
||||||
'crawlergbot.gbai',
|
'ai-search.gbai',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,11 @@ import MicrosoftGraph from "@microsoft/microsoft-graph-client";
|
||||||
import sgMail from '@sendgrid/mail';
|
import sgMail from '@sendgrid/mail';
|
||||||
import { default as PasswordGenerator } from 'strict-password-generator';
|
import { default as PasswordGenerator } from 'strict-password-generator';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
import { existsSync } from 'fs';
|
||||||
|
|
||||||
import { GBConfigService } from "../../core.gbapp/services/GBConfigService.js";
|
import { GBConfigService } from "../../core.gbapp/services/GBConfigService.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { Client } from "minio";
|
||||||
|
|
||||||
|
|
||||||
export class GBOService {
|
export class GBOService {
|
||||||
|
@ -75,54 +78,6 @@ export class GBOService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createSubFolderAtRoot(token: string, name: string,
|
|
||||||
siteId: string, libraryId: string) {
|
|
||||||
return new Promise<any>((resolve, reject) => {
|
|
||||||
let client = MicrosoftGraph.Client.init({
|
|
||||||
authProvider: done => {
|
|
||||||
done(null, token);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const body = {
|
|
||||||
"name": name,
|
|
||||||
"folder": {},
|
|
||||||
"@microsoft.graph.conflictBehavior": "rename"
|
|
||||||
}
|
|
||||||
client.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root/children`)
|
|
||||||
.post(body, (err, res) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(res);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public async createSubFolderAt(token: string, parentPath: string, name: string,
|
|
||||||
siteId: string, libraryId: string) {
|
|
||||||
return new Promise<any>((resolve, reject) => {
|
|
||||||
let client = MicrosoftGraph.Client.init({
|
|
||||||
authProvider: done => {
|
|
||||||
done(null, token);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const body = {
|
|
||||||
"name": name,
|
|
||||||
"folder": {},
|
|
||||||
"@microsoft.graph.conflictBehavior": "rename"
|
|
||||||
}
|
|
||||||
client.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:/${parentPath}:/children`)
|
|
||||||
.post(body, (err, res) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(res);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async listTemplates(min: GBMinInstance) {
|
public async listTemplates(min: GBMinInstance) {
|
||||||
if (GBConfigService.get('GB_MODE') === 'legacy') {
|
if (GBConfigService.get('GB_MODE') === 'legacy') {
|
||||||
|
@ -146,7 +101,7 @@ export class GBOService {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
const templatesDir = path.join(process.env.PWD,'templates');
|
const templatesDir = path.join(process.env.PWD, 'templates');
|
||||||
const gbaiDirectories = [];
|
const gbaiDirectories = [];
|
||||||
|
|
||||||
// Read all entries in the templates directory
|
// Read all entries in the templates directory
|
||||||
|
@ -161,69 +116,111 @@ export class GBOService {
|
||||||
return gbaiDirectories;
|
return gbaiDirectories;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async copyTemplates(min: GBMinInstance, gbaiDest: any, templateName: string, kind: string, botName: string): Promise<void> {
|
||||||
|
const storageMode = process.env.GB_MODE;
|
||||||
|
|
||||||
public async copyTemplates(min: GBMinInstance, gbaiDest, templateName: string, kind: string, botName: string) {
|
if (storageMode === 'legacy') {
|
||||||
|
// Microsoft Graph (SharePoint) Implementation
|
||||||
|
const token = await (min.adminService as any).acquireElevatedToken(min.instance.instanceId, true);
|
||||||
|
const siteId = process.env.STORAGE_SITE_ID;
|
||||||
|
const templateLibraryId = process.env.SAAS_TEMPLATE_LIBRARY;
|
||||||
|
const libraryId = process.env.STORAGE_LIBRARY;
|
||||||
|
|
||||||
let token =
|
const client = MicrosoftGraph.Client.init({
|
||||||
await (min.adminService as any).acquireElevatedToken(min.instance.instanceId, true);
|
authProvider: (done) => done(null, token)
|
||||||
|
|
||||||
let siteId = process.env.STORAGE_SITE_ID;
|
|
||||||
let templateLibraryId = process.env.SAAS_TEMPLATE_LIBRARY;
|
|
||||||
let libraryId = process.env.STORAGE_LIBRARY;
|
|
||||||
|
|
||||||
let client = MicrosoftGraph.Client.init({
|
|
||||||
authProvider: done => {
|
|
||||||
done(null, token);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const body =
|
|
||||||
{
|
|
||||||
"parentReference": { driveId: gbaiDest.parentReference.driveId, id: gbaiDest.id },
|
|
||||||
"name": `${botName}.${kind}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const packageName = `${templateName.split('.')[0]}.${kind}`;
|
const packageName = `${templateName.split('.')[0]}.${kind}`;
|
||||||
|
const destinationName = `${botName}.${kind}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Try direct copy first
|
||||||
const src = await client.api(
|
const src = await client.api(
|
||||||
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/root:/${templateName}/${packageName}`)
|
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/root:/${templateName}/${packageName}`
|
||||||
.get();
|
).get();
|
||||||
|
|
||||||
return await client.api(
|
|
||||||
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/items/${src.id}/copy`)
|
|
||||||
.post(body);
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
|
|
||||||
if (error.code === "itemNotFound") {
|
|
||||||
|
|
||||||
} else if (error.code === "nameAlreadyExists") {
|
|
||||||
|
|
||||||
let src = await client.api(
|
|
||||||
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/root:/${templateName}/${packageName}:/children`)
|
|
||||||
.get();
|
|
||||||
const dstName = `${botName}.gbai/${botName}.${kind}`;
|
|
||||||
let dst = await client.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:/${dstName}`)
|
|
||||||
.get();
|
|
||||||
|
|
||||||
await CollectionUtil.asyncForEach(src.value, async item => {
|
|
||||||
|
|
||||||
const body =
|
|
||||||
{
|
|
||||||
"parentReference": { driveId: dst.parentReference.driveId, id: dst.id }
|
|
||||||
}
|
|
||||||
await client.api(
|
await client.api(
|
||||||
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/items/${item.id}/copy`)
|
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/items/${src.id}/copy`
|
||||||
.post(body);
|
).post({
|
||||||
|
parentReference: {
|
||||||
|
driveId: gbaiDest.parentReference.driveId,
|
||||||
|
id: gbaiDest.id
|
||||||
|
},
|
||||||
|
name: destinationName
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === "nameAlreadyExists") {
|
||||||
|
// Handle existing destination by copying contents individually
|
||||||
|
const srcItems = await client.api(
|
||||||
|
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/root:/${templateName}/${packageName}:/children`
|
||||||
|
).get();
|
||||||
|
|
||||||
|
const dstPath = `${botName}.gbai/${destinationName}`;
|
||||||
|
const dst = await client.api(
|
||||||
|
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root:/${dstPath}`
|
||||||
|
).get();
|
||||||
|
|
||||||
|
await CollectionUtil.asyncForEach(srcItems.value, async (item) => {
|
||||||
|
await client.api(
|
||||||
|
`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${templateLibraryId}/drive/items/${item.id}/copy`
|
||||||
|
).post({
|
||||||
|
parentReference: {
|
||||||
|
driveId: dst.parentReference.driveId,
|
||||||
|
id: dst.id
|
||||||
}
|
}
|
||||||
else {
|
});
|
||||||
GBLog.error(error);
|
});
|
||||||
|
} else {
|
||||||
|
GBLog.error(`Failed to copy templates: ${error.message}`);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (storageMode === 'gbcluster') {
|
||||||
|
|
||||||
|
// MinIO Implementation
|
||||||
|
const minioClient = new Client({
|
||||||
|
endPoint: process.env.DRIVE_SERVER,
|
||||||
|
port: parseInt(process.env.DRIVE_PORT),
|
||||||
|
useSSL: process.env.DRIVE_USE_SSL === 'true',
|
||||||
|
accessKey: process.env.DRIVE_ACCESSKEY,
|
||||||
|
secretKey: process.env.DRIVE_SECRET,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const bucketName = `${process.env.DRIVE_ORG_PREFIX}${botName}.gbai`;
|
||||||
|
const packageName = `${templateName.split('.')[0]}.${kind}`;
|
||||||
|
const localTemplatePath = path.join(process.env.PWD, 'templates', templateName, packageName);
|
||||||
|
const minioDestinationPath = `${botName}.${kind}`;
|
||||||
|
|
||||||
|
const uploadDirectory = async (localPath: string, minioPath: string = '') => {
|
||||||
|
|
||||||
|
// Ensure the bucket exists in local file system
|
||||||
|
if (existsSync(localPath)) {
|
||||||
|
|
||||||
|
const entries = await fs.readdir(localPath, { withFileTypes: true });
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
const fullLocalPath = path.join(localPath, entry.name);
|
||||||
|
const objectName = path.posix.join(minioPath, entry.name);
|
||||||
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
await uploadDirectory(fullLocalPath, objectName);
|
||||||
|
} else {
|
||||||
|
const fileContent = await fs.readFile(fullLocalPath);
|
||||||
|
await minioClient.putObject(bucketName, objectName, fileContent);
|
||||||
|
GBLog.info(`Uploaded ${objectName} to MinIO bucket ${bucketName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GBLog.verbose(`Package ${localPath} does not exist on templates.`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await uploadDirectory(localTemplatePath, minioDestinationPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async createExcelFile(min: GBMinInstance, destinationFolder: any, name: string) {
|
public async createExcelFile(min: GBMinInstance, destinationFolder: any, name: string) {
|
||||||
|
|
||||||
|
@ -365,4 +362,56 @@ export class GBOService {
|
||||||
|
|
||||||
return documents[0];
|
return documents[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async createRootFolder(token: string, name: string,
|
||||||
|
siteId: string, libraryId: string) {
|
||||||
|
const storageMode = process.env.GB_MODE;
|
||||||
|
|
||||||
|
if (storageMode === 'gbcluster') {
|
||||||
|
// Minio implementation
|
||||||
|
const minioClient = new Client({
|
||||||
|
endPoint: process.env.DRIVE_SERVER,
|
||||||
|
port: parseInt(process.env.DRIVE_PORT),
|
||||||
|
useSSL: process.env.DRIVE_USE_SSL === 'true',
|
||||||
|
accessKey: process.env.DRIVE_ACCESSKEY,
|
||||||
|
secretKey: process.env.DRIVE_SECRET,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Ensure bucket exists
|
||||||
|
|
||||||
|
name = `${process.env.DRIVE_ORG_PREFIX}${name}`;
|
||||||
|
const bucketExists = await minioClient.bucketExists(name);
|
||||||
|
if (!bucketExists) {
|
||||||
|
await minioClient.makeBucket(name);
|
||||||
|
}
|
||||||
|
return { name: name, folder: {} }; // Return similar structure to MS Graph
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Original MS Graph implementation
|
||||||
|
return new Promise<any>((resolve, reject) => {
|
||||||
|
let client = MicrosoftGraph.Client.init({
|
||||||
|
authProvider: done => {
|
||||||
|
done(null, token);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const body = {
|
||||||
|
"name": name,
|
||||||
|
"folder": {},
|
||||||
|
"@microsoft.graph.conflictBehavior": "rename"
|
||||||
|
}
|
||||||
|
client.api(`https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${libraryId}/drive/root/children`)
|
||||||
|
.post(body, (err, res) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import { GBMinInstance, GBLog } from 'botlib';
|
||||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
import urlJoin from 'url-join';
|
import urlJoin from 'url-join';
|
||||||
import { GBOService } from './GBOService.js';
|
import { GBOService } from './GBOService.js';
|
||||||
|
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
||||||
|
|
||||||
export class MainService {
|
export class MainService {
|
||||||
async createSubscriptionMSFT(email: string, plan: string, offer: string, quantity: number, additionalData: any) { }
|
async createSubscriptionMSFT(email: string, plan: string, offer: string, quantity: number, additionalData: any) { }
|
||||||
|
@ -105,7 +106,10 @@ export class MainService {
|
||||||
subscription.externalSubscriptionId = externalSubscriptionId;
|
subscription.externalSubscriptionId = externalSubscriptionId;
|
||||||
await subscription.save();
|
await subscription.save();
|
||||||
|
|
||||||
let token = await (min.adminService.acquireElevatedToken as any)(min.instance.instanceId, true);
|
let token =
|
||||||
|
GBConfigService.get('GB_MODE') === 'legacy'?
|
||||||
|
await (min.adminService.acquireElevatedToken as any)(min.instance.instanceId, true) :
|
||||||
|
null;
|
||||||
|
|
||||||
let siteId = process.env.STORAGE_SITE_ID;
|
let siteId = process.env.STORAGE_SITE_ID;
|
||||||
let libraryId = process.env.STORAGE_LIBRARY;
|
let libraryId = process.env.STORAGE_LIBRARY;
|
||||||
|
@ -119,15 +123,15 @@ export class MainService {
|
||||||
|
|
||||||
|
|
||||||
GBLog.info( 'Creating .gbai folder ...');
|
GBLog.info( 'Creating .gbai folder ...');
|
||||||
let item = await gboService.createSubFolderAtRoot(token, `${botName}.gbai`, siteId, libraryId);
|
let item = await gboService.createRootFolder(token, `${botName}.gbai`, siteId, libraryId);
|
||||||
await sleep(1000);
|
|
||||||
|
|
||||||
GBLog.info( 'Copying Templates...');
|
GBLog.info( 'Copying Templates...');
|
||||||
await gboService.copyTemplates(min, item, 'Shared.gbai', 'gbkb', botName);
|
// await gboService.copyTemplates(min, item, 'shared.gbai', 'gbkb', botName);
|
||||||
await gboService.copyTemplates(min, item, 'Shared.gbai', 'gbot', botName);
|
// await gboService.copyTemplates(min, item, 'shared.gbai', 'gbot', botName);
|
||||||
await gboService.copyTemplates(min, item, 'Shared.gbai', 'gbtheme', botName);
|
// await gboService.copyTemplates(min, item, 'shared.gbai', 'gbtheme', botName);
|
||||||
await gboService.copyTemplates(min, item, 'Shared.gbai', 'gbdialog', botName);
|
// await gboService.copyTemplates(min, item, 'shared.gbai', 'gbdialog', botName);
|
||||||
await gboService.copyTemplates(min, item, 'Shared.gbai', 'gbdata', botName);
|
// await gboService.copyTemplates(min, item, 'shared.gbai', 'gbdata', botName);
|
||||||
await gboService.copyTemplates(min, item, templateName, 'gbkb', botName);
|
await gboService.copyTemplates(min, item, templateName, 'gbkb', botName);
|
||||||
await gboService.copyTemplates(min, item, templateName, 'gbot', botName);
|
await gboService.copyTemplates(min, item, templateName, 'gbot', botName);
|
||||||
await gboService.copyTemplates(min, item, templateName, 'gbtheme', botName);
|
await gboService.copyTemplates(min, item, templateName, 'gbtheme', botName);
|
||||||
|
|
Loading…
Add table
Reference in a new issue