Jflow - AI Agent工作流平台
项目简介
Jflow 是一个现代化的AI Agent工作流平台,支持多语言节点执行,提供可视化的工作流设计界面。
核心特性
- 🤖 AI智能体管理: 创建、编辑、执行智能体
- 🔧 多语言节点: 支持Python、Go、Rust等多种编程语言
- 📊 可视化设计: 拖拽式工作流设计界面
- ⚡ 统一执行: 所有节点使用统一的执行路径
- 🚀 异步性能: 基于FastAPI的高性能后端
技术栈
前端
- Vue 3 - 渐进式前端框架
- TypeScript - 类型安全的JavaScript
- Naive UI - 现代化UI组件库
- Pinia - 轻量级状态管理
- Vite - 快速构建工具
后端
- FastAPI - 现代Python Web框架
- 异步执行 - 支持并发节点执行
- 多语言支持 - Python、Go、Rust节点
快速开始
1. 克隆项目
git clone <repository-url>
cd jflow
2. 安装依赖
# 使用npm脚本安装
npm run install
# 或使用启动脚本
./start.sh install
3. 启动开发环境
# 使用npm脚本启动
npm run dev
# 或使用启动脚本
./start.sh dev
4. 访问应用
- 前端: http://localhost:3000
- 后端API: http://localhost:8000
- API文档: http://localhost:8000/docs
开发命令
统一命令 (推荐)
# 启动开发环境
npm run dev
# 只启动前端
npm run frontend
# 只启动后端
npm run backend
# 安装依赖
npm run install
# 构建项目
npm run build
# 清理项目
npm run clean
# 运行测试
npm run test
# 代码检查
npm run lint
# 代码格式化
npm run format
启动脚本命令
# 启动开发环境
./start.sh dev
# 只启动前端
./start.sh frontend
# 只启动后端
./start.sh backend
# 安装依赖
./start.sh install
# 构建项目
./start.sh build
# 清理项目
./start.sh clean
# 显示帮助
./start.sh help
项目结构
jflow/
├── frontend/ # Vue 3 前端
│ ├── src/
│ │ ├── App.vue
│ │ ├── main.ts
│ │ ├── router/
│ │ ├── stores/
│ │ ├── api/
│ │ ├── components/
│ │ └── views/
│ ├── package.json
│ └── vite.config.ts
├── backend/ # FastAPI 后端
│ ├── app/
│ │ ├── main.py
│ │ ├── routes/
│ │ ├── services/
│ │ ├── models/
│ │ └── utils/
│ ├── nodes/ # 节点实现
│ │ ├── language_python/
│ │ ├── language_go/
│ │ ├── language_rust/
│ │ └── data_processing/
│ ├── config.py
│ ├── requirements.txt
│ └── run.py
├── package.json # 根目录统一管理
├── start.sh # 统一启动脚本
└── README.md
节点开发
创建新节点
- 创建节点目录
mkdir -p backend/nodes/my_new_node
- 实现节点逻辑
# backend/nodes/my_new_node/my_new_node.py
def execute(context=None, inputs=None, config=None):
# 节点执行逻辑
return {
"success": True,
"result": "节点执行成功"
}
- 创建节点配置
# backend/nodes/my_new_node/my_new_node.json
{
"name": "我的新节点",
"description": "节点描述",
"version": "1.0.0",
"category": "custom"
}
- 测试节点
curl -X POST "http://localhost:8000/api/action/nodes.my_new_node.my_new_node.execute" \
-H "Content-Type: application/json" \
-d '{"context": {}, "inputs": {}, "config": {}}'
支持的语言
- Python: 直接导入执行
- Go: 编译后执行
- Rust: 编译后执行
API使用示例
执行Python节点
curl -X POST "http://localhost:8000/api/action/nodes.language_python.language_python.execute" \
-H "Content-Type: application/json" \
-d '{
"context": {"timestamp": "2024-01-01"},
"inputs": {},
"config": {
"code": "print(\"Hello from Python!\")\noutput = \"Python执行成功\""
}
}'
执行Go节点
curl -X POST "http://localhost:8000/api/action/nodes.language_go.language_go.execute" \
-H "Content-Type: application/json" \
-d '{
"context": {"timestamp": "2024-01-01"},
"inputs": {},
"config": {
"code": "package main\nimport \"fmt\"\nfunc main() { fmt.Println(\"Hello from Go!\") }"
}
}'
执行Rust节点
curl -X POST "http://localhost:8000/api/action/nodes.language_rust.language_rust.execute" \
-H "Content-Type: application/json" \
-d '{
"context": {"timestamp": "2024-01-01"},
"inputs": {},
"config": {
"code": "fn main() { println!(\"Hello from Rust!\"); }"
}
}'
环境要求
- Node.js: >= 16.0.0
- Python: >= 3.8
- Go: >= 1.19 (可选,用于Go节点)
- Rust: >= 1.70 (可选,用于Rust节点)
配置说明
环境变量
# 后端配置
export DEBUG=true
export NODE_TIMEOUT=30
export CORS_ORIGINS="http://localhost:3000"
# 前端配置
export VITE_API_BASE_URL=http://localhost:8000
配置文件
- 后端:
backend/config.py - 前端:
frontend/.env
部署
开发环境
npm run dev
生产环境
# 构建前端
npm run build
# 启动后端
npm run start:backend
Docker部署
# 构建镜像
docker build -t jflow .
# 运行容器
docker run -p 3000:3000 -p 8000:8000 jflow
贡献指南
- Fork 项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 打开 Pull Request
许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
联系方式
Description
Languages
Vue
49.2%
Python
33%
JavaScript
6.1%
TypeScript
5.5%
Go
3.1%
Other
3.1%