Skip to content

Commit 59634a7

Browse files
committed
add docker
add docker
1 parent 734747a commit 59634a7

File tree

3 files changed

+161
-57
lines changed

3 files changed

+161
-57
lines changed

README.md

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
- [ ] 接入视觉模型
4545
- [x] 添加正确文献引用
4646
- [x] 更多测试案例
47-
- [ ] docker 部署
47+
- [x] docker 部署
4848
- [ ] human in loop: 引入用户的交互(选择模型,@agent重写,等等)
4949
- [ ] feedback: evaluate the result and modify
5050
- [x] codeinterpreter 接入云端 如 e2b 等供应商..
@@ -69,32 +69,69 @@
6969

7070
## 📖 使用教程
7171

72-
> 确保电脑中安装好 Python, Nodejs, **Redis** 环境
7372

74-
> 如果你想运行 命令行版本 cli 切换到 [master](https://github.com/jihe520/MathModelAgent/tree/master) 分支,部署更简单,但未来不会更新
73+
提供三种部署方式,请选择最适合你的方案:
74+
1. docker(最简单)
75+
2. 本地部署
76+
3. 脚本本地部署(社区)
7577

7678

79+
下载项目
7780

78-
1. 配置环境变量
81+
```bash
82+
git clone https://github.com/jihe520/MathModelAgent.git # 克隆项目
83+
```
7984

80-
复制`/backend/.env.dev.example``/backend/.env.dev`(删除`.example` 后缀)
8185

82-
**配置环境变量**
86+
> 如果你想运行 命令行版本 cli 切换到 [master](https://github.com/jihe520/MathModelAgent/tree/master) 分支,部署更简单,但未来不会更新
8387
84-
推荐模型能力较强的、参数量大的模型。
8588

86-
复制`/fronted/.env.example``/fronted/.env`(删除`.example` 后缀)
8789

90+
### 🐳 方案一:Docker 部署(推荐:最简单)
8891

92+
> 确保电脑安装了 docker 环境
8993
90-
2. 安装依赖
9194

92-
下载项目
95+
1. 配置环境变量
9396

9497
```bash
95-
git clone https://github.com/jihe520/MathModelAgent.git # 克隆项目
98+
cp backend/.env.dev.example backend/.env.dev
99+
cp frontend/.env.example frontend/.env.development
100+
```
101+
102+
填入配置
103+
- backend/.env.dev
104+
- frontend/.env.development
105+
106+
2. 启动服务
107+
108+
```bash
109+
docker-compose up -d
96110
```
97111

112+
3. 访问
113+
114+
现在你可以访问:
115+
- 前端界面:http://localhost:5173
116+
- 后端API:http://localhost:8000
117+
118+
119+
### 💻 方案二: 本地部署
120+
121+
> 确保电脑中安装好 Python, Nodejs, **Redis** 环境
122+
123+
124+
1. 配置环境变量
125+
126+
复制`/backend/.env.dev.example``/backend/.env.dev`(删除`.example` 后缀)
127+
128+
推荐模型能力较强的、参数量大的模型。
129+
130+
复制`/fronted/.env.example``/fronted/.env.development`(删除`.example` 后缀)
131+
132+
133+
2. 安装依赖
134+
98135
启动后端
99136

100137
*启动 redis*
@@ -122,15 +159,19 @@ pnpm i #确保电脑安装了 pnpm
122159
pnpm run dev
123160
```
124161

162+
163+
### 🚀 方案三:自动脚本部署(来自社区)
164+
有没有自动部署的脚本 ?
165+
[mmaAutoSetupRun](https://github.com/Fitia-UCAS/mmaAutoSetupRun)
166+
167+
168+
125169
[教程](./docs/md/tutorial.md)
126170

127171
运行的结果和产生在`backend/project/work_dir/xxx/*`目录下
128172
- notebook.ipynb: 保存运行过程中产生的代码
129173
- res.md: 保存最后运行产生的结果为 markdown 格式
130174

131-
有没有自动部署的脚本 ?
132-
[mmaAutoSetupRun](https://github.com/Fitia-UCAS/mmaAutoSetupRun)
133-
134175
需要自定义自定义提示词模板 template ?
135176
Prompt Inject : [prompt](./backend/app/config/md_template.toml)
136177

@@ -150,7 +191,8 @@ clone 项目后,下载 **Todo Tree** 插件,可以查看代码中所有具
150191

151192
## 📄 版权License
152193

153-
个人免费使用,请勿商业用途。
194+
个人免费使用,请勿商业用途,商业用途联系我(作者)
195+
154196
[License](./docs/md/License.md)
155197

156198
## 🙏 Reference
@@ -164,16 +206,18 @@ Thanks to the following projects:
164206

165207
## 其他
166208

167-
### Sponsor
209+
### 💖 Sponsor
168210

169-
[Buy Me a Coffee](./docs/sponser.md)
211+
[Buy Me a Coffee](./docs/md/sponser.md)
170212

171213
感谢赞助
214+
172215
[danmo-tyc](https://github.com/danmo-tyc)
173216

174-
### GROUP
217+
### 👥 GROUP
175218

176219
有问题可以进群问
220+
177221
[QQ 群:699970403](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=rFKquDTSxKcWpEhRgpJD-dPhTtqLwJ9r&authKey=xYKvCFG5My4uYZTbIIoV5MIPQedW7hYzf0%2Fbs4EUZ100UegQWcQ8xEEgTczHsyU6&noverify=0&group_code=699970403)
178222

179223
<div align="center">

README_EN.md

Lines changed: 98 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,23 @@ Automatically generate an award-level modeling paper
1616

1717
<p align="center">
1818
<img src="./docs/index.png">
19+
<img src="./docs/chat.png">
1920
<img src="./docs/coder.png">
2021
<img src="./docs/writer.png">
2122
</p>
2223

2324
## ✨ Features
2425

2526
- 🔍 Automatic problem analysis, mathematical modeling, code writing, error correction, and paper writing
26-
- 💻 Local code interpreter
27+
- 💻 Code Interpreter
28+
- Local Interpreter: Based on Jupyter, code saved as notebook for easy editing
29+
- Cloud Code Interpreter: [E2B](https://e2b.dev/) and [daytona](https://app.daytona.io/)
2730
- 📝 Generate a well-formatted paper
28-
- 🤝 Multi-agents: ~~modeling expert~~, coding expert (reflection module, local code interpreter), paper expert
31+
- 🤝 Multi-agents: modeling expert, coding expert, paper expert, etc.
2932
- 🔄 Multi-LLMs: Different models for each agent
30-
- 💰 Low cost agentless (about 1 RMB per task)
33+
- 🤖 Support for all models: [litellm](https://docs.litellm.ai/docs/providers)
34+
- 💰 Low cost: workflow agentless, no dependency on agent framework
35+
- 🧩 Custom templates: prompt inject for setting requirements for each subtask separately
3136

3237
## 🚀 Future Plans
3338

@@ -37,52 +42,78 @@ Automatically generate an award-level modeling paper
3742
- [ ] English support (MCM/ICM)
3843
- [ ] LaTeX template integration
3944
- [ ] Vision model integration
40-
- [ ] Proper citation implementation
41-
- [ ] More test cases
42-
- [ ] Docker deployment
43-
- [ ] User interaction (model selection, rewriting, etc.)
44-
- [ ] Cloud integration for code interpreter (e.g., e2b providers)
45+
- [x] Proper citation implementation
46+
- [x] More test cases
47+
- [x] Docker deployment
48+
- [ ] Human in loop: User interaction (model selection, @agent rewriting, etc.)
49+
- [ ] Feedback: evaluate the result and modify
50+
- [x] Cloud integration for code interpreter (e.g., e2b providers)
4551
- [ ] Multi-language: R, Matlab
46-
- [ ] Drawing: napki, draw.io
52+
- [ ] Drawing: napki, draw.io, plantuml, svg, mermaid.js
53+
- [ ] Add benchmark
54+
- [ ] Web search tool
55+
- [ ] RAG knowledge base
56+
- [ ] A2A hand off: Code expert reflects on errors multiple times, hands off to smarter model agent
4757

4858
## Video Demo
4959

50-
<video src="https://github.com/user-attachments/assets/10b3145a-feb7-4894-aaca-30d44bb35b9e"></video>
60+
<video src="https://github.com/user-attachments/assets/954cb607-8e7e-45c6-8b15-f85e204a0c5d"></video>
61+
62+
> [!CAUTION]
63+
> The project is in experimental development stage, with many areas needing improvement and optimization. I (the project author) am busy but will update when time permits.
64+
> Contributions are welcome.
65+
66+
For case references, check the [demo](./demo/) folder.
67+
**If you have good cases, please submit a PR to this directory**
5168

5269
## 📖 Usage Guide
5370

54-
> **Notice:** Please make sure Python, Nodejs, and **Redis** are installed on your computer.
55-
>
71+
Three deployment options are available, choose the one that suits you best:
72+
1. Docker
73+
2. Local deployment
74+
3. Automated script deployment
75+
5676
> If you want to run the CLI version, switch to the [master](https://github.com/jihe520/MathModelAgent/tree/master) branch. It's easier to deploy, but will not be updated in the future.
5777
58-
1. Configure Model
78+
### 🐳 Option 1: Docker Deployment (Recommended: Simplest)
5979

60-
Copy `/backend/.env.dev.example` to `/backend/.env.dev` (remove the `.example` suffix), and fill in the model configuration and APIKEY
61-
[Deepseek Developer Platform](https://platform.deepseek.com/)
80+
1. Configure Environment Variables
6281

6382
```bash
64-
ENV=dev
65-
# Compatible with OpenAI format, refer to official docs
66-
DEEPSEEK_API_KEY=
67-
DEEPSEEK_MODEL=
68-
DEEPSEEK_BASE_URL=
69-
# Max Q&A turns
70-
MAX_CHAT_TURNS=60
71-
# Reflection retries
72-
MAX_RETRIES=5
73-
# https://e2b.dev/
74-
E2B_API_KEY=
75-
76-
LOG_LEVEL=DEBUG
77-
DEBUG=true
78-
# Make sure Redis is installed
79-
REDIS_URL=redis://localhost:6379/0
80-
REDIS_MAX_CONNECTIONS=20
81-
CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost:3000
83+
cp backend/.env.dev.example backend/.env.dev
84+
cp frontend/.env.example frontend/.env.development
8285
```
8386

87+
Fill in the configuration in:
88+
- backend/.env.dev
89+
- frontend/.env.development
90+
91+
2. Start Services
92+
93+
```bash
94+
docker-compose up -d
95+
```
96+
97+
3. Access
98+
99+
You can now access:
100+
- Frontend interface: http://localhost:5173
101+
- Backend API: http://localhost:8000
102+
103+
### 💻 Option 2: Local Deployment
104+
105+
> Make sure Python, Nodejs, and **Redis** are installed on your computer
106+
107+
1. Configure Environment Variables
108+
109+
Copy `/backend/.env.dev.example` to `/backend/.env.dev` (remove the `.example` suffix)
110+
111+
**Configure Environment Variables**
112+
84113
It is recommended to use models with strong capabilities and large parameter counts.
85114

115+
Copy `/frontend/.env.example` to `/frontend/.env.development` (remove the `.example` suffix)
116+
86117
2. Install Dependencies
87118

88119
Clone the project
@@ -93,31 +124,48 @@ git clone https://github.com/jihe520/MathModelAgent.git
93124

94125
Start backend
95126

127+
*Start Redis*
128+
96129
```bash
97130
cd backend
98131
pip install uv # Recommended: use uv to manage python projects
99132
uv sync # Install dependencies
100133
# Start backend
101-
ENV=DEV uvicorn app.main:app --host 0.0.0.0 --port 8000 --ws-ping-interval 60 --ws-ping-timeout 120
134+
# Activate Python virtual environment
135+
source .venv/bin/activate # MacOS or Linux
136+
venv\Scripts\activate.bat # Windows
137+
# Run this command for MacOS or Linux
138+
ENV=DEV uvicorn app.main:app --host 0.0.0.0 --port 8000 --ws-ping-interval 60 --ws-ping-timeout 120 --reload
139+
# Run this command for Windows
140+
set ENV=DEV ; uvicorn app.main:app --host 0.0.0.0 --port 8000 --ws-ping-interval 60 --ws-ping-timeout 120
102141
```
103142

104143
Start frontend
105144

106145
```bash
107146
cd frontend
147+
npm install -g pnpm
108148
pnpm i # Make sure pnpm is installed
109149
pnpm run dev
110150
```
111151

152+
[Tutorial](./docs/md/tutorial.md)
153+
112154
Results and outputs are generated in the `backend/project/work_dir/xxx/*` directory:
113155
- notebook.ipynb: code generated during execution
114-
- res.md: final results in markdown format, can be converted to Word (try pandoc)
156+
- res.md: final results in markdown format
157+
158+
### 🚀 Option 3: Automated Script Deployment (Community Contribution)
159+
Need an automatic deployment script?
160+
[mmaAutoSetupRun](https://github.com/Fitia-UCAS/mmaAutoSetupRun)
161+
162+
Need to customize prompt templates?
163+
Prompt Inject: [prompt](./backend/app/config/md_template.toml)
115164

116165
## 🤝 Contribution & Development
117166

118167
[DeepWiki](https://deepwiki.com/jihe520/MathModelAgent)
119168

120-
121169
- The project is in **experimental development stage** (updated when I have time), with frequent changes and some bugs being fixed.
122170
- Everyone is welcome to participate and make the project better.
123171
- PRs and issues are very welcome.
@@ -131,6 +179,8 @@ After cloning the project, install the **Todo Tree** plugin to view all todo loc
131179

132180
Free for personal use. For commercial use, please contact me (the author).
133181

182+
[License](./docs/md/License.md)
183+
134184
## 🙏 Reference
135185

136186
Thanks to the following projects:
@@ -142,10 +192,19 @@ Thanks to the following projects:
142192

143193
## Others
144194

145-
Thanks to sponsors
195+
### 💖 Sponsor
196+
197+
[Buy Me a Coffee](./docs/sponser.md)
198+
199+
Thanks to sponsors:
146200
[danmo-tyc](https://github.com/danmo-tyc)
147201

148-
For questions, join the group
202+
### 👥 GROUP
203+
204+
For questions, join the group
205+
149206
[QQ Group: 699970403](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=rFKquDTSxKcWpEhRgpJD-dPhTtqLwJ9r&authKey=xYKvCFG5My4uYZTbIIoV5MIPQedW7hYzf0%2Fbs4EUZ100UegQWcQ8xEEgTczHsyU6&noverify=0&group_code=699970403)
150207

151-
<img src="./docs/qq.jpg" height="400px">
208+
<div align="center">
209+
<img src="./docs/qq.jpg" height="400px">
210+
</div>

backend/.env.dev.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ OPENALEX_EMAIL=
3737
LOG_LEVEL=DEBUG
3838
DEBUG=true
3939
# 确保安装 Redis
40+
# 如果是docker: REDIS_URL=redis://redis:6379/0
4041
REDIS_URL=redis://localhost:6379/0
4142
REDIS_MAX_CONNECTIONS=20
4243
CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost:3000

0 commit comments

Comments
 (0)