kabudadada commited on
Commit
3de53ca
·
1 Parent(s): 06f289c

Update README: convert to English, simplify environment config, and update secrets section

Browse files
Files changed (1) hide show
  1. README.md +47 -75
README.md CHANGED
@@ -11,103 +11,80 @@ pinned: false
11
 
12
  # Code2MCP-FoamAgent
13
 
14
- Foam-Agent 的 MCP (Model Context Protocol) 服务包装器,提供基于自然语言的 OpenFOAM CFD 仿真工作流。
15
 
16
- ## 功能特性
17
 
18
- - 🧪 基于自然语言的 CFD 仿真需求
19
- - 🤖 多智能体工作流自动化
20
- - 📊 自动错误检测和修正
21
- - 🔧 自定义网格支持 (GMSH .msh 文件)
22
- - 🌐 多种 LLM 提供商支持
23
 
24
- ## 快速开始
25
 
26
- ### 1. 环境配置
27
 
28
- 复制环境变量模板并配置:
29
 
30
- ```bash
31
- cp env.example .env
32
- ```
33
-
34
- 编辑 `.env` 文件,设置您的 API 密钥:
35
-
36
- ```env
37
- # OpenAI API Configuration
38
- OPENAI_API_KEY=your_openai_api_key_here
39
- OPENAI_BASE_URL=https://api.openai.com/v1
40
 
41
- # 或者使用自定义 API 端点
42
- # OPENAI_BASE_URL=https://api.gptsapi.net/v1
43
- ```
44
-
45
- ### 2. 安装依赖
46
-
47
- #### 使用 conda(推荐)
48
 
49
  ```bash
50
- # 创建 conda 环境
51
  conda env create -f environment.yml
52
 
53
- # 激活环境
54
  conda activate openfoamAgent
55
 
56
- # 安装额外的 MCP 依赖
57
  pip install fastapi uvicorn[standard] fastmcp
58
  ```
59
 
60
- ### 3. 运行 MCP 服务
61
 
62
  ```bash
63
  python Foam-Agent/mcp_output/start_mcp.py
64
  ```
65
 
66
- ### 4. Docker 部署
67
-
68
- #### 方法一:使用 .env 文件(推荐)
69
 
70
- ```bash
71
- # 1. 创建 .env 文件
72
- cp env.example .env
73
- # 编辑 .env 文件,填入您的 API 密钥
74
-
75
- # 2. 使用 docker-compose(推荐)
76
- docker-compose up -d
77
-
78
- # 3. 或者使用 docker run
79
- docker run -p 7860:7860 --env-file .env code2mcp-foamagent
80
- ```
81
-
82
- #### 方法二:直接设置环境变量
83
 
84
  ```bash
85
- # 构建镜像
86
  docker build -t code2mcp-foamagent .
87
 
88
- # 运行容器(设置环境变量)
89
  docker run -p 7860:7860 \
90
  -e OPENAI_API_KEY=your_api_key_here \
91
  -e OPENAI_BASE_URL=https://api.openai.com/v1 \
92
  code2mcp-foamagent
93
  ```
94
 
95
- ## 使用方法
 
 
 
 
 
 
96
 
97
- ### 基本 CFD 仿真
98
 
99
  ```python
100
- # 运行简单的 CFD 仿真
101
  result = run_foam_agent(
102
  requirements="Do an incompressible lid driven cavity flow...",
103
  output_dir="./output"
104
  )
105
  ```
106
 
107
- ### 使用自定义网格
108
 
109
  ```python
110
- # 使用自定义 GMSH 网格文件
111
  result = run_foam_agent(
112
  requirements="Simulate flow over a tandem wing...",
113
  output_dir="./output",
@@ -115,10 +92,10 @@ result = run_foam_agent(
115
  )
116
  ```
117
 
118
- ### 完整基准测试
119
 
120
  ```python
121
- # 运行完整的 Foam-Agent 基准测试
122
  result = run_foam_benchmark(
123
  openfoam_path="/opt/openfoam10",
124
  requirements="Your CFD requirements...",
@@ -126,32 +103,27 @@ result = run_foam_benchmark(
126
  )
127
  ```
128
 
129
- ## 环境变量
130
 
131
- | 变量名 | 描述 | 默认值 |
132
- |--------|------|--------|
133
- | `OPENAI_API_KEY` | OpenAI API 密钥 | 必需 |
134
- | `OPENAI_BASE_URL` | OpenAI API 基础 URL | `https://api.openai.com/v1` |
135
- | `WM_PROJECT_DIR` | OpenFOAM 安装路径 | `/opt/openfoam10` |
136
- | `MODEL_PROVIDER` | LLM 提供商 | `openai` |
137
- | `MODEL_VERSION` | 模型版本 | `gpt-4o` |
138
- | `MCP_TRANSPORT` | MCP 传输模式 | `http` |
139
- | `MCP_PORT` | MCP 服务端口 | `7860` |
140
 
141
- ## 系统要求
142
 
143
  - Python 3.11+
144
  - OpenFOAM v10
145
- - OpenAI API 密钥或其他 LLM 提供商
146
- - 预处理的 OpenFOAM 数据库
147
 
148
- ## 故障排除
149
 
150
- 1. **检查系统状态**:使用 `check_foam_agent_status` 工具
151
- 2. **验证 API 配置**:确保 API 密钥和 URL 正确设置
152
- 3. **检查依赖**:确保所有 Python 包已正确安装
153
- 4. **OpenFOAM 环境**:确保 OpenFOAM 已正确安装并配置
154
 
155
- ## 许可证
156
 
157
  MIT License
 
11
 
12
  # Code2MCP-FoamAgent
13
 
14
+ MCP (Model Context Protocol) service wrapper for Foam-Agent, providing natural language-based OpenFOAM CFD simulation workflows.
15
 
16
+ ## Features
17
 
18
+ - 🧪 Natural language CFD simulation requirements
19
+ - 🤖 Multi-agent workflow automation
20
+ - 📊 Automatic error detection and correction
21
+ - 🔧 Custom mesh support (GMSH .msh files)
22
+ - 🌐 Multiple LLM provider support
23
 
24
+ ## Quick Start
25
 
26
+ ### 1. Environment Configuration
27
 
28
+ Environment variables are configured in Hugging Face Spaces secrets. No local configuration needed.
29
 
30
+ ### 2. Install Dependencies
 
 
 
 
 
 
 
 
 
31
 
32
+ #### Using conda (Recommended)
 
 
 
 
 
 
33
 
34
  ```bash
35
+ # Create conda environment
36
  conda env create -f environment.yml
37
 
38
+ # Activate environment
39
  conda activate openfoamAgent
40
 
41
+ # Install additional MCP dependencies
42
  pip install fastapi uvicorn[standard] fastmcp
43
  ```
44
 
45
+ ### 3. Run MCP Service
46
 
47
  ```bash
48
  python Foam-Agent/mcp_output/start_mcp.py
49
  ```
50
 
51
+ ### 4. Docker Deployment
 
 
52
 
53
+ #### Using environment variables
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ```bash
56
+ # Build image
57
  docker build -t code2mcp-foamagent .
58
 
59
+ # Run container (set environment variables)
60
  docker run -p 7860:7860 \
61
  -e OPENAI_API_KEY=your_api_key_here \
62
  -e OPENAI_BASE_URL=https://api.openai.com/v1 \
63
  code2mcp-foamagent
64
  ```
65
 
66
+ ### 5. Hugging Face Spaces Deployment
67
+
68
+ Environment variables are configured in Hugging Face Spaces secrets. The service is ready to use once deployed.
69
+
70
+ **Note**: Due to Hugging Face Spaces limitations, OpenFOAM may not run completely, but the MCP service itself can work normally.
71
+
72
+ ## Usage
73
 
74
+ ### Basic CFD Simulation
75
 
76
  ```python
77
+ # Run simple CFD simulation
78
  result = run_foam_agent(
79
  requirements="Do an incompressible lid driven cavity flow...",
80
  output_dir="./output"
81
  )
82
  ```
83
 
84
+ ### Using Custom Mesh
85
 
86
  ```python
87
+ # Use custom GMSH mesh file
88
  result = run_foam_agent(
89
  requirements="Simulate flow over a tandem wing...",
90
  output_dir="./output",
 
92
  )
93
  ```
94
 
95
+ ### Complete Benchmark
96
 
97
  ```python
98
+ # Run complete Foam-Agent benchmark
99
  result = run_foam_benchmark(
100
  openfoam_path="/opt/openfoam10",
101
  requirements="Your CFD requirements...",
 
103
  )
104
  ```
105
 
106
+ ## Environment Secrets
107
 
108
+ | Variable | Description | Required |
109
+ |----------|-------------|----------|
110
+ | `OPENAI_API_KEY` | OpenAI API key | Yes |
111
+ | `OPENAI_BASE_URL` | OpenAI API base URL | No |
 
 
 
 
 
112
 
113
+ ## System Requirements
114
 
115
  - Python 3.11+
116
  - OpenFOAM v10
117
+ - OpenAI API key or other LLM provider
118
+ - Preprocessed OpenFOAM database
119
 
120
+ ## Troubleshooting
121
 
122
+ 1. **Check system status**: Use `check_foam_agent_status` tool
123
+ 2. **Verify API configuration**: Ensure API key and URL are correctly set
124
+ 3. **Check dependencies**: Ensure all Python packages are properly installed
125
+ 4. **OpenFOAM environment**: Ensure OpenFOAM is properly installed and configured
126
 
127
+ ## License
128
 
129
  MIT License