From e385037872a54145548cb16afa3db53e85272d28 Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Mon, 25 Nov 2024 09:56:31 -0800 Subject: [PATCH] Add webscraper preload into imported plugins --- .../pages/Admin/Agents/Imported/ImportedSkillConfig/index.jsx | 2 +- server/utils/agents/imported.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Admin/Agents/Imported/ImportedSkillConfig/index.jsx b/frontend/src/pages/Admin/Agents/Imported/ImportedSkillConfig/index.jsx index 687fff9c9e..8d33e65631 100644 --- a/frontend/src/pages/Admin/Agents/Imported/ImportedSkillConfig/index.jsx +++ b/frontend/src/pages/Admin/Agents/Imported/ImportedSkillConfig/index.jsx @@ -96,7 +96,7 @@ export default function ImportedSkillConfig({ useEffect(() => { setHasChanges( JSON.stringify(inputs) !== - JSON.stringify(inputsFromArgs(selectedSkill.setup_args)) + JSON.stringify(inputsFromArgs(selectedSkill.setup_args)) ); }, [inputs]); diff --git a/server/utils/agents/imported.js b/server/utils/agents/imported.js index d1f55e5463..c62284764e 100644 --- a/server/utils/agents/imported.js +++ b/server/utils/agents/imported.js @@ -2,10 +2,12 @@ const fs = require("fs"); const path = require("path"); const { safeJsonParse } = require("../http"); const { isWithin, normalizePath } = require("../files"); +const { CollectorApi } = require("../collectorApi"); const pluginsPath = process.env.NODE_ENV === "development" ? path.resolve(__dirname, "../../storage/plugins/agent-skills") : path.resolve(process.env.STORAGE_DIR, "plugins", "agent-skills"); +const sharedWebScraper = new CollectorApi(); class ImportedPlugin { constructor(config) { @@ -184,6 +186,7 @@ class ImportedPlugin { description: this.config.description, logger: aibitat?.handlerProps?.log || console.log, // Allows plugin to log to the console. introspect: aibitat?.introspect || console.log, // Allows plugin to display a "thought" the chat window UI. + webScraper: sharedWebScraper, examples: this.config.examples ?? [], parameters: { $schema: "http://json-schema.org/draft-07/schema#",