LLM工作流平台
一个强大的平台,将对话式人工智能与可视化工作流自动化相结合,实现了LLM聊天界面和可定制工具执行流程之间的无缝集成。
概述
该项目提供了一个统一的环境,用户可以在其中:
- 与大型语言模型(LLMs)自然聊天
- 使用可视化流编辑器设计复杂的工作流
- 创建和共享自定义MCP(模型上下文协议)工具
- 使LLM能够根据对话上下文智能触发工作流操作
主要特点
🤖 LLM聊天界面
- 简洁、直观的聊天界面,用于与各种LLM进行交互
- 实时流媒体响应
- 对话历史管理
- 多型号支持
- 上下文感知交互
🔄 可视化流编辑器
- 拖放工作流设计器
- 基于节点的建筑自动化流程架构
- 工作流步骤之间的视觉连接
- 实时流执行预览
- 条件逻辑和分支支持
- 错误处理和重试机制
🛠️ MCP工具系统
- 自定义工具创建:使用简单的界面构建自己的工具
- 社区工具:浏览和集成社区创建的工具
- 工具市场:与其他用户共享您的工具
- 版本控制:跟踪工具版本和更新
- 工具类别:按功能组织工具(数据处理、API调用、通知等)
🔗 LLM工作流集成
- LLM可以在对话过程中自动触发工作流工具
- 基于用户意图的智能工具选择
- 聊天和工作流之间的无缝数据流
- 聊天界面实时执行反馈
- 从自然语言中提取参数
建筑
┌─────────────────────────────────────────────────────────┐
│ Frontend Layer │
│ ┌──────────────────┐ ┌──────────────────────┐ │
│ │ Chat Interface │ │ Flow Editor │ │
│ │ - Message UI │ │ - Canvas │ │
│ │ - Input Box │ │ - Node Library │ │
│ │ - History │ │ - Connection Lines │ │
│ └──────────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ API Gateway Layer │
│ - Request Routing │
│ - Authentication & Authorization │
│ - Rate Limiting │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Core Services │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │LLM Connector │ │Flow Engine │ │Tool Manager │ │
│ │- Model APIs │ │- Execution │ │- Registry │ │
│ │- Streaming │ │- Scheduling │ │- Validation │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Data Layer │
│ - User Data │
│ - Conversation History │
│ - Workflow Definitions │
│ - Tool Catalog │
│ - Execution Logs │
└─────────────────────────────────────────────────────────┘用例
数据处理工作流
创建处理来自各种来源的数据的工作流,LLM帮助用户通过自然对话定义转换逻辑。
API集成自动化
构建聊天中由用户请求触发的API调用链,LLM理解上下文和参数。
内容生成管道
设计多步骤内容创建工作流,让LLM跨平台生成、改进和发布内容。
监控和警报
设置智能监控系统,LLM在检测到模式时分析数据并触发通知工作流。
自定义业务逻辑
实施复杂的业务流程,决策点由LLM处理,执行由工作流管理。
MCP工具结构
工具遵循模型上下文协议规范:
{
"name": "tool_name",
"description": "What the tool does",
"version": "1.0.0",
"author": "creator_name",
"parameters": {
"param1": {
"type": "string",
"description": "Parameter description",
"required": true
}
},
"execution": {
"type": "workflow" | "function" | "api",
"config": {}
}
}入门指南
先决条件
- Node.js 18+
- Docker(可选,用于容器化部署)
- 数据库(推荐使用PostgreSQL)
- LLM API密钥(OpenAI、Anthropic等,BYOK模型)
安装
# Clone the repository
git clone https://github.com/phantomthor/clubetr.git
# Navigate to project directory
cd clubetr
# Install dependencies
npm install
# or
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Initialize database
npm run db:migrate
# or
python manage.py migrate
# Start the development server
npm run dev
# or
python manage.py runserver配置
编辑 .env 文件:
# LLM Configuration
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/llm_workflow
# Server
PORT=3000
NODE_ENV=development
# Tool Registry
TOOL_REGISTRY_URL=https://tools.example.com创建你的第一个工具
步骤1:定义工具元数据
// tools/my_custom_tool.js
export const toolDefinition = {
name: "data_transformer",
description: "Transforms data from one format to another",
version: "1.0.0",
category: "data_processing",
parameters: {
input_data: {
type: "object",
description: "Data to transform"
},
output_format: {
type: "string",
enum: ["json", "csv", "xml"],
description: "Desired output format"
}
}
};步骤2:实施工具逻辑
export async function execute(params) {
const { input_data, output_format } = params;
// Your transformation logic here
const result = transformData(input_data, output_format);
return {
success: true,
data: result
};
}步骤3:注册工具
import { ToolRegistry } from './core/tool_registry';
ToolRegistry.register(toolDefinition, execute);创建工作流
可视化编辑器方法
- 打开流编辑器
- 将节点从工具库拖动到画布上
- 通过在输出和输入端口之间绘制线条来连接节点
- 配置每个节点的参数
- 测试工作流程
- 保存并激活
代码定义方法
# workflows/example_workflow.yaml
name: Data Processing Pipeline
description: Fetch, transform, and store data
trigger:
type: llm_invoked
intent: "process user data"
steps:
- id: fetch_data
tool: api_caller
params:
url: "${user.data_source}"
method: GET
- id: transform
tool: data_transformer
params:
input_data: "${fetch_data.output}"
output_format: json
depends_on: [fetch_data]
- id: store
tool: database_writer
params:
data: "${transform.output}"
table: user_data
depends_on: [transform]LLM集成
该平台自动为LLM提供工作流工具:
// Example conversation
User: "Can you fetch my sales data and convert it to CSV?"
LLM: "I'll help you with that. Let me process your sales data."
// LLM automatically triggers:
// 1. fetch_data tool with user's data source
// 2. data_transformer tool with CSV output format
LLM: "Done! I've converted your sales data to CSV format.
The file contains 150 records and is ready for download."API 参考
聊天端点
POST /api/chat/message
POST /api/chat/stream
GET /api/chat/history
DELETE /api/chat/conversation/:id工作流端点
POST /api/workflows
GET /api/workflows
GET /api/workflows/:id
PUT /api/workflows/:id
DELETE /api/workflows/:id
POST /api/workflows/:id/execute
GET /api/workflows/:id/logs工具端点
GET /api/tools
GET /api/tools/:id
POST /api/tools
PUT /api/tools/:id
DELETE /api/tools/:id
POST /api/tools/:id/test社区与贡献
共享工具
- 将您的工具发布到社区市场
- 添加详细的文档和示例
- 包括测试用例和验证规则
- 更新的语义版本控制
贡献
欢迎投稿!请遵循以下指南:
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
代码规范
- 遵循项目的ESLint/Pretier配置
- 为新功能编写单元测试
- 更新API变更文档
- 尽可能保持向后兼容性
安全
- 所有API密钥都在静止时加密
- 工具执行发生在沙盒环境中
- 所有端点的速率限制
- 输入验证和净化
- 定期安全审计
- OAuth 2.0身份验证支持
演出
- 工作流执行并行化
- 常用工具的缓存层
- 数据库操作的连接池
- 工作流节点的延迟加载
- 优化LLM令牌使用
路线图
- \[\]工具开发的多语言支持
- \[\]工作流的可视化调试工具
- \[\]高级分析仪表板
- \[\]工作流模板市场
- \[\]适用于iOS和Android的移动应用程序
- \[\]实时协作功能
- \[\]与流行服务(Slack、Discord等)集成
- \[\]基于人工智能的工作流优化建议
- \[\]自定义LLM模型微调支持
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
支持
- 文档: https://docs.example.com
- 问题:
- 讨论:
- 电子邮件:support@example.com
致谢
特别感谢所有贡献者和开源社区使这个项目成为可能。
______________________________________________________________________
内置❤️ 由社区
