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