使用说明
🚀 Gasable Hub-多智能体人工智能平台
带有React仪表板的生产就绪多代理编排系统
🎯 快速开始
一个命令启动
./start.sh
这将同时开始:
- ✅ 端口8000上的后端(FastAPI)
- ✅ 端口3000上的前端(Next.js)
手动启动
终端1-后端:
source .venv/bin/activate
python -m uvicorn webapp:app --host 0.0.0.0 --port 8000 --reload
2号航站楼-前端:
npm run dev
访问
- 📊 仪表盘: http://localhost:3000
- 🔧 API: http://localhost:8000
- 📚 API文件: http://localhost:8000/docs
✨ 特性
1.多代理编排
- 🤖 4个人工智能代理(支持、研究、营销、采购)
- 🎯 自动路由(AI选择最佳代理)
- 🎨 直接代理聊天(用户选择代理)
- 🔍 基于混合检索的RAG搜索
2.现代仪表盘
- ⚡ Next.js 15+TypeScript
- 🎨 shadcn/ui组件
- 📊 实时状态监控
- 💬 多代理聊天界面
3.工作流生成器
- 🔄 Gasable原生拖放编辑器
- 🎯 自定义节点(代理、工具、决策、启动)
- ⚙️ 右键单击节点配置
- 📋 5个预制模板
4.API及工具
- 🛠️ 7个MCP工具
- 📡 RESTful API
- 📚 完整的文件
- 🔌 OpenAPI/Swagger
📋 安装
先决条件
- Python 3.11+
- Node.js 18+
- PostgreSQL与pgvector
- OpenAI API密钥
设置
- 克隆并安装Python依赖项
git clone https://github.com/hrunx/Gasable_Hub.git
cd Gasable_Hub
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- 安装Node.js依赖项
npm install
- 配置环境
cp .env.example .env
# Edit .env with your credentials
- 运行数据库迁移
psql -d your_database -f migrations/0010_multi_agent_schema.sql
psql -d your_database -f migrations/0011_workflows.sql
psql -d your_database -f migrations/0012_research_marketing_agents.sql
- 启动应用程序
./start.sh
🎮 用法
多代理聊天
自动路由模式:
curl -X POST http://localhost:8000/api/orchestrate \
-H "Content-Type: application/json" \
-d '{"user_id":"user123","message":"Research AI trends","namespace":"global"}'
直接代理模式:
curl -X POST http://localhost:8000/api/orchestrate \
-H "Content-Type: application/json" \
-d '{"user_id":"user123","message":"Tell me about AI","namespace":"global","agent_preference":"research"}'
仪表板使用情况
-
选择代理模式
- 紫色闪光=编排器(AI路线)
- 蓝色机器人按钮=直接代理聊天
-
创建工作流
- 点击“工作流”选项卡
- 点击“新建工作流”
- 从侧边栏拖动节点
- 右键单击以配置
-
管理代理
- 点击“代理”选项卡
- 点击“新建代理”以创建
- 单击现有代理进行编辑
📁 项目结构
gasable_mcp/
├── webapp.py # FastAPI backend
├── gasable_hub/ # Core modules
│ ├── agents/ # Agent logic
│ ├── orch/ # Orchestration
│ └── tools/ # MCP tools
├── src/ # Next.js frontend
│ ├── app/ # Pages
│ ├── components/ # React components
│ │ ├── chat/ # Chat interface
│ │ ├── agents/ # Agent management
│ │ └── workflow/ # Workflow builder
│ └── lib/ # API client & utilities
├── migrations/ # SQL migrations
├── logs/ # Application logs
├── start.sh # One-command start script
└── README.md # This file
🔧 API终点
核心终点
POST /api/orchestrate-多代理聊天GET /api/status-系统健康状况GET /api/agents-列出代理POST /api/agents-创建/更新代理GET /api/mcp_tools-列出工具GET /api/workflows-列出工作流POST /api/workflows-保存工作流
📚 API完整文档:参见 API_DOCUMENTATION.md
🧪 测试
测试代理
# Support Agent
curl -X POST http://localhost:8000/api/orchestrate \
-H "Content-Type: application/json" \
-d '{"user_id":"test","message":"What is Gasable?","namespace":"global"}'
# Research Agent (Direct)
curl -X POST http://localhost:8000/api/orchestrate \
-H "Content-Type: application/json" \
-d '{"user_id":"test","message":"Research AI","namespace":"global","agent_preference":"research"}'
检查状态
curl http://localhost:8000/api/status
🚀 生产部署
为生产而建
npm run build
部署到Google Cloud Run
gcloud run deploy gasable-hub \
--source . \
--platform managed \
--region us-central1 \
--port 8000 \
--allow-unauthenticated
📖 完整部署指南:参见 部署_ GIDE.md
🤖 可用代理
| 代理 | ID | 工具 | 目的 |
|---|---|---|---|
| 支持 | support |
rag.search | 一般问题,公司信息 |
| 研究 | research |
rag.search、ingest_web、ingest_urls | 网络研究、数据分析 |
| 营销 | marketing |
rag.search、gmail.send、gmail.draft | 电子邮件活动、内容 |
| 采购 | procurement |
rag.search,orders.place | 订单处理,库存 |
🛠️ 发展
文件监视
后端和前端都支持热重载:
- 后端:
--reload秘鲁国旗 - 前端:Next.js开发服务器自动重新加载
日志
# View logs
tail -f logs/backend.log
tail -f logs/frontend.log
停止服务
pkill -f uvicorn && pkill -f 'next dev'
📊 技术栈
前端:
- Next.js 15
- 反应18
- TypeScript
- shadcn/ui
- 顺风CSS
- 反应流
- TanStack查询
后端:
- 快速API
- Python 3.11
- PostgreSQL
- pg载体
- OpenAI API
工具:
- RAG搜索(混合:向量+BM25+重新排序)
- 网络摄入
- 文档处理
- Gmail集成
- 订单管理
🔐 环境变量
OPENAI_API_KEY=sk-proj-...
DATABASE_URL=postgresql://...
NETLIFY_DATABASE_URL=postgresql://... # Supabase
OPENAI_MODEL=gpt-4o-mini
OPENAI_EMBED_MODEL=text-embedding-3-small
ENVIRONMENT=development
📝 文档
- API文档: API_DOCUMENTATION.md
- 代理商选择: 试剂_选择_饮食.md
- 部署指南: 部署_ GIDE.md
- 快速开始: 快速启动.md
🤝 贡献
- 复刻仓库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
📄 许可证
该项目根据MIT许可证获得许可。
🆘 支持
- GitHub问题: https://github.com/hrunx/Gasable_Hub/issues
- 文档:参见
/docs文件夹 - API文件: http://localhost:8000/docs
✨ 状态
✅ 生产就绪
- 所有功能均已实现
- 全面测试已完成
- 提供完整文件
- 零TypeScript错误
- 零ESLint警告
由...制作❤️ Gasable团队
🌟 如果你觉得这很有用,请在GitHub上给我们加星!
