Skip to content

Commit

Permalink
Merge pull request geekan#22 from geekan/main
Browse files Browse the repository at this point in the history
feat: Merge geekan/MetaGPT/main
  • Loading branch information
iorisa authored Nov 27, 2023
2 parents 45e48c8 + 6f34500 commit 62f0745
Show file tree
Hide file tree
Showing 17 changed files with 1,143 additions and 0 deletions.
109 changes: 109 additions & 0 deletions docs/install/cli_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
## Traditional Command Line Installation

### Support System and version
| System Version | Python Version | Supported |
| ---- | ---- | ----- |
| macOS 13.x | python 3.9 | Yes |
| Windows 11 | python 3.9 | Yes |
| Ubuntu 22.04 | python 3.9 | Yes |

### Detail Installation
```bash
# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js. (If you don't have npm in your computer, please go to the Node.js official website to install Node.js https://nodejs.org/ and then you will have npm tool in your computer.)
npm --version
sudo npm install -g @mermaid-js/mermaid-cli

# Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using:
python3 --version

# Step 3: Clone the repository to your local machine, and install it.
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT
pip install -e.
```

**Note:**

- If already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable
`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true`.

- Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution,

```bash
npm install @mermaid-js/mermaid-cli
```

- don't forget to the configuration for mmdc in config.yml

```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
```
- if `pip install -e.` fails with error `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`, try instead running `pip install -e. --user`

- To convert Mermaid charts to SVG, PNG, and PDF formats. In addition to the Node.js version of Mermaid-CLI, you now have the option to use Python version Playwright, pyppeteer or mermaid.ink for this task.

- Playwright
- **Install Playwright**

```bash
pip install playwright
```

- **Install the Required Browsers**

to support PDF conversion, please install Chrominum.

```bash
playwright install --with-deps chromium
```

- **modify `config.yaml`**

uncomment MERMAID_ENGINE from config.yaml and change it to `playwright`

```yaml
MERMAID_ENGINE: playwright
```

- pyppeteer
- **Install pyppeteer**

```bash
pip install pyppeteer
```

- **Use your own Browsers**

pyppeteer allows you use installed browsers, please set the following envirment

```bash
export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome
```

please do not use this command to install browser, it is too old

```bash
pyppeteer-install
```

- **modify `config.yaml`**

uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer`

```yaml
MERMAID_ENGINE: pyppeteer
```

- mermaid.ink
- **modify `config.yaml`**

uncomment MERMAID_ENGINE from config.yaml and change it to `ink`

```yaml
MERMAID_ENGINE: ink
```

Note: this method does not support pdf export.

43 changes: 43 additions & 0 deletions docs/install/cli_install_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## 命令行安装

### 支持的系统和版本
| 系统版本 | Python 版本 | 是否支持 |
| ---- | ---- | ----- |
| macOS 13.x | python 3.9 ||
| Windows 11 | python 3.9 ||
| Ubuntu 22.04 | python 3.9 ||

### 详细安装

```bash
# 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js
npm --version
sudo npm install -g @mermaid-js/mermaid-cli

# 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查:
python --version

# 第 3 步:克隆仓库到您的本地机器,并进行安装。
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT
pip install -e.
```

**注意:**

- 如果已经安装了Chrome、Chromium或MS Edge,可以通过将环境变量`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD`设置为`true`来跳过下载Chromium。

- 一些人在全局安装此工具时遇到问题。在本地安装是替代解决方案,

```bash
npm install @mermaid-js/mermaid-cli
```

- 不要忘记在config.yml中为mmdc配置配置,

```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
```

- 如果`pip install -e.`失败并显示错误`[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`,请尝试使用`pip install -e. --user`运行。
44 changes: 44 additions & 0 deletions docs/install/docker_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Docker Installation

### Use default MetaGPT image

```bash
# Step 1: Download metagpt official image and prepare config.yaml
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
vim /opt/metagpt/config/key.yaml # Change the config

# Step 2: Run metagpt demo with container
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
python3 startup.py "Write a cli snake game"

# You can also start a container and execute commands in it
docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest

docker exec -it metagpt /bin/bash
$ python3 startup.py "Write a cli snake game"
```

The command `docker run ...` do the following things:

- Run in privileged mode to have permission to run the browser
- Map host configure file `/opt/metagpt/config/key.yaml` to container `/app/metagpt/config/key.yaml`
- Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace`
- Execute the demo command `python3 startup.py "Write a cli snake game"`

### Build image by yourself

```bash
# You can also build metagpt image by yourself.
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .
```
44 changes: 44 additions & 0 deletions docs/install/docker_install_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Docker安装

### 使用MetaGPT镜像

```bash
# 步骤1: 下载metagpt官方镜像并准备好config.yaml
docker pull metagpt/metagpt:latest
mkdir -p /opt/metagpt/{config,workspace}
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
vim /opt/metagpt/config/key.yaml # 修改配置文件

# 步骤2: 使用容器运行metagpt演示
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
python startup.py "Write a cli snake game"

# 您也可以启动一个容器并在其中执行命令
docker run --name metagpt -d \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest

docker exec -it metagpt /bin/bash
$ python startup.py "Write a cli snake game"
```

`docker run ...`做了以下事情:

- 以特权模式运行,有权限运行浏览器
- 将主机文件 `/opt/metagpt/config/key.yaml` 映射到容器文件 `/app/metagpt/config/key.yaml`
- 将主机目录 `/opt/metagpt/workspace` 映射到容器目录 `/app/metagpt/workspace`
- 执行示例命令 `python startup.py "Write a cli snake game"`

### 自己构建镜像

```bash
# 您也可以自己构建metagpt镜像
git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT && docker build -t metagpt:custom .
```
67 changes: 67 additions & 0 deletions docs/tutorial/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## MetaGPT Usage

### Configuration

- Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env`
- Priority order: `config/key.yaml > config/config.yaml > env`

```bash
# Copy the configuration file and make the necessary modifications.
cp config/config.yaml config/key.yaml
```

| Variable Name | config/key.yaml | env |
| ------------------------------------------ | ----------------------------------------- | ----------------------------------------------- |
| OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
| OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |

### Initiating a startup

```shell
# Run the script
python startup.py "Write a cli snake game"
# Do not hire an engineer to implement the project
python startup.py "Write a cli snake game" --implement False
# Hire an engineer and perform code reviews
python startup.py "Write a cli snake game" --code_review True
```

After running the script, you can find your new project in the `workspace/` directory.

### Preference of Platform or Tool

You can tell which platform or tool you want to use when stating your requirements.

```shell
python startup.py "Write a cli snake game based on pygame"
```

### Usage

```
NAME
startup.py - We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.
SYNOPSIS
startup.py IDEA <flags>
DESCRIPTION
We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.
POSITIONAL ARGUMENTS
IDEA
Type: str
Your innovative idea, such as "Creating a snake game."
FLAGS
--investment=INVESTMENT
Type: float
Default: 3.0
As an investor, you have the opportunity to contribute a certain dollar amount to this AI company.
--n_round=N_ROUND
Type: int
Default: 5
NOTES
You can also use flags syntax for POSITIONAL ARGUMENTS
```
63 changes: 63 additions & 0 deletions docs/tutorial/usage_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## MetaGPT 使用

### 配置

-`config/key.yaml / config/config.yaml / env` 中配置您的 `OPENAI_API_KEY`
- 优先级顺序:`config/key.yaml > config/config.yaml > env`

```bash
# 复制配置文件并进行必要的修改
cp config/config.yaml config/key.yaml
```

| 变量名 | config/key.yaml | env |
| ----------------------------------- | ----------------------------------------- | ----------------------------------------------- |
| OPENAI_API_KEY # 用您自己的密钥替换 | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
| OPENAI_API_BASE # 可选 | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |

### 示例:启动一个创业公司

```shell
python startup.py "写一个命令行贪吃蛇"
# 开启code review模式会花费更多的金钱, 但是会提升代码质量和成功率
python startup.py "写一个命令行贪吃蛇" --code_review True
```

运行脚本后,您可以在 `workspace/` 目录中找到您的新项目。

### 平台或工具的倾向性
可以在阐述需求时说明想要使用的平台或工具。
例如:
```shell
python startup.py "写一个基于pygame的命令行贪吃蛇"
```

### 使用

```
名称
startup.py - 我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。
概要
startup.py IDEA <flags>
描述
我们是一家AI软件创业公司。通过投资我们,您将赋能一个充满无限可能的未来。
位置参数
IDEA
类型: str
您的创新想法,例如"写一个命令行贪吃蛇。"
标志
--investment=INVESTMENT
类型: float
默认值: 3.0
作为投资者,您有机会向这家AI公司投入一定的美元金额。
--n_round=N_ROUND
类型: int
默认值: 5
备注
您也可以用`标志`的语法,来处理`位置参数`
```
Loading

0 comments on commit 62f0745

Please sign in to comment.