mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 12:40:09 +01:00
Support @agent
custom skills (#2280)
* Support `@agent` custom skills * move import
This commit is contained in:
parent
297b8aaf01
commit
b557a289fe
@ -1,5 +1,6 @@
|
|||||||
const AIbitat = require("./aibitat");
|
const AIbitat = require("./aibitat");
|
||||||
const AgentPlugins = require("./aibitat/plugins");
|
const AgentPlugins = require("./aibitat/plugins");
|
||||||
|
const ImportedPlugin = require("./imported");
|
||||||
const { httpSocket } = require("./aibitat/plugins/http-socket.js");
|
const { httpSocket } = require("./aibitat/plugins/http-socket.js");
|
||||||
const { WorkspaceChats } = require("../../models/workspaceChats");
|
const { WorkspaceChats } = require("../../models/workspaceChats");
|
||||||
const { safeJsonParse } = require("../http");
|
const { safeJsonParse } = require("../http");
|
||||||
@ -160,6 +161,27 @@ class EphemeralAgentHandler extends AgentHandler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load imported plugin. This is marked by `@@` in the array of functions to load.
|
||||||
|
// and is the @@hubID of the plugin.
|
||||||
|
if (name.startsWith("@@")) {
|
||||||
|
const hubId = name.replace("@@", "");
|
||||||
|
const valid = ImportedPlugin.validateImportedPluginHandler(hubId);
|
||||||
|
if (!valid) {
|
||||||
|
this.log(
|
||||||
|
`Imported plugin by hubId ${hubId} not found in plugin directory. Skipping inclusion to agent cluster.`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const plugin = ImportedPlugin.loadPluginByHubId(hubId);
|
||||||
|
const callOpts = plugin.parseCallOptions();
|
||||||
|
this.aibitat.use(plugin.plugin(callOpts));
|
||||||
|
this.log(
|
||||||
|
`Attached ${plugin.name} (${hubId}) imported plugin to Agent cluster`
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Load single-stage plugin.
|
// Load single-stage plugin.
|
||||||
if (!AgentPlugins.hasOwnProperty(name)) {
|
if (!AgentPlugins.hasOwnProperty(name)) {
|
||||||
this.log(
|
this.log(
|
||||||
@ -192,6 +214,7 @@ class EphemeralAgentHandler extends AgentHandler {
|
|||||||
AgentPlugins.docSummarizer.name,
|
AgentPlugins.docSummarizer.name,
|
||||||
AgentPlugins.webScraping.name,
|
AgentPlugins.webScraping.name,
|
||||||
...(await agentSkillsFromSystemSettings()),
|
...(await agentSkillsFromSystemSettings()),
|
||||||
|
...(await ImportedPlugin.activeImportedPlugins()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user