From a443927d3658123e370cce0934a258c19ee6d1c6 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 3 Dec 2024 19:56:39 -0300 Subject: [PATCH] fix(llm.gblib): Fix in doc. publishing. --- package.json | 1 + packages/core.gbapp/services/GBDeployer.ts | 2 +- packages/kb.gbapp/services/KBService.ts | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 64b59324..723ddf3e 100644 --- a/package.json +++ b/package.json @@ -151,6 +151,7 @@ "html-to-md": "0.8.6", "http-proxy": "1.18.1", "ibm-watson": "9.1.0", + "icojs": "^0.19.4", "instagram-private-api": "1.46.1", "iso-639-1": "3.1.3", "isomorphic-fetch": "3.0.0", diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index c955d679..fbef4fc6 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -964,7 +964,7 @@ export class GBDeployer implements IGBDeployer { GBServer.globals.server.use( `/${gbaiName}/${botId}.gbdrive/public`, - express.static(urlJoin('work', gbaiName, `${botId}.gbdata`, 'public')) + express.static(urlJoin('work', gbaiName, `${botId}.gbdrive`, 'public')) ); GBLog.verbose(`KB (.gbkb) assets accessible at: /kb/${gbaiName}/${packageName}.`); diff --git a/packages/kb.gbapp/services/KBService.ts b/packages/kb.gbapp/services/KBService.ts index 1b1d9d1b..8e5c2145 100644 --- a/packages/kb.gbapp/services/KBService.ts +++ b/packages/kb.gbapp/services/KBService.ts @@ -48,6 +48,7 @@ import { DocxLoader } from '@langchain/community/document_loaders/fs/docx'; import { EPubLoader } from '@langchain/community/document_loaders/fs/epub'; import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf'; import svg2img from 'svg2img'; +import isICO from 'icojs'; import getColors from 'get-image-colors'; import { Document } from 'langchain/document'; import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter'; @@ -1069,13 +1070,18 @@ export class KBService implements IGBKBService { const logoBinary = await page.goto(logo); let buffer = await logoBinary.buffer(); - let logoFilename = path.basename(logo); + let logoFilename = 'extracted-logo.png'; // Replace sharp with jimp - if (buffer.toString().includes(' {