
在 Activepieces 中集成 Flowise 无代码 AI 工作流Piece 认证、预测动作与构建指南【免费下载链接】activepiecesAI Agents MCPs AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows AI Agents • MCPs for AI Agents项目地址: https://gitcode.com/GitHub_Trending/ac/activepieces本文围绕 Activepieces 官方社区 Flowise PieceREADME 与 src/index.ts展开讲解如何在 Activepieces 流程与 AI Agent 中调用 Flowise 上已部署的 Chatflow聊天流 / RAG / Agent 工作流完成推理预测。读完本文你将掌握 Flowise Piece 的认证配置、Make Prediction动作的参数与请求格式、Custom API Call 的底层机制以及该 Piece 的本地构建与多语言资源组织方式。一、Flowise Piece 是什么Flowise 是一款无代码 AI 工作流构建器用户可以拖拽编排 LLM、向量数据库、检索器等节点生成并部署一个对外提供推理能力的 Chatflow。Activepieces 中的 Flowise Piece 正是这座桥它把 Flowise 部署好的 Chatflow 封装成 Activepieces 的 Action让自动化流程或 AI Agent 能直接向/api/v1/prediction/{chatflow_id}发送问题并拿回模型输出。从 src/index.ts 的 Piece 元数据可以看出它的定位export const flowise createPiece({ displayName: Flowise, description: No-Code AI workflow builder, logoUrl: https://cdn.activepieces.com/pieces/flowise.png, auth: flowiseAuth, minimumSupportedRelease: 0.30.0, categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE], authors: [aasimsanim,kishanprmr,MoShizzle,abuaboud], actions: [flowisePredict, createCustomApiCallAction({ ... })], triggers: [], });关键信息分类PieceCategory.ARTIFICIAL_INTELLIGENCE在动作面板的 AI 分类下展示版本兼容minimumSupportedRelease: 0.30.0要求 Activepieces 运行时不低于 0.30.0 版本能力边界只提供 ActionsflowisePredict 通用Custom API Call无触发器triggers: []——它只能被流程主动调用不会主动向 Activepieces 推送事件认证flowiseAuth自定义认证统一管理 Flowise 实例地址与 API Key。createPiece的实现位于 packages/pieces/framework/src/lib/piece.ts它会将 actions 按名称注册到内部 Map并在metadata()中输出displayName、actions、triggers、categories、auth、minimumSupportedRelease等完整元数据供 Activepieces 平台加载与展示。二、认证配置Flowise URL 与 API KeyFlowise Piece 使用PieceAuth.CustomAuth定义认证见 src/index.tsconst flowiseAuth PieceAuth.CustomAuth({ description: Enter your Flowise URL and API Key, props: { base_url: Property.ShortText({ displayName: Base URL, description: Enter the base URL, required: true, }), access_token: PieceAuth.SecretText({ displayName: API Key, description: Enter the API Key, required: true, }), }, required: true, });配置项说明字段类型必填含义base_urlProperty.ShortText是Flowise 实例的根地址例如自托管部署的http://localhost:3000或云端域名access_tokenPieceAuth.SecretText是Flowise 的 API Key用于Authorization: Bearer key请求头其中access_token使用SecretText类型属于敏感凭据字段在界面上以密文形式输入与存储CustomAuth框架类型定义在 custom-auth-prop.ts 中其 props 支持ShortText、LongText、Number、Checkbox、StaticDropdown、SecretText等组合Flowise 正好用了最常见的地址 密钥组合。认证提示一个 Activepieces Connection 对应一个 Flowise 实例。若你有多套 Flowise 环境开发/生产可分别建立 Connection在流程中按需选择。三、核心动作Make PredictionflowisePredict是 Flowise Piece 的主动作动作名make_prediction显示名 Make Prediction负责向指定 Chatflow 发送问题并返回预测结果见 src/index.ts。3.1 输入参数props: { chatflow_id: Property.ShortText({ displayName: Chatflow ID, required: true }), input: Property.ShortText({ displayName: Input/Question, required: true }), history: Property.Json({ displayName: History, required: false }), overrideConfig: Property.Json({ displayName: Override Config, required: false }), }参数类型必填作用chatflow_id短文本是目标 Chatflow 的唯一标识在 Flowise 的 Chatflow 页面 URL/API 面板中可见input短文本是发送给 Chatflow 的问题/输入historyJSON否可选的会话历史用于多轮对话上下文overrideConfigJSON否运行时覆盖配置可临时覆盖 Chatflow 内的节点配置如切换模型参数、修改 Prompt 等3.2 底层请求逻辑run函数的实现直接印证了调用链src/index.tsconst url ${base_url}/api/v1/prediction/${chatflow_id}; const headers { Content-Type: application/json, Authorization: Bearer ${access_token}, }; const body { question: input, history: ctx.propsValue[history], overrideConfig: ctx.propsValue[overrideConfig], }; const response await fetch(url, { method: POST, headers, body: JSON.stringify(body), }); const data await response.json(); return data;要点端点POST {base_url}/api/v1/prediction/{chatflow_id}与源码注释中的/api/v1/prediction/{your-chatflowid}一致请求体question携带问题文本history与overrideConfig仅在配置了对应 props 时随请求体透传认证方式BearerToken 头返回值直接返回 Flowise 的完整 JSON 响应包含模型生成的文本、所用 Chatflow 信息等Activepieces 不会做二次解析下游步骤可通过变量引用其中的字段。3.3 AI Agent 语义元数据源码中还为该动作声明了aiMetadatasrc/index.tsaiMetadata: { description: Sends a question/input to a specific Flowise chatflow by its Chatflow ID and returns the prediction, optionally passing prior conversation history and runtime override config..., idempotent: false, }这告诉 AI Agent调用前需要明确的 Chatflow ID由于每次调用都会生成一次全新的模型响应该动作不是幂等的。对于把 Flowise Chatflow 作为 Agent 工具的开发者来说这段元数据会被 Agent 用于理解何时调用、需要准备哪些参数。四、附加能力Custom API Call除了专用的Make PredictionFlowise Piece 还通过createCustomApiCallAction暴露了一个通用 HTTP 动作覆盖 Flowise 其余 API 端点src/index.tscreateCustomApiCallAction({ baseUrl: (auth) (auth?.props.base_url ?? ), auth: flowiseAuth, authMapping: async (auth) ({ Authorization: Bearer ${auth.props.access_token}, }), })其底层实现在 packages/pieces/common/src/lib/helpers/index.ts动态 URLbaseUrl由认证连接中的base_url计算得出URL 支持绝对地址或相对路径自动注入认证authMapping生成的Authorization: Bearer access_token会被自动附加到请求头无需手动填写通用参数MethodGET/POST/PUT/PATCH/DELETE/HEAD 等、Headers、Query Parameters、Body TypeJSON / Form Data / Raw / None、Body、Timeout (in seconds)、Follow redirects、Response is Binary、No Error on Failure等用途可用于调用 Flowise 的其他管理类接口例如查询 Chatflow 列表、上传向量数据等作为Make Prediction的补充。需要说明Make Prediction动作的 audience 为both同时面向人类流程与 Agent而createCustomApiCallAction生成的动作为human面向默认分类为WRITE这一点在编排 AI Agent 工具选择时需要注意。五、多语言资源Flowise Piece 内置了完整的 i18n 文案资源位于 src/i18n 目录包含de、es、fr、ja、nl、pt、ru、vi、zh以及默认translation.json共 10 份语言文件。以 zh.json 为例它为 Base URL、API Key、Make Prediction、Custom API Call、Chatflow ID、History、Override Config 以及 Custom API Call 的 Method、Body Type、Timeout 等 UI 文案提供了本地化映射。因此不同语言环境下的用户界面会呈现对应的本地化标签而动作名称make_prediction与接口行为保持一致。六、构建与发布根据 Piece 的 README构建该库的唯一必需命令是turbo run build --filteractivepieces/piece-flowise该命令利用 Turborepo 按包名activepieces/piece-flowise过滤并构建。结合 package.json 中的脚本可以进一步了解完整工具链{ name: activepieces/piece-flowise, version: 0.1.7, scripts: { build: tsc -p tsconfig.lib.json cp package.json dist/, bundle: node ../../../../dist/packages/cli/src/index.js pieces bundle, lint: eslint src/**/*.ts }, dependencies: { activepieces/pieces-common: workspace:*, activepieces/pieces-framework: workspace:*, activepieces/core-piece-types: workspace:*, activepieces/core-utils: workspace:* } }build先用tsc按tsconfig.lib.json编译 TypeScript 源码到dist/再把package.json复制进产物目录bundle调用 Activepieces CLI 的pieces bundle命令打包该 Piece 的产物与资源供平台分发给安装方lint对src/**/*.ts执行 ESLint 检查依赖均以 workspace 形式引用pieces-common、pieces-framework、core-piece-types、core-utils等仓库内包保证与当前 Activepieces 主版本 API 对齐。在仓库中构建该 Piece 时先确保根目录依赖已安装仓库使用 bun turbo 工作区再执行上述turbo run build --filteractivepieces/piece-flowise即可得到dist/产物。Piece 的版本号当前 0.1.7由package.json维护升级行为与构建打包在发布流程中由仓库的发布脚本统一处理。七、典型应用场景把 Flowise Piece 放进 Activepieces 流程或 Agent 工具集中常见的组合方式包括RAG 问答自动化当收到新消息Webhook / 邮件 / 表单触发时把消息内容作为input传给已部署的 Flowise RAG Chatflow再把返回的答案写回 Slack、发邮件或入库AI Agent 的领域工具将Make Prediction注册为 Agent 工具让 Agent 在需要领域推理如内部知识库问答时调用 Flowise Chatflowhistory支持携带对话上下文overrideConfig可临时切换模型或 Prompt多轮对话把上一轮history透传给 Chatflow实现有记忆的连续会话history采用 JSON 结构由上游步骤的变量填充。需要留意Make Prediction每次调用都会触发一次真实模型推理产生新的响应非幂等在编排重试或批处理任务时需考虑调用成本与频次所有请求均以BearerToken 认证API Key 通过 Activepieces 的连接Connection机制加密保存不应以明文形式出现在流程变量中。结语Flowise Piece 是 Activepieces AI 生态中连接无代码工作流构建器与自动化编排平台的典型实现通过CustomAuth统一管理实例地址与密钥通过Make Prediction动作封装/api/v1/prediction/{chatflow_id}推理接口并用Custom API Call保留对 Flowise 全量 API 的访问能力。其源码结构清晰认证定义、动作实现、Piece 注册、i18n 资源分层是阅读与二次开发 Activepieces 社区 Piece 的良好范本。【免费下载链接】activepiecesAI Agents MCPs AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows AI Agents • MCPs for AI Agents项目地址: https://gitcode.com/GitHub_Trending/ac/activepieces创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考