修改readme
This commit is contained in:
169
README.md
169
README.md
@@ -1,85 +1,104 @@
|
||||
Ubuntu20.04 + python3.11.9 + django
|
||||
#1、安装python3.11.9
|
||||
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget
|
||||
wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz
|
||||
tar zxvf Python-3.11.9.tgz
|
||||
cd Python-3.11.9
|
||||
./configure --enable-optimizations
|
||||
make -j$(nproc)
|
||||
sudo make altinstall
|
||||
python3.11 -m ensurepip --upgrade
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
python3.11 get-pip.py
|
||||
#2、安装python虚拟环境和依赖
|
||||
cd /opt/matagent
|
||||
python3.11 -m venv pyautogen
|
||||
source pyautogen/bin/activate
|
||||
#安装pyautogen
|
||||
pip install pyautogen==0.2.34
|
||||
pip install flaml[automl]
|
||||
pip install chromadb
|
||||
pip install Image
|
||||
#安装django
|
||||
pip install django
|
||||
pip install djangorestframework
|
||||
pip install requests
|
||||
#安装 websocket支持 channels+asgi
|
||||
pip install channels
|
||||
pip install asgiref # Django Channels 依赖的包
|
||||
#运行服务,支持http+websocket websocket接口: ws://192.168.42.130:8000/matagent/chat
|
||||
DJANGO_SETTINGS_MODULE=matagent.settings uvicorn matagent.asgi:application --host 0.0.0.0 --port 8000
|
||||
#安装nginx
|
||||
sudo apt-get update
|
||||
sudo apt-get install nginx
|
||||
--查看状态
|
||||
sudo systemctl status nginx
|
||||
--修改配置
|
||||
/etc/nginx/default
|
||||
nginx配置在default
|
||||
# Multi-Agent Material Science Research Platform
|
||||
|
||||
This project is a comprehensive platform for material science research, consisting of a backend API server, a frontend web application, and a middleware desktop application. The platform integrates various AI agents for planning, scientific analysis, engineering tasks, and data analysis to assist in material science research.
|
||||
|
||||
## Project Structure
|
||||
|
||||
The project is divided into three main components:
|
||||
|
||||
#pip install autogen-agentchat[websockets]~=0.2 fastapi uvicorn
|
||||
1. Backend (Python/FastAPI)
|
||||
2. Frontend (Vue.js)
|
||||
3. Middleware (C#/WPF)
|
||||
|
||||
## Backend
|
||||
|
||||
# 完整agent的console版本
|
||||
matagent_main.py是入口点。
|
||||
安装requirements.txt里面的pyautogen,然后运行即可。
|
||||
.coding目录不要删除,里面包含的是一个配置好的,AGENT执行python代码的环境,否则会报错。
|
||||
如果存在问题,检查.coding/pyvenv.cfg文件配置
|
||||
data目录记录了实验数据,PL和UV数据,不要删除,否则会报错。
|
||||
The backend is built with Python using the FastAPI framework. It manages the core logic of the multi-agent system, handles WebSocket connections for real-time communication, and provides API endpoints for the frontend.
|
||||
|
||||
代码中,agent之间的状态流转逻辑通常为每个group的state_transition函数中,其中return 'auto'表示自动选择合适的agent。
|
||||
### Setup and Running
|
||||
|
||||
# 简单agent的ui版本
|
||||
cd ui-simple
|
||||
chainlit run --port 8989 appUI.py
|
||||
1. Navigate to the backend directory:
|
||||
```
|
||||
cd backend
|
||||
```
|
||||
|
||||
chainlit继承了pyautogen的AssistantAgent,在这个基础上实现了chainlit的接口。
|
||||
class ChainlitAssistantAgent(AssistantAgent):
|
||||
class ChainlitUserProxyAgent(UserProxyAgent):
|
||||
同时重载了两个方法以发送数据到前端。
|
||||
2. Install dependencies (it's recommended to use a virtual environment):
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
"""
|
||||
Wrapper for AutoGens Assistant Agent
|
||||
"""
|
||||
def send(
|
||||
self,
|
||||
message: Union[Dict, str],
|
||||
recipient: Agent,
|
||||
request_reply: Optional[bool] = None,
|
||||
silent: Optional[bool] = False,
|
||||
) -> bool:
|
||||
cl.run_sync(
|
||||
cl.Message(
|
||||
content=f'**{self.name}** Sending message to "{recipient.name}":\n\n{message}',
|
||||
author=self.name,
|
||||
).send()
|
||||
)
|
||||
super(ChainlitAssistantAgent, self).send(
|
||||
message=message,
|
||||
recipient=recipient,
|
||||
request_reply=request_reply,
|
||||
silent=silent,
|
||||
)
|
||||
3. Set up environment variables:
|
||||
- Copy `.env.example` to `.env`
|
||||
- Fill in the required API keys and configuration settings
|
||||
|
||||
4. Run the backend server:
|
||||
```
|
||||
uvicorn api:app --host 0.0.0.0 --port 8000
|
||||
```
|
||||
|
||||
The backend will be available at `http://localhost:8000`.
|
||||
|
||||
## Frontend
|
||||
|
||||
The frontend is a Vue.js application that provides the user interface for interacting with the multi-agent system.
|
||||
|
||||
### Setup and Running
|
||||
|
||||
1. Navigate to the frontend directory:
|
||||
```
|
||||
cd frontend
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Run the development server:
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
|
||||
4. For production build:
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
Before building for production, ensure that the following environment variables in the `.env` file are correctly set:
|
||||
- `VITE_API_URL`: The backend API URL
|
||||
- `VITE_API_URL_PREFIX`: The API prefix
|
||||
- `VITE_WB_BASE_URL`: The WebSocket base URL for real-time communication
|
||||
|
||||
## Middleware
|
||||
|
||||
The middleware is a C# WPF desktop application that provides additional functionality and integration with local systems.
|
||||
|
||||
### Setup and Running
|
||||
|
||||
1. Open the solution file `middleware/zdhsys.sln` in Visual Studio.
|
||||
|
||||
2. Build the solution in Visual Studio.
|
||||
|
||||
3. Run the application from Visual Studio or navigate to the build output directory and run the executable.
|
||||
|
||||
## Usage
|
||||
|
||||
1. Start the backend server.
|
||||
2. Launch the frontend application (either in development mode or by serving the production build).
|
||||
3. If required, run the middleware desktop application.
|
||||
4. Access the web interface through your browser and begin interacting with the multi-agent material science research platform.
|
||||
|
||||
## Features
|
||||
|
||||
- Real-time communication using WebSockets
|
||||
- Multi-agent system for complex task planning and execution
|
||||
- Integration of scientific, engineering, and data analysis teams
|
||||
- Video streaming capabilities for remote monitoring
|
||||
- Customizable UI for different aspects of material science research
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the LICENSE.md file for details.
|
||||
|
||||
Reference in New Issue
Block a user