Skip to content

Commit

Permalink
update config usage
Browse files Browse the repository at this point in the history
  • Loading branch information
geekan committed Jan 31, 2024
1 parent ad1edf6 commit a762e02
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 132 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apt update &&\

# Install Mermaid CLI globally
ENV CHROME_BIN="/usr/bin/chromium" \
PUPPETEER_CONFIG="/app/metagpt/config/puppeteer-config.json"\
puppeteer_config="/app/metagpt/config/puppeteer-config.json"\
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
RUN npm install -g @mermaid-js/mermaid-cli &&\
npm cache clean --force
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ git clone https://github.com/geekan/MetaGPT.git
cd MetaGPT
pip3 install -e . # or pip3 install metagpt # for stable version

# Step 3: setup your OPENAI_API_KEY, or make sure it existed in the env
# Step 3: setup your LLM key in the config2.yaml file
mkdir ~/.metagpt
cp config/config.yaml ~/.metagpt/config.yaml
vim ~/.metagpt/config.yaml
cp config/config2.yaml ~/.metagpt/config2.yaml
vim ~/.metagpt/config2.yaml

# Step 4: run metagpt cli
metagpt "Create a 2048 game in python"
Expand All @@ -87,16 +87,16 @@ detail installation please refer to [cli_install](https://docs.deepwisdom.ai/mai
> Note: In the Windows, you need to replace "/opt/metagpt" with a directory that Docker has permission to create, such as "D:\Users\x\metagpt"
```bash
# Step 1: Download metagpt official image and prepare config.yaml
# Step 1: Download metagpt official image and prepare config2.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
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.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/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
metagpt "Write a cli snake game"
Expand Down
3 changes: 0 additions & 3 deletions config/config2.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ IFLYTEK_API_KEY: "YOUR_API_KEY"
IFLYTEK_API_SECRET: "YOUR_API_SECRET"

METAGPT_TEXT_TO_IMAGE_MODEL_URL: "YOUR_MODEL_URL"

PYPPETEER_EXECUTABLE_PATH: "/Applications/Google Chrome.app"

30 changes: 4 additions & 26 deletions docs/FAQ-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ MetaGPT Community - The position of Chief Evangelist rotates on a monthly basis.

1. PRD stuck / unable to access/ connection interrupted

1. The official OPENAI_BASE_URL address is `https://api.openai.com/v1`
1. If the official OPENAI_BASE_URL address is inaccessible in your environment (this can be verified with curl), it's recommended to configure using the reverse proxy OPENAI_BASE_URL provided by libraries such as openai-forward. For instance, `OPENAI_BASE_URL: "``https://api.openai-forward.com/v1``"`
1. If the official OPENAI_BASE_URL address is inaccessible in your environment (again, verifiable via curl), another option is to configure the OPENAI_PROXY parameter. This way, you can access the official OPENAI_BASE_URL via a local proxy. If you don't need to access via a proxy, please do not enable this configuration; if accessing through a proxy is required, modify it to the correct proxy address. Note that when OPENAI_PROXY is enabled, don't set OPENAI_BASE_URL.
1. Note: OpenAI's default API design ends with a v1. An example of the correct configuration is: `OPENAI_BASE_URL: "``https://api.openai.com/v1``"`
1. The official openai base_url address is `https://api.openai.com/v1`
1. If the official openai base_url address is inaccessible in your environment (this can be verified with curl), it's recommended to configure using the reverse proxy openai base_url provided by libraries such as openai-forward. For instance, `openai base_url: "``https://api.openai-forward.com/v1``"`
1. If the official openai base_url address is inaccessible in your environment (again, verifiable via curl), another option is to configure the llm.proxy parameter. This way, you can access the official openai base_url via a local proxy. If you don't need to access via a proxy, please do not enable this configuration; if accessing through a proxy is required, modify it to the correct proxy address. Note that when llm.proxy is enabled, don't set openai base_url.
1. Note: OpenAI's default API design ends with a v1. An example of the correct configuration is: `openai base_url: "``https://api.openai.com/v1``"`

1. Absolutely! How can I assist you today?

Expand Down Expand Up @@ -119,28 +119,6 @@ MetaGPT Community - The position of Chief Evangelist rotates on a monthly basis.
1. When using a database, it often gets the implementation wrong — since the SQL database initialization process is usually not in the code.
1. With more lines of code, there's a higher chance of false impressions, leading to calls to non-existent APIs.

1. Instructions for using SD Skills/UI Role:

1. Currently, there is a test script located in /tests/metagpt/roles. The file ui_role provides the corresponding code implementation. For testing, you can refer to the test_ui in the same directory.

1. The UI role takes over from the product manager role, extending the output from the 【UI Design draft】 provided by the product manager role. The UI role has implemented the UIDesign Action. Within the run of UIDesign, it processes the respective context, and based on the set template, outputs the UI. The output from the UI role includes:

1. UI Design Description: Describes the content to be designed and the design objectives.
1. Selected Elements: Describes the elements in the design that need to be illustrated.
1. HTML Layout: Outputs the HTML code for the page.
1. CSS Styles (styles.css): Outputs the CSS code for the page.

1. Currently, the SD skill is a tool invoked by UIDesign. It instantiates the SDEngine, with specific code found in metagpt/tools/sd_engine.

1. Configuration instructions for SD Skills: The SD interface is currently deployed based on *https://github.com/AUTOMATIC1111/stable-diffusion-webui* **For environmental configurations and model downloads, please refer to the aforementioned GitHub repository. To initiate the SD service that supports API calls, run the command specified in cmd with the parameter nowebui, i.e.,

1. > python3 webui.py --enable-insecure-extension-access --port xxx --no-gradio-queue --nowebui
1.     Once it runs without errors, the interface will be accessible after approximately 1 minute when the model finishes loading.
1. Configure SD_URL and SD_T2I_API in the config.yaml/key.yaml files.
1. ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/065295a67b0b4feea665d1372722d49d~tplv-k3u1fbpfcp-zoom-1.image)
1.     SD_URL is the deployed server/machine IP, and Port is the specified port above, defaulting to 7860.
1. > SD_URL: IP:Port
1. An error occurred during installation: "Another program is using this file...egg".

1. Delete the file and try again.
Expand Down
10 changes: 5 additions & 5 deletions docs/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cd MetaGPT
pip3 install -e. # 或者 pip3 install metagpt # 安装稳定版本

# 第 3 步:执行metagpt
# 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY
# 拷贝config2.yaml为~/.metagpt/config2.yaml,并设置你自己的api_key
metagpt "Write a cli snake game"

# 第 4 步【可选的】:如果你想在执行过程中保存像象限图、系统设计、序列流程等图表这些产物,可以在第3步前执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。
Expand All @@ -63,16 +63,16 @@ sudo npm install -g @mermaid-js/mermaid-cli
> 注意:在Windows中,你需要将 "/opt/metagpt" 替换为Docker具有创建权限的目录,比如"D:\Users\x\metagpt"
```bash
# 步骤1: 下载metagpt官方镜像并准备好config.yaml
# 步骤1: 下载metagpt官方镜像并准备好config2.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 # 修改配置文件
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.yaml # 修改配置文件

# 步骤2: 使用容器运行metagpt演示
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
metagpt "Write a cli snake game"
Expand Down
50 changes: 24 additions & 26 deletions docs/README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cd MetaGPT
pip install -e.

# ステップ 3: metagpt を実行する
# config.yaml を key.yaml にコピーし、独自の OPENAI_API_KEY を設定します
# config/config2.yaml を ~/.metagpt/config2.yaml にコピーし、独自の api_key を設定します
metagpt "Write a cli snake game"

# ステップ 4 [オプション]: 実行中に PRD ファイルなどのアーティファクトを保存する場合は、ステップ 3 の前にこのステップを実行できます。デフォルトでは、フレームワークには互換性があり、この手順を実行しなくてもプロセス全体を完了できます。
Expand All @@ -91,8 +91,8 @@ Chromium のダウンロードをスキップすることができます。
- config.yml に mmdc のコンフィグを記述するのを忘れないこと

```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
puppeteer_config: "./config/puppeteer-config.json"
path: "./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` を実行してみてください
Expand All @@ -114,12 +114,13 @@ Chromium のダウンロードをスキップすることができます。
playwright install --with-deps chromium
```

- **modify `config.yaml`**
- **modify `config2.yaml`**

config.yaml から MERMAID_ENGINE のコメントを外し、`playwright` に変更する
config2.yaml から mermaid.engine のコメントを外し、`playwright` に変更する

```yaml
MERMAID_ENGINE: playwright
mermaid:
engine: playwright
```

- pyppeteer
Expand All @@ -143,21 +144,23 @@ Chromium のダウンロードをスキップすることができます。
pyppeteer-install
```

- **`config.yaml` を修正**
- **`config2.yaml` を修正**

config.yaml から MERMAID_ENGINE のコメントを外し、`pyppeteer` に変更する
config2.yaml から mermaid.engine のコメントを外し、`pyppeteer` に変更する

```yaml
MERMAID_ENGINE: pyppeteer
mermaid:
engine: pyppeteer
```

- mermaid.ink
- **`config.yaml` を修正**
- **`config2.yaml` を修正**

config.yaml から MERMAID_ENGINE のコメントを外し、`ink` に変更する
config2.yaml から mermaid.engine のコメントを外し、`ink` に変更する

```yaml
MERMAID_ENGINE: ink
mermaid:
engine: ink
```

: この方法は pdf エクスポートに対応していません。
Expand All @@ -166,24 +169,24 @@ Chromium のダウンロードをスキップすることができます。
> Windowsでは、"/opt/metagpt"をDockerが作成する権限を持つディレクトリに置き換える必要があります。例えば、"D:\Users\x\metagpt"などです。

```bash
# ステップ 1: metagpt 公式イメージをダウンロードし、config.yaml を準備する
# ステップ 1: metagpt 公式イメージをダウンロードし、config2.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 # 設定を変更する
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.yaml # 設定を変更する
# ステップ 2: コンテナで metagpt デモを実行する
docker run --rm \
--privileged \
-v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
-v /opt/metagpt/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
metagpt "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/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest
Expand All @@ -194,7 +197,7 @@ $ metagpt "Write a cli snake game"
コマンド `docker run ...` は以下のことを行います:

- 特権モードで実行し、ブラウザの実行権限を得る
- ホスト設定ファイル `/opt/metagpt/config/key.yaml` をコンテナ `/app/metagpt/config/key.yaml` にマップします
- ホスト設定ファイル `/opt/metagpt/config/config2.yaml` をコンテナ `/app/metagpt/config/config2.yaml` にマップします
- ホストディレクトリ `/opt/metagpt/workspace` をコンテナディレクトリ `/app/metagpt/workspace` にマップするs
- デモコマンド `metagpt "Write a cli snake game"` を実行する

Expand All @@ -208,19 +211,14 @@ cd MetaGPT && docker build -t metagpt:custom .

## 設定

- `OPENAI_API_KEY` を `config/key.yaml / config/config.yaml / env` のいずれかで設定します。
- 優先順位は: `config/key.yaml > config/config.yaml > env` の順です。
- `api_key` を `~/.metagpt/config2.yaml / config/config2.yaml` のいずれかで設定します。
- 優先順位は: `~/.metagpt/config2.yaml > config/config2.yaml > env` の順です。

```bash
# 設定ファイルをコピーし、必要な修正を加える。
cp config/config.yaml config/key.yaml
cp config/config2.yaml ~/.metagpt/config2.yaml
```

| 変数名 | config/key.yaml | env |
| --------------------------------------- | ----------------------------------------- | ----------------------------------------------- |
| OPENAI_API_KEY # 自分のキーに置き換える | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
| OPENAI_BASE_URL # オプション | OPENAI_BASE_URL: "https://<YOUR_SITE>/v1" | export OPENAI_BASE_URL="https://<YOUR_SITE>/v1" |

## チュートリアル: スタートアップの開始

```shell
Expand Down
25 changes: 14 additions & 11 deletions docs/install/cli_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pip install -e.
- don't forget to the configuration for mmdc in config.yml

```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
puppeteer_config: "./config/puppeteer-config.json"
path: "./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`
Expand All @@ -59,12 +59,13 @@ pip install -e.
playwright install --with-deps chromium
```

- **modify `config.yaml`**
- **modify `config2.yaml`**

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

```yaml
MERMAID_ENGINE: playwright
mermaid:
engine: playwright
```

- pyppeteer
Expand All @@ -88,21 +89,23 @@ pip install -e.
pyppeteer-install
```

- **modify `config.yaml`**
- **modify `config2.yaml`**

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

```yaml
MERMAID_ENGINE: pyppeteer
mermaid:
engine: pyppeteer
```

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

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

```yaml
MERMAID_ENGINE: ink
mermaid:
engine: ink
```

Note: this method does not support pdf export.
Expand Down
4 changes: 2 additions & 2 deletions docs/install/cli_install_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pip install -e.
- 不要忘记在config.yml中为mmdc配置配置,

```yml
PUPPETEER_CONFIG: "./config/puppeteer-config.json"
MMDC: "./node_modules/.bin/mmdc"
puppeteer_config: "./config/puppeteer-config.json"
path: "./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`运行。
12 changes: 6 additions & 6 deletions docs/install/docker_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
### Use default MetaGPT image

```bash
# Step 1: Download metagpt official image and prepare config.yaml
# Step 1: Download metagpt official image and prepare config2.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
docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config2.yaml > /opt/metagpt/config/config2.yaml
vim /opt/metagpt/config/config2.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/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest \
metagpt "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/config/config2.yaml:/app/metagpt/config/config2.yaml \
-v /opt/metagpt/workspace:/app/metagpt/workspace \
metagpt/metagpt:latest

Expand All @@ -31,7 +31,7 @@ $ metagpt "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 configure file `/opt/metagpt/config/config2.yaml` to container `/app/metagpt/config/config2.yaml`
- Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace`
- Execute the demo command `metagpt "Write a cli snake game"`

Expand Down
Loading

0 comments on commit a762e02

Please sign in to comment.