new(all): Auto import for logo, colors and website content.
This commit is contained in:
parent
69ae924937
commit
4335dfc1c0
5 changed files with 25 additions and 16 deletions
|
@ -13,7 +13,6 @@
|
|||
"PH <ph.an@outlook.com>",
|
||||
"Dário Vieira <dario.junior3@gmail.com>",
|
||||
"Alan Perdomo <alanperdomo@hotmail.com>"
|
||||
|
||||
],
|
||||
"engines": {
|
||||
"node": "=21.7.3"
|
||||
|
@ -220,6 +219,7 @@
|
|||
"whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7",
|
||||
"winston": "3.8.2",
|
||||
"ws": "8.14.2",
|
||||
"yaml": "2.4.2",
|
||||
"yarn": "1.22.19",
|
||||
"zod-to-json-schema": "^3.22.4"
|
||||
},
|
||||
|
@ -242,8 +242,8 @@
|
|||
"vitest": "^1.3.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-win32-x64": "0.33.4",
|
||||
"@img/sharp-linux-arm": "0.33.4"
|
||||
"@img/sharp-linux-arm": "0.33.4",
|
||||
"@img/sharp-win32-x64": "0.33.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
|
|
|
@ -177,6 +177,7 @@ export class GBVMService extends GBService {
|
|||
"author": "${min.botId} owner.",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"yaml": "2.4.2",
|
||||
"encoding": "0.1.13",
|
||||
"isomorphic-fetch": "3.0.0",
|
||||
"punycode": "2.1.1",
|
||||
|
@ -510,6 +511,7 @@ export class GBVMService extends GBService {
|
|||
// Imports npm packages for this .gbdialog conversational application.
|
||||
|
||||
require('isomorphic-fetch');
|
||||
const YAML = require('yaml');
|
||||
const http = require('node:http');
|
||||
const retry = require('async-retry');
|
||||
const createRpcClient = require("@push-rpc/core").createRpcClient;
|
||||
|
@ -649,6 +651,12 @@ export class GBVMService extends GBService {
|
|||
}
|
||||
};
|
||||
|
||||
const TOYAML = (json) => {
|
||||
const doc = new YAML.Document();
|
||||
doc.contents = json;
|
||||
return doc.toString();
|
||||
}
|
||||
|
||||
// Line of Business logic.
|
||||
|
||||
let __reportMerge = {adds: 0, updates: 0, skipped: 0};
|
||||
|
|
|
@ -1331,11 +1331,12 @@ export class SystemKeywords {
|
|||
const xlRow = rows[foundIndex];
|
||||
let hasValue = false;
|
||||
for (let colIndex = 0; colIndex < xlRow.length; colIndex++) {
|
||||
const propertyName = header[colIndex];
|
||||
const propertyName = header[colIndex].trim();
|
||||
|
||||
let value = xlRow[colIndex];
|
||||
if (value) {
|
||||
hasValue = true;
|
||||
value = value.trim();
|
||||
if (value.charAt(0) === "'") {
|
||||
if (await this.isValidDate({ pid, dt: value.substr(1) })) {
|
||||
value = value.substr(1);
|
||||
|
|
|
@ -280,7 +280,7 @@ export class ChatServices {
|
|||
|
||||
const model = new ChatOpenAI({
|
||||
openAIApiKey: process.env.OPENAI_API_KEY,
|
||||
modelName: 'gpt-3.5-turbo-0125',
|
||||
modelName: 'gpt-4o',
|
||||
temperature: 0,
|
||||
callbacks: [logHandler]
|
||||
});
|
||||
|
@ -433,7 +433,7 @@ export class ChatServices {
|
|||
|
||||
if (LLMMode === 'direct') {
|
||||
|
||||
result = directChain.invoke(question);
|
||||
result = await directChain.invoke(question);
|
||||
|
||||
} else if (LLMMode === 'document-ref' || LLMMode === 'document') {
|
||||
const res = await combineDocumentsChain.invoke(question);
|
||||
|
@ -444,8 +444,14 @@ export class ChatServices {
|
|||
result = await conversationalToolChain.invoke({
|
||||
question
|
||||
});
|
||||
} else if (LLMMode === 'full') {
|
||||
throw new Error('Not implemented.'); // TODO: #407.
|
||||
} else if (LLMMode === 'nochain') {
|
||||
result = await (tools.length > 0 ? modelWithTools : model).invoke(`
|
||||
${systemPrompt}
|
||||
|
||||
${question}`);
|
||||
|
||||
result = result.content;
|
||||
|
||||
} else {
|
||||
GBLogEx.info(min, `Invalid Answer Mode in Config.xlsx: ${LLMMode}.`);
|
||||
}
|
||||
|
|
|
@ -911,19 +911,14 @@ export class KBService implements IGBKBService {
|
|||
// If the URL doesn't represent an HTML page, skip crawling its links
|
||||
return [];
|
||||
}
|
||||
const currentDomain = new URL(page.url()).hostname.toLocaleLowerCase();
|
||||
const currentDomain = new URL(page.url()).hostname;
|
||||
|
||||
let links = await page.evaluate(
|
||||
({ currentDomain, websiteIgnoreUrls }) => {
|
||||
const anchors = Array.from(document.querySelectorAll('a')).filter(p => {
|
||||
try {
|
||||
// Check if urlToCheck contains any of the ignored URLs
|
||||
|
||||
const isIgnored = websiteIgnoreUrls.split(';').some(ignoredUrl => p.href.includes(ignoredUrl));
|
||||
console.log(currentDomain);
|
||||
console.log(new URL(p.href).hostname);
|
||||
|
||||
return !isIgnored && currentDomain == new URL(p.href).hostname.toLocaleLowerCase();
|
||||
return currentDomain == new URL(p.href).hostname;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1028,7 +1023,6 @@ export class KBService implements IGBKBService {
|
|||
let website = min.core.getParam<string>(min.instance, 'Website', null);
|
||||
const websiteIgnoreUrls = min.core.getParam<string>(min.instance, 'Website Ignore URLs', null);
|
||||
|
||||
if (website) {
|
||||
|
||||
// Removes last slash if any.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue