θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions server/utils/agentFlows/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ const { FlowExecutor } = require("./executor");
const { normalizePath } = require("../files");
const { safeJsonParse } = require("../http");

/**
* @typedef {Object} LoadedFlow
* @property {string} name - The name of the flow
* @property {string} uuid - The UUID of the flow
* @property {Object} config - The flow configuration details
* @property {string} config.description - The description of the flow
* @property {Array<{type: string, config: Object, [key: string]: any}>} config.steps - The steps of the flow. Each step has at least a type and config
*/

class AgentFlows {
static flowsDir = process.env.STORAGE_DIR
? path.join(process.env.STORAGE_DIR, "plugins", "agent-flows")
Expand Down Expand Up @@ -55,7 +64,7 @@ class AgentFlows {
/**
* Load a flow configuration by UUID
* @param {string} uuid - The UUID of the flow to load
* @returns {Object|null} Flow configuration or null if not found
* @returns {LoadedFlow|null} Flow configuration or null if not found
*/
static loadFlow(uuid) {
try {
Expand Down Expand Up @@ -179,11 +188,13 @@ class AgentFlows {
description: `Execute agent flow: ${flow.name}`,
plugin: (_runtimeArgs = {}) => ({
name: `flow_${uuid}`,
description: flow.description || `Execute agent flow: ${flow.name}`,
description:
flow.config.description || `Execute agent flow: ${flow.name}`,
setup: (aibitat) => {
aibitat.function({
name: `flow_${uuid}`,
description: flow.description || `Execute agent flow: ${flow.name}`,
description:
flow.config.description || `Execute agent flow: ${flow.name}`,
parameters: {
type: "object",
properties: variables.reduce((acc, v) => {
Expand Down