Skip to content

Commit

Permalink
new(all): Auto import for logo, colors and website content.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Rodriguez committed May 22, 2024
1 parent 9f2982d commit a379839
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/kb.gbapp/services/KBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,21 +1007,23 @@ export class KBService implements IGBKBService {
): Promise<any> {
let files = [];

Fs.rmSync(min['vectorStorePath'], { recursive: true, force: true });
let path = DialogKeywords.getGBAIPath(min.botId, `gbot`);
const directoryPath = Path.join(process.env.PWD, 'work', path, 'Website');
Fs.rmSync(directoryPath, { recursive: true, force: true });

const website = min.core.getParam<string>(min.instance, 'Website', null);

if (website) {

Fs.rmSync(min['vectorStorePath'], { recursive: true, force: true });
let path = DialogKeywords.getGBAIPath(min.botId, `gbot`);
const directoryPath = Path.join(process.env.PWD, 'work', path, 'Website');
Fs.rmSync(directoryPath, { recursive: true, force: true });

let browser = await puppeteer.launch({ headless: false });
const page = await this.getFreshPage(browser, website);
page.setDefaultTimeout(2000);
page.setCacheEnabled(false);

const logo = await this.getLogoByPage(page);
let path = DialogKeywords.getGBAIPath(min.botId);
path = DialogKeywords.getGBAIPath(min.botId);
const logoPath = Path.join(process.env.PWD, 'work', path, 'cache');
const baseUrl = page.url().split('/').slice(0, 3).join('/');
const logoBinary = await page.goto(urlJoin(baseUrl, logo));
Expand Down

0 comments on commit a379839

Please sign in to comment.