add AgentFlow execution via API chat invocation (#3545)
* add AgentFlow execution via API chat invocation * reorder import
This commit is contained in:
parent
78c83383d8
commit
4d06884a36
@ -1,6 +1,7 @@
|
||||
const AIbitat = require("./aibitat");
|
||||
const AgentPlugins = require("./aibitat/plugins");
|
||||
const ImportedPlugin = require("./imported");
|
||||
const { AgentFlows } = require("../agentFlows");
|
||||
const { httpSocket } = require("./aibitat/plugins/http-socket.js");
|
||||
const { WorkspaceChats } = require("../../models/workspaceChats");
|
||||
const { safeJsonParse } = require("../http");
|
||||
@ -220,6 +221,24 @@ class EphemeralAgentHandler extends AgentHandler {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Load flow plugin. This is marked by `@@flow_` in the array of functions to load.
|
||||
if (name.startsWith("@@flow_")) {
|
||||
const uuid = name.replace("@@flow_", "");
|
||||
const plugin = AgentFlows.loadFlowPlugin(uuid, this.aibitat);
|
||||
if (!plugin) {
|
||||
this.log(
|
||||
`Flow ${uuid} not found in flows directory. Skipping inclusion to agent cluster.`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.aibitat.use(plugin.plugin());
|
||||
this.log(
|
||||
`Attached flow ${plugin.name} (${plugin.flowName}) plugin to Agent cluster`
|
||||
);
|
||||
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("@@")) {
|
||||
@ -269,11 +288,9 @@ class EphemeralAgentHandler extends AgentHandler {
|
||||
);
|
||||
|
||||
this.#funcsToLoad = [
|
||||
AgentPlugins.memory.name,
|
||||
AgentPlugins.docSummarizer.name,
|
||||
AgentPlugins.webScraping.name,
|
||||
...(await agentSkillsFromSystemSettings()),
|
||||
...(await ImportedPlugin.activeImportedPlugins()),
|
||||
...ImportedPlugin.activeImportedPlugins(),
|
||||
...AgentFlows.activeFlowPlugins(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user