|
|
graph LR
A[DataFlow] --> B[MySQL 8.0]
A --> C[PostgreSQL 15]
A --> D[SQLite 3]
style A fill:#00f2fe,stroke:#764ba2,stroke-width:3px,color:#fff
style B fill:#43e97b,stroke:#38f9d7,stroke-width:2px
style C fill:#f093fb,stroke:#f5576c,stroke-width:2px
style D fill:#667eea,stroke:#764ba2,stroke-width:2px
-- 用户输入(自然语言)
"销售额最高的前 5 个产品是什么?"
-- AI 自动生成 SQL
SELECT
p.name,
SUM(oi.quantity * oi.unit_price) as total_sales
FROM products p
JOIN order_items oi ON p.id = oi.product_id
GROUP BY p.id, p.name
ORDER BY total_sales DESC
LIMIT 5;
-- AI 解释结果(自然语言)
"销售额最高的前 5 个产品是:
1. iPhone 15 Pro - ¥159,980
2. MacBook Pro - ¥129,990
3. iPad Air - ¥95,980
..."|
深色主题 深蓝/紫色渐变背景 |
玻璃态射 Glassmorphism 效果 |
动态背景 神经网络脉冲动画 |
霓虹配色 青色/品红色高光 |
# 1. 克隆项目
git clone https://github.com/yourusername/dataflow.git
cd dataflow
# 2. 配置环境变量
cp .env.docker .env
nano .env # 配置 LLM API Key
# 3. 一键启动
docker-compose up -d
# 4. 访问应用
# 前端: http://localhost
# API: http://localhost/api/docs# 1. 安装依赖
pip install -r requirements.txt
# 2. 配置环境
cp .env.example .env
nano .env # 配置 LLM API Key 和数据库
# 3. 创建演示数据库(可选)
python examples/setup_demo_db.py
# 4. 启动后端
python api_server.py
# 5. 打开前端
# 浏览器访问: frontend/index.html# .env 文件
LLM_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-your-api-key-here
DB_TYPE=sqlite
DB_PATH=./demo.db
|
|
graph TB
subgraph "前端层"
A[精美 Web 界面<br/>未来主义设计]
end
subgraph "应用层"
B[FastAPI 服务器<br/>RESTful API]
end
subgraph "代理层"
C[LangGraph Agent<br/>智能推理]
D[工具集<br/>5 个自定义工具]
end
subgraph "LLM 层"
E1[DeepSeek]
E2[硅基流动]
E3[智谱 AI]
E4[其他 5 种]
end
subgraph "数据层"
F1[MySQL]
F2[PostgreSQL]
F3[SQLite]
end
A --> B
B --> C
C --> D
C --> E1 & E2 & E3 & E4
D --> F1 & F2 & F3
style A fill:#00f2fe,stroke:#764ba2,stroke-width:3px,color:#000
style C fill:#43e97b,stroke:#38f9d7,stroke-width:2px,color:#000
style E1 fill:#f5576c,stroke:#f093fb,stroke-width:2px,color:#fff
services:
dataflow-frontend: # Nginx (端口 80)
dataflow-backend: # FastAPI (端口 8000)
dataflow-mysql: # MySQL 8.0 (端口 3306)
dataflow-postgres: # PostgreSQL 15 (可选)
dataflow-redis: # Redis 7 (可选)docker-compose up -d# 检查所有服务状态
docker-compose ps
# 查看日志
docker-compose logs -f
# 健康检查
curl http://localhost/api/health|
简单查询: < 2秒 复杂查询: < 5秒 多表关联: < 8秒 |
单实例: ~100 QPS 负载均衡: 可扩展 缓存加速: 支持 Redis |
1K 查询: ~¥0.5 10K 查询: ~¥5 100K 查询: ~¥50 |
基于 DeepSeek 模型估算
- ✅ SQL 注入防护 - 参数化查询,安全验证
- ✅ 只读查询限制 - 默认禁止写操作
- ✅ 结果数量限制 - 防止大量数据泄露
- ✅ 查询超时控制 - 避免长时间占用资源
- ✅ 配置加密存储 - 敏感信息加密保存
- ✅ 访问日志记录 - 完整的审计追踪
"有多少个客户?"
"显示所有产品的价格"
"列出最近 10 个订单"
"每个类别有多少个产品?"
"订单的平均金额是多少?"
"销售额最高的前 10 个客户"
"找出购买金额超过 10000 元的客户及其订单数"
"显示每个产品的总销售数量,按销量降序排列"
"列出过去 30 天内没有购买记录的客户"
"显示每个客户的订单总额和订单数量"
"哪些客户购买了 iPhone?"
"列出包含特定产品的所有订单详情"
|
|
- 支持 8 种 LLM 提供商
- 精美的前端界面
- Docker 一键部署
- 配置持久化到数据库
- 完整的文档体系
- 用户认证和权限管理
- 查询历史和收藏
- 数据可视化图表
- 移动端适配
- 支持更多数据库(MongoDB、ClickHouse)
- AI 数据分析报告生成
- 多语言支持
- 插件系统
欢迎贡献!请查看 贡献指南
本项目采用 MIT 许可证
- LangChain - LLM 应用框架
- LangGraph - 代理编排
- FastAPI - Web 框架
- SQLAlchemy - ORM 框架
- 📧 Email: your-email@example.com
- 💬 微信: your-wechat
- 🐦 Twitter: @yourtwitter
- 🌐 网站: https://your-website.com