🏢 企业级多智能体AI管理系统
💡 特别为电力和水利行业设计的智能管理解决方案
</div>智水AI智慧管理解决方案是一个特别为电力和水利行业设计的企业级多智能体AI管理系统。该系统采用先进的MCP(模型上下文协议)架构,并通过多个专业AI智能体的协作工作为企业提供全面的智能分析和决策支持。
┌─────────────────────────────────────────────────────────────┐
│ 前端展示层 │
│ ┌───────────────────────┐ │
│ │ Streamlit仪表板 │ │
│ │ • 数据可视化 │ │
│ │ • 智能体交互 │ │
│ │ • 报告生成 │ │
│ └──────────┬────────────┘ │
│ │ │
└─────────────────────────┼───────────────────────────────────┘
│ HTTP/REST API
┌─────────────────────────┼───────────────────────────────────┐
│ 协调控制层 │
│ ┌──────────┴────────────┐ │
│ │ Agno协调中心 │ │
│ │ • 任务调度 │ │
│ │ • 智能体管理 │ │
│ │ • 结果聚合 │ │
│ └──────────┬────────────┘ │
│ │ │
└─────────────────────────┼───────────────────────────────────┘
│ MCP协议
┌─────────────────────────┼───────────────────────────────────┐
│ 智能体服务层 │
│ ┌──────────┴────────────┐ │
│ │ 专业AI智能体集群 │ │
│ ┌───────────┼───────────┬─────────┼───────────┐ │
│ │财务分析 │成本预测 │知识管理 │效能评估 │ │
│ │智能体 │智能体 │智能体 │智能体 │ │
│ └───────────┴───────────┴─────────┴───────────┘ │
│ │ │
└─────────────────────────┼───────────────────────────────────┘
│ 数据访问
┌─────────────────────────┼───────────────────────────────────┐
│ 数据存储层 │
│ ┌───────────┬───────────┬─────────┬───────────┐ │
│ │SQLite │JSON文件 │Excel │日志文件 │ │
│ │数据库 │ │数据 │ │ │
│ └───────────┴───────────┴─────────┴───────────┘ │
└─────────────────────────────────────────────────────────────┘
智水AI智慧管理解决方案/
├── 1_frontend_dashboard/ # Streamlit前端仪表板
│ ├── main.py # 主应用入口
│ ├── pages.py # 页面路由和组件
│ ├── components.py # UI组件库
│ ├── api_client.py # API客户端
│ ├── config.py # 前端配置
│ ├── models.py # 数据模型
│ ├── utils.py # 工具函数
│ └── requirements.txt # 前端依赖
│
├── 2_financial_ai_mcp/ # 财务AI MCP服务
│ ├── financial_mcp.py # 财务分析智能体
│ ├── data/ # 财务数据存储
│ └── requirements.txt # 服务依赖
│
├── 3_cost_prediction_mcp/ # 成本预测MCP服务
│ ├── cost_prediction_mcp.py # 成本预测智能体
│ ├── predict_cost.py # 预测算法
│ ├── train_model.py # 模型训练
│ ├── utils.py # 工具函数
│ ├── data_templates/ # 数据模板
│ ├── models/ # 训练好的模型
│ └── requirements.txt # 服务依赖
│
├── 4_operation_knowledge_mcp/ # 运营知识MCP服务
│ ├── knowledge_mcp.py # 知识管理智能体
│ ├── knowledge_base/ # 知识库文件
│ └── requirements.txt # 服务依赖
│
├── 5_hr_efficiency_mcp/ # 人力资源效能MCP服务
│ ├── zhishui_efficiency_mcp.py # 效能评估智能体
│ └── requirements.txt # 服务依赖
│
├── 7_agno_coordinator/ # 智能体协调中心
│ ├── start_optimized.py # 协调中心主程序
│ ├── main.py # FastAPI应用
│ ├── planner_agent.py # 规划智能体
│ ├── agents/ # 业务智能体基类
│ │ ├── base_agent.py # 基础智能体类
│ │ ├── business_agent.py # 业务智能体基类
│ │ ├── financial_agent.py # 财务智能体
│ │ ├── cost_agent.py # 成本智能体
│ │ ├── knowledge_agent.py # 知识智能体
│ │ └── efficiency_agent.py # 效能智能体
│ ├── config.py # 系统配置
│ ├── requirements.txt # 协调中心依赖
│ └── docs/ # 架构文档
│
├── .env.example # 环境变量示例
├── README.md # 项目说明文档
└── LICENSE # 许可证文件
# 克隆项目
git clone https://github.com/your-username/zhishui-ai-management.git
cd zhishui-ai-management
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # Linux/Mac
# 或
venv\Scripts\activate # Windows
# 安装依赖
pip install -r 7_agno_coordinator/requirements.txt
pip install -r 1_frontend_dashboard/requirements.txt
cp .env.example .env
.env文件,填写您的API密钥:# OpenAI API配置
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_API_BASE=https://api.openai.com/v1
# 系统配置
SYSTEM_ENV=development
LOG_LEVEL=INFO
7_agno_coordinator/config.py):AI_CONFIG = {
"api_key": os.getenv("OPENAI_API_KEY", ""),
"api_base": os.getenv("OPENAI_API_BASE", "https://api.openai.com/v1"),
"model": "gpt-4-turbo-preview",
"temperature": 0.7,
"max_tokens": 65000,
}
# 1. 启动协调中心(终端1)
cd 7_agno_coordinator
python start_optimized.py
# 2. 启动前端应用(终端2)
cd 1_frontend_dashboard
streamlit run main.py --server.port 8501
# 启动财务分析服务(终端1)
cd 2_financial_ai_mcp
python financial_mcp.py
# 启动成本预测服务(终端2)
cd 3_cost_prediction_mcp
python cost_prediction_mcp.py
# 启动知识管理服务(终端3)
cd 4_operation_knowledge_mcp
python knowledge_mcp.py
# 启动效能评估服务(终端4)
cd 5_hr_efficiency_mcp
python zhishui_efficiency_mcp.py
# 启动智能体协调中心(终端5)
cd 7_agno_coordinator
python start_optimized.py
# 启动Streamlit前端(终端6)
cd 1_frontend_dashboard
streamlit run main.py --server.port 8501
编辑7_agno_coordinator/config.py文件:
# 系统运行配置
@dataclass
class SystemConfig:
system_name: str = "智水信息AI智慧管理系统"
version: str = "1.0.0"
environment: str = "development" # development, production
max_concurrent_workflows: int = 5
max_agent_execution_time: int = 600 # 秒
thread_pool_size: int = 4
# AI模型配置
AI_CONFIG = {
"api_key": os.getenv("OPENAI_API_KEY", ""),
"api_base": os.getenv("OPENAI_API_BASE", "https://api.openai.com/v1"),
"model": "gpt-4-turbo-preview",
"temperature": 0.7,
"max_tokens": 65000,
}
编辑1_frontend_dashboard/config.py文件:
# Streamlit配置
STREAMLIT_CONFIG = {
"page_title": "智水AI智慧管理系统",
"page_icon": "💧",
"layout": "wide",
"initial_sidebar_state": "expanded",
"theme": {
"primaryColor": "#1f77b4",
"backgroundColor": "#f0f2f6",
"secondaryBackgroundColor": "#ffffff",
"textColor": "#262730",
}
}
POST /collaborate
提交任务给多智能体系统进行处理。
请求参数:
{
"task_type": "financial_analysis",
"task_data": {
"company_name": "智水信息技术有限公司",
"analysis_period": "2024",
"focus_areas": ["profitability", "liquidity", "efficiency"]
},
"priority": "high",
"timeout": 300
}
响应示例:
{
"task_id": "task_123456",
"status": "completed",
"results": {
"financial_summary": {
"current_ratio": 2.1,
"roe": 0.15,
"profit_margin": 0.12,
"recommendations": [
"建议优化应收账款管理",
"考虑增加短期投资"
]
}
},
"processing_time": 45.2,
"confidence_score": 0.89
}
GET /health
检查系统的健康状态。
响应示例:
{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z",
"services": {
"coordinator": "running",
"financial_agent": "available",
"cost_agent": "available",
"knowledge_agent": "available",
"efficiency_agent": "available"
},
"version": "1.0.0"
}
git checkout -b feature/your-feature-name
pip install -r requirements