fix(all): New templates.

This commit is contained in:
Rodrigo Rodriguez 2024-08-23 17:54:47 -03:00
parent 2a93f0886f
commit 26f5fcec7c
4 changed files with 13 additions and 31 deletions

View file

@ -200,7 +200,6 @@
"sequelize": "6.28.2", "sequelize": "6.28.2",
"sequelize-cli": "6.6.0", "sequelize-cli": "6.6.0",
"sequelize-typescript": "2.1.5", "sequelize-typescript": "2.1.5",
"sharp": "0.33.4",
"simple-git": "3.24.0", "simple-git": "3.24.0",
"speakingurl": "14.0.1", "speakingurl": "14.0.1",
"sqlite3": "5.1.7", "sqlite3": "5.1.7",

View file

@ -39,7 +39,6 @@ import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
import urlJoin from 'url-join'; import urlJoin from 'url-join';
import { GBServer } from '../../../src/app.js'; import { GBServer } from '../../../src/app.js';
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js'; import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
import sharp from 'sharp';
/** /**
* Image processing services of conversation to be called by BASIC. * Image processing services of conversation to be called by BASIC.
@ -55,22 +54,8 @@ export class ImageProcessingServices {
GBLogEx.info(min, `BASIC: Image Processing SHARPEN ${file}.`); GBLogEx.info(min, `BASIC: Image Processing SHARPEN ${file}.`);
const gbfile = DialogKeywords.getFileByHandle(file); const gbfile = DialogKeywords.getFileByHandle(file);
const data = await sharp(gbfile.data)
.sharpen({
sigma: 2,
m1: 0,
m2: 3,
x1: 3,
y2: 15,
y3: 15
})
.toBuffer();
const newFile = { // TODO: sharp.
filename: gbfile.filename,
data: data
};
return; return;
} }

View file

@ -56,7 +56,6 @@ import Docxtemplater from 'docxtemplater';
import pptxTemplaterModule from 'pptxtemplater'; import pptxTemplaterModule from 'pptxtemplater';
import _ from 'lodash'; import _ from 'lodash';
import { pdfToPng, PngPageOutput } from 'pdf-to-png-converter'; import { pdfToPng, PngPageOutput } from 'pdf-to-png-converter';
import sharp from 'sharp';
import ImageModule from 'open-docxtemplater-image-module'; import ImageModule from 'open-docxtemplater-image-module';
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js'; import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
import { WebAutomationServices } from './WebAutomationServices.js'; import { WebAutomationServices } from './WebAutomationServices.js';
@ -1998,11 +1997,11 @@ export class SystemKeywords {
return (orientation || 0) >= 5 ? [height, width] : [width, height]; return (orientation || 0) >= 5 ? [height, width] : [width, height];
}; };
const metadata = await sharp(buf).metadata(); // TODO: sharp. const metadata = await sharp(buf).metadata();
const size = getNormalSize({ const size = getNormalSize({
width: metadata['width'], width: 400,
height: metadata['height'], height: 400,
orientation: metadata['orientation'] orientation: '0'
}); });
url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(imageName)); url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(imageName));
images[index++] = { url: url, size: size, buf: buf }; images[index++] = { url: url, size: size, buf: buf };

View file

@ -53,7 +53,6 @@ import puppeteer, { Page } from 'puppeteer';
import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter'; import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter';
import { Document } from 'langchain/document'; import { Document } from 'langchain/document';
import getColors from 'get-image-colors'; import getColors from 'get-image-colors';
import sharp from 'sharp';
import { import {
GBDialogStep, GBDialogStep,
@ -1070,14 +1069,14 @@ export class KBService implements IGBKBService {
const logoBinary = await page.goto(logo); const logoBinary = await page.goto(logo);
const buffer = await logoBinary.buffer(); const buffer = await logoBinary.buffer();
const logoFilename = Path.basename(logo); const logoFilename = Path.basename(logo);
sharp(buffer) // TODO: sharp(buffer)
.resize({ // .resize({
width: 48, // width: 48,
height: 48, // height: 48,
fit: 'inside', // Resize the image to fit within the specified dimensions // fit: 'inside', // Resize the image to fit within the specified dimensions
withoutEnlargement: true // Don't enlarge the image if its dimensions are already smaller // withoutEnlargement: true // Don't enlarge the image if its dimensions are already smaller
}) // })
.toFile(Path.join(logoPath, logoFilename)); // .toFile(Path.join(logoPath, logoFilename));
await min.core['setConfig'](min, 'Logo', logoFilename); await min.core['setConfig'](min, 'Logo', logoFilename);
} catch (error) { } catch (error) {
GBLogEx.debug(min, error); GBLogEx.debug(min, error);