LocalFlow localflow-app
winget install --id=localflow-app.LocalFlow -e LocalFlow is a visual workflow editor and runner with node-based editing, environment management, and reusable workflow components.
winget install --id=localflow-app.LocalFlow -e LocalFlow is a visual workflow editor and runner with node-based editing, environment management, and reusable workflow components.
一个现代化的基于 Python 的可视化工作流管理工具,采用 PySide6 构建,提供直观的拖拽式节点编辑体验、智能的 UV 虚拟环境管理、灵活的多标签页工作流支持、AI 辅助功能、定时任务调度、以及强大的节点扩展能力。
# 克隆项目仓库
git clone
cd localflow
# 安装依赖(推荐使用 UV)
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -r requirements.txt
# 启动应用
python main.py
# 使用 Python 构建脚本
python build.py
# 或使用批处理脚本 (Windows)
build.bat
# 或使用 Shell 脚本 (Linux/Mac)
./build.sh
构建完成后,可执行文件位于 dist/LocalFlow/ 目录。
目录版本(推荐,符合 PySide6 LGPL 要求):
cd dist/LocalFlow
./LocalFlow # Linux/Mac
LocalFlow.exe # Windows
便携版本:
cd dist/LocalFlow_Portable
./Start_LocalFlow.bat # Windows
./start_localflow.sh # Linux/Mac
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 创建并激活虚拟环境
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 安装依赖(UV 提供更快的安装速度)
uv pip install -r requirements.txt
# 检查 PySide6 安装
python -c "import PySide6; print(f'PySide6 {PySide6.__version__} installed successfully')"
# 检查 UV 安装
uv --version
git clone
cd localflow
# 使用 pip
pip install -r requirements.txt
# 或使用 uv (推荐)
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -r requirements.txt
python main.py # 启动 GUI
python main.py --help # 查看 CLI 帮助
python main.py run # 命令行执行工作流
LocalFlow 提供完整的命令行接口(CLI),无需启动 GUI 即可完成工作流执行、定时调度、环境管理等操作。基于 Typer + Rich 构建。
# 方式一:通过 pip 安装后直接使用
localflow [命令] [选项]
# 方式二:从源码运行
python main.py [命令] [选项]
无参数时自动启动 GUI 模式(python main.py),或显示 CLI 帮助(localflow)。
main.py
├── run 执行工作流
├── schedule 定时任务管理
│ ├── list 列出所有任务
│ ├── add --cron ... 添加定时任务
│ ├── remove 删除任务
│ ├── run 立即执行
│ ├── status 查看调度器状态
│ └── daemon 启动守护进程
├── env 虚拟环境管理
│ ├── list 列出所有环境
│ ├── create 创建环境
│ └── remove 删除环境
├── node 节点管理
│ ├── list 列出所有节点
│ └── info 查看节点详情
├── config 配置管理
│ ├── show 显示配置
│ └── set 设置配置项
├── workflow 工作流管理
│ ├── list 列出已保存的工作流
│ ├── validate 验证工作流格式
│ └── describe 显示工作流详情
└── serve 启动 API 服务(实验性)
执行工作流:
python main.py run workflows/my_workflow/workflow.json
python main.py run workflow.json --input '{"key": "value"}' --verbose
python main.py run workflow.json --args name=alice count=42 --output result.json
管理定时任务:
python main.py schedule add workflow.json --cron "0 9 * * 1-5" --name "工作日执行"
python main.py schedule list
python main.py schedule remove abc12345
python main.py schedule daemon --pidfile /tmp/scheduler.pid --logfile scheduler.log
管理虚拟环境:
python main.py env list
python main.py env create my_env --python 3.12
python main.py env remove my_env
工作流操作:
python main.py workflow validate workflow.json
python main.py workflow describe workflow.json
配置管理:
python main.py config show
python main.py config set theme dark
python main.py config set node_timeout_seconds 300
启动 API 服务:
python main.py serve --port 5000
# → http://127.0.0.1:5000/docs (Swagger 接口文档)
Shell 自动补全:
python main.py --install-completion
# 或
localflow --install-completion
CLI 和 GUI 共享同一套核心模块(src/core/):
run 命令执行本项目提供完整的文档体系:
LocalFlow 内置 AI 聊天功能,支持自然语言与工作流交互:
配置方法:设置 → AI 配置 → 填写 API 地址、密钥和模型名称
设置工作流自动执行:
0 9 * * 1-5 工作日9点执行)创建专属节点:
自定义界面外观:
扩展节点库:
LocalFlow/
├── src/ # 源代码
│ ├── core/ # 核心逻辑层(CLI 和 GUI 共享)
│ │ ├── node_base.py # 节点基类定义
│ │ ├── node_registry.py # 节点注册表
│ │ ├── uv_manager.py # UV 虚拟环境管理
│ │ ├── workflow_executor.py # 工作流执行引擎
│ │ ├── workflow_scanner.py # 工作流扫描器
│ │ ├── workflow_runner.py # 工作流运行器
│ │ ├── config_manager.py # 配置管理器
│ │ ├── cron_utils.py # Cron 表达式工具(无 PySide6 依赖)
│ │ ├── headless_scheduler.py# 无头调度器(CLI 用)
│ │ ├── scheduler_manager.py # 定时任务管理器(GUI 用)
│ │ ├── theme_manager.py # 主题管理器
│ │ ├── ai_chat_service.py # AI 聊天服务
│ │ ├── ai_node_generator.py # AI 节点生成服务
│ │ ├── ai_chat_context.py # AI 对话上下文构建
│ │ ├── custom_node_manager.py # 自定义节点管理器
│ │ ├── node_repo_manager.py # 节点仓库管理器
│ │ ├── credential_store.py # 凭据存储(GitHub OAuth等)
│ │ ├── code_safety.py # 代码安全审查
│ │ ├── playwright_node_utils.py # Playwright 节点工具
│ │ └── providers/ # 外部节点提供者
│ │ └── github_provider.py # GitHub 节点提供者
│ ├── cli.py # CLI 入口(Typer 命令树)
│ ├── dialogs/ # 对话框组件
│ │ ├── settings_dialog.py # 设置对话框
│ │ ├── add_node_dialog.py # 添加节点对话框
│ │ ├── source_code_dialog.py # 源代码编辑对话框
│ │ └── playwright_script_dialog.py # Playwright 脚本对话框
│ ├── views/ # 视图组件
│ │ ├── main_window.py # 主窗口(已迁移到 src/main_window.py)
│ │ ├── workflow_canvas.py # 工作流画布
│ │ ├── workflow_tab_widget.py # 标签页组件
│ │ ├── node_graphics.py # 节点图形
│ │ ├── node_browser.py # 节点浏览器
│ │ ├── node_properties.py # 节点属性面板
│ │ ├── execution_results_widget.py # 执行结果面板
│ │ ├── ai_chat_widget.py # AI 聊天面板
│ │ ├── overview_widget.py # 总览面板(含定时任务管理)
│ │ └── toast_widget.py # Toast 气泡提示
│ └── main_window.py # 主窗口
├── test/ # 测试套件
│ ├── unit/ # 单元测试
│ ├── integration/ # 集成测试
│ ├── ui/ # UI 测试
│ └── run_tests.py # 测试运行器
├── docs/ # 文档
│ ├── user-guide/ # 用户指南
│ ├── development/ # 开发文档
│ └── architecture/ # 架构文档
├── assets/ # 资源文件
│ ├── icons/ # 图标资源
│ └── localflow.ico # 应用图标
├── workflows/ # 工作流数据存储
│ ├── example_basic_calc/ # 示例:基础计算
│ ├── IntegrationFlow/ # 示例:集成工作流
│ └── test_opt_workflow/ # 测试工作流
├── examples/ # 示例代码
├── user_data/ # 用户数据(配置、节点、历史等)
├── config.json # 应用配置文件
├── requirements.txt # Python 依赖
├── build.py # 构建脚本
├── auto_build.py # 自动构建脚本
├── LocalFlow.spec # PyInstaller 配置
├── main.py # 应用入口
├── LICENSE # Apache 2.0 许可证
└── README.md # 本文档
# 运行所有测试
python test/run_tests.py
# 运行特定类型测试
python test/run_tests.py unit # 单元测试
python test/run_tests.py integration # 集成测试
python test/run_tests.py ui # UI 测试
# 使用测试运行脚本 (Windows)
run_tests.bat
详细测试说明请查看 测试文档。
LocalFlow 提供灵活的 UV 配置选项:
图形界面方式:
设置 对话框(菜单:工具 → 设置)UV 包管理工具 选项卡~/.uv/uv.toml配置文件方式:
# ~/.uv/uv.toml
index-url = "https://pypi.tuna.tsinghua.edu.cn/simple"
应用配置文件 config.json 存储:
示例配置:
{
"dock_states": {
"node_browser": {
"visible": true,
"width": 300
},
"node_properties": {
"visible": true,
"width": 300
}
},
"window_geometry": {
"x": 0,
"y": 23,
"width": 1707,
"height": 889
}
}
工作流数据存储在 workflows/ 目录下:
.venv 虚拟环境# 克隆仓库
git clone
cd localflow
# 创建开发环境
uv venv --python 3.11
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 安装开发依赖
uv pip install -r requirements.txt
uv pip install pytest pytest-qt # 测试依赖
# 安装 pre-commit 钩子(如果有)
pre-commit install
NodeBase 类实现节点逻辑node_registry.py 中注册节点assets/icons/示例:
from src.core.node_base import NodeBase, NodeType
class MyCustomNode(NodeBase):
def __init__(self, node_id):
super().__init__(node_id, "My Custom Node", NodeType.PROCESSOR)
self.add_input_port("input_data")
self.add_output_port("output_data")
def execute(self):
# 节点执行逻辑
input_data = self.get_input("input_data")
output_data = self.process(input_data)
self.set_output("output_data", output_data)
详细开发指南请查看 开发文档。
我们欢迎所有形式的贡献!
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)详细贡献指南请查看 开发文档。
本项目采用 Apache License 2.0 开源许可证。
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
如遇到问题,请通过以下方式反馈:
提交 Issue 时,请包含:
⭐ 如果这个项目对你有帮助,请给我们一个 Star!
Made with ❤️ by LocalFlow Contributors