Merge pull request #338 from shenchucheng/main

fix some bugs
This commit is contained in:
stellaHSR 2023-09-19 10:48:35 +08:00 committed by GitHub
commit 1333738915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 33 deletions

View file

@ -4,4 +4,4 @@ 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:
python --version
python setup.py install
pip install -e.

View file

@ -18,7 +18,7 @@ COPY . /app/metagpt
WORKDIR /app/metagpt
RUN mkdir workspace &&\
pip install --no-cache-dir -r requirements.txt &&\
python setup.py install
pip install -e.
# Running with an infinite loop using the tail command
CMD ["sh", "-c", "tail -f /dev/null"]

View file

@ -70,7 +70,7 @@ # Step 2: Ensure that Python 3.9+ is installed on your system. You can check thi
# Step 3: Clone the repository to your local machine, and install it.
git clone https://github.com/geekan/metagpt
cd metagpt
python setup.py install
pip install -e.
```
**Note:**
@ -91,7 +91,7 @@ # Step 3: Clone the repository to your local machine, and install it.
MMDC: "./node_modules/.bin/mmdc"
```
- if `python setup.py install` fails with error `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`, try instead running `python setup.py install --user`
- 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.

View file

@ -61,7 +61,7 @@ # 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下
# 第 3 步:克隆仓库到您的本地机器,并进行安装。
git clone https://github.com/geekan/metagpt
cd metagpt
python setup.py install
pip install -e.
```
**注意:**
@ -81,7 +81,7 @@ # 第 3 步:克隆仓库到您的本地机器,并进行安装。
MMDC: "./node_modules/.bin/mmdc"
```
- 如果`python setup.py install`失败并显示错误`[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`,请尝试使用`python setup.py install --user`运行。
- 如果`pip install -e.`失败并显示错误`[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`,请尝试使用`pip install -e. --user`运行。
### Docker安装
@ -136,10 +136,10 @@ # 复制配置文件并进行必要的修改
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" |
| 变量名 | 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" |
## 示例:启动一个创业公司

View file

@ -65,7 +65,7 @@ # ステップ 2: Python 3.9+ がシステムにインストールされてい
# ステップ 3: リポジトリをローカルマシンにクローンし、インストールする。
git clone https://github.com/geekan/metagpt
cd metagpt
python setup.py install
pip install -e.
```
**注:**
@ -86,7 +86,7 @@ # ステップ 3: リポジトリをローカルマシンにクローンし、
MMDC: "./node_modules/.bin/mmdc"
```
- もし `python setup.py install` がエラー `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'` で失敗したら、代わりに `python setup.py install --user` を実行してみてください
- もし `pip install -e.` がエラー `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'` で失敗したら、代わりに `pip install -e. --user` を実行してみてください
### Docker によるインストール
@ -141,10 +141,10 @@ # 設定ファイルをコピーし、必要な修正を加える。
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" |
| 変数名 | 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" |
## チュートリアル: スタートアップの開始

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/4/24 22:26
# @Author : alexanderwu
# @File : __init__.py
from metagpt import _compat as _ # noqa: F401

15
metagpt/_compat.py Normal file
View file

@ -0,0 +1,15 @@
import platform
import sys
import warnings
if sys.implementation.name == "cpython" and platform.system() == "Windows" and sys.version_info[:2] == (3, 9):
# https://github.com/python/cpython/pull/92842
from asyncio.proactor_events import _ProactorBasePipeTransport
def pacth_del(self, _warn=warnings.warn):
if self._sock is not None:
_warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
self._sock.close()
_ProactorBasePipeTransport.__del__ = pacth_del

View file

@ -1,11 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import platform
import fire
from metagpt.roles import Architect, Engineer, ProductManager
from metagpt.roles import ProjectManager, QaEngineer
from metagpt.roles import (
Architect,
Engineer,
ProductManager,
ProjectManager,
QaEngineer,
)
from metagpt.software_company import SoftwareCompany
@ -15,15 +20,17 @@ async def startup(
n_round: int = 5,
code_review: bool = False,
run_tests: bool = False,
implement: bool = True
implement: bool = True,
):
"""Run a startup. Be a boss."""
company = SoftwareCompany()
company.hire([
ProductManager(),
Architect(),
ProjectManager(),
])
company.hire(
[
ProductManager(),
Architect(),
ProjectManager(),
]
)
# if implement or code_review
if implement or code_review:
@ -46,7 +53,7 @@ def main(
n_round: int = 5,
code_review: bool = True,
run_tests: bool = False,
implement: bool = True
implement: bool = True,
):
"""
We are a software startup comprised of AI. By investing in us,
@ -58,12 +65,8 @@ def main(
:param code_review: Whether to use code review.
:return:
"""
if platform.system() == "Windows":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(startup(idea, investment, n_round,
code_review, run_tests, implement))
asyncio.run(startup(idea, investment, n_round, code_review, run_tests, implement))
if __name__ == '__main__':
if __name__ == "__main__":
fire.Fire(main)