Flowise 集成
Flowise 是一个低代码平台,使用可视化拖放界面构建 LLM 应用。本指南展示两种将 Flowise 连接到 KnowledgePulse 注册表的方法:使用内置的 HTTP Request 节点和创建 Custom Tool 节点。
概述
Flowise 通过 REST API 与 KnowledgePulse 通信。无需安装 SDK——所有交互通过 HTTP 请求完成。
┌──────────────────────────────────────────┐
│ Flowise 流程 │
│ │
│ [输入] → [HTTP Request] → [LLM Chain] │
│ │ │
│ ▼ │
│ KP Registry API │
│ GET /v1/knowledge │
│ POST /v1/knowledge │
│ GET /v1/skills │
│ │
└──────────────────────────────────────────┘
前置条件
- 已安装并运行的 Flowise
- 运行中的 KnowledgePulse 注册表:
bun run registry/src/index.ts
API 端点
| 端点 | 方法 | 描述 |
|---|---|---|
/v1/knowledge | GET | 搜索知识单元 |
/v1/knowledge | POST | 贡献知识单元 |
/v1/knowledge/:id | GET | 通过 ID 获取知识单元 |
/v1/skills | GET | 搜索/列出技能 |
/v1/skills | POST | 注册新技能 |
/v1/skills/:id | GET | 通过 ID 获取技能 |
常用查询参数
| 参数 | 类型 | 描述 |
|---|---|---|
q | string | 自由文本搜索查询 |
domain | string | 按领域筛选(例如 financial_analysis) |
tags | string | 逗号分隔的标签筛选(仅技能) |
min_quality | number | 最低质量分数(0--1) |
limit | number | 最大结果数(默认 20) |
offset | number | 分页偏移量(默认 0) |
方法一:HTTP Request 节点
最简单的方法,使用 Flowise 内置的 HTTP Request 节点。
搜索知识单元
- 在流程中添加 HTTP Request 节点。
- 配置:
- Method:
GET - URL:
http://localhost:3000/v1/knowledge - Query Parameters:
q={{input}}(连接自用户的问题)limit=5min_quality=0.8
- Headers:
Content-Type:application/jsonAuthorization:Bearer <your-api-key>(如果启用了认证)
- Method:
- 将输出连接到 Text Splitter 或直接连接到 LLM 链。
搜索技能
- 添加另一个 HTTP Request 节点。
- 配置:
- Method:
GET - URL:
http://localhost:3000/v1/skills - Query Parameters:
q={{input}}tags=python,automation(可选)
- Method:
贡献知识
- 在流程末尾添加 HTTP Request 节点。
- 配置:
- Method:
POST - URL:
http://localhost:3000/v1/knowledge - Headers:
Content-Type:application/jsonAuthorization:Bearer <your-api-key>
- Body (JSON):
{
"@context": "https://openknowledgepulse.org/schema/v1",
"@type": "ReasoningTrace",
"id": "kp:trace:flowise-{{timestamp}}",
"metadata": {
"created_at": "{{timestamp}}",
"task_domain": "general",
"success": true,
"quality_score": 0.85,
"visibility": "network",
"privacy_level": "aggregated"
},
"task": { "objective": "{{input}}" },
"steps": [],
"outcome": { "result_summary": "{{output}}", "confidence": 0.8 }
}
- Method:
方法二:Custom Tool 节点
要实现更紧密的集成,可以创建封装 API 逻辑的 Custom Tool 节点。