莘权 马 commited on
Commit
3bb4c79
1 Parent(s): db06981

feat: base on metagpt v0.6.1

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .agent-store-config.yaml +8 -0
  2. .agent-store-config.yaml.example +9 -0
  3. .dockerignore +7 -0
  4. .gitattributes +7 -0
  5. .gitignore +171 -0
  6. .pre-commit-config.yaml +27 -0
  7. Dockerfile +32 -0
  8. LICENSE +21 -0
  9. README.md +143 -6
  10. agent/roles/__init__.py +2 -0
  11. agent/roles/software_company.py +313 -0
  12. agent/static/cy_aps/assets/__commonjsHelpers__-042e6b4d.js +1 -0
  13. agent/static/cy_aps/assets/bigTexCard-be1474a9.svg +3 -0
  14. agent/static/cy_aps/assets/blacklogo-ead63efd.svg +3 -0
  15. agent/static/cy_aps/assets/btn0-e612db37.png +3 -0
  16. agent/static/cy_aps/assets/btn1-25da2f4c.png +3 -0
  17. agent/static/cy_aps/assets/btn2-d21834a1.png +3 -0
  18. agent/static/cy_aps/assets/btn3-cf765453.png +3 -0
  19. agent/static/cy_aps/assets/contributors-753a72cb.png +3 -0
  20. agent/static/cy_aps/assets/example-c23c1e5e.mp4 +3 -0
  21. agent/static/cy_aps/assets/example-ce12f6a4.png +3 -0
  22. agent/static/cy_aps/assets/favicon-beef0aa9.ico +3 -0
  23. agent/static/cy_aps/assets/home-0791050d.js +0 -0
  24. agent/static/cy_aps/assets/index-5df855a0.js +1 -0
  25. agent/static/cy_aps/assets/kanban-d6729062.png +3 -0
  26. agent/static/cy_aps/assets/login-684ccf2f.js +1 -0
  27. agent/static/cy_aps/assets/role0-73c01153.png +3 -0
  28. agent/static/cy_aps/assets/role1-8fd25a72.png +3 -0
  29. agent/static/cy_aps/assets/role2-d49c6a81.png +3 -0
  30. agent/static/cy_aps/assets/role3-d2c54a2d.png +3 -0
  31. agent/static/cy_aps/assets/role4-a6ccbb5f.png +3 -0
  32. agent/static/cy_aps/assets/role5-16fddacc.png +3 -0
  33. agent/static/cy_aps/assets/role6-c9a82246.png +3 -0
  34. agent/static/cy_aps/assets/roundLogo-a63958eb.png +3 -0
  35. agent/static/cy_aps/assets/sparkles-50d190d6.svg +3 -0
  36. agent/static/cy_aps/assets/style-86c4771e.css +0 -0
  37. agent/static/cy_aps/assets/vendor-4cd7d240.js +0 -0
  38. agent/static/cy_aps/assets/vue-e0bc46a9.js +0 -0
  39. agent/static/cy_aps/assets/wechat-4dad209c.png +3 -0
  40. agent/static/index.html +22 -0
  41. agent/web/app.py +223 -0
  42. config/config.yaml +145 -0
  43. config/puppeteer-config.json +6 -0
  44. docs/FAQ-EN.md +183 -0
  45. docs/README_CN.md +135 -0
  46. docs/README_JA.md +334 -0
  47. docs/ROADMAP.md +84 -0
  48. docs/install/cli_install.md +109 -0
  49. docs/install/cli_install_cn.md +43 -0
  50. docs/install/docker_install.md +44 -0
.agent-store-config.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ role:
2
+ name: SoftwareCompany
3
+ module: metagpt.roles.software_company
4
+ skills:
5
+ - name: WritePRD
6
+ - name: WriteDesign
7
+ - name: WriteTasks
8
+ - name: WriteCode
.agent-store-config.yaml.example ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ role:
2
+ name: Teacher # Referenced the `Teacher` in `metagpt/roles/teacher.py`.
3
+ module: metagpt.roles.teacher # Referenced `metagpt/roles/teacher.py`.
4
+ skills: # Refer to the skill `name` of the published skill in `.well-known/skills.yaml`.
5
+ - name: text_to_speech
6
+ description: Text-to-speech
7
+ - name: text_to_image
8
+ description: Create a drawing based on the text.
9
+
.dockerignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ workspace
2
+ tmp
3
+ build
4
+ workspace
5
+ dist
6
+ data
7
+ geckodriver.log
.gitattributes CHANGED
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ metagpt/static/assets/example-1902a4ef.png filter=lfs diff=lfs merge=lfs -text
37
+ *.png filter=lfs diff=lfs merge=lfs -text
38
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ *.svg filter=lfs diff=lfs merge=lfs -text
40
+ *.jpg filter=lfs diff=lfs merge=lfs -text
41
+ *.ico filter=lfs diff=lfs merge=lfs -text
42
+ *.html linguist-detectable=false
.gitignore ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Python template
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ share/python-wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python scripts from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
100
+ __pypackages__/
101
+
102
+ # Celery stuff
103
+ celerybeat-schedule
104
+ celerybeat.pid
105
+
106
+ # SageMath parsed files
107
+ *.sage.py
108
+
109
+ # Environments
110
+ .env
111
+ .venv
112
+ env/
113
+ venv/
114
+ ENV/
115
+ env.bak/
116
+ venv.bak/
117
+
118
+ # Spyder project settings
119
+ .spyderproject
120
+ .spyproject
121
+
122
+ # Rope project settings
123
+ .ropeproject
124
+
125
+ # mkdocs documentation
126
+ /site
127
+
128
+ # mypy
129
+ .mypy_cache/
130
+ .dmypy.json
131
+ dmypy.json
132
+
133
+ # Pyre type checker
134
+ .pyre/
135
+
136
+ # pytype static type analyzer
137
+ .pytype/
138
+
139
+ # Cython debug symbols
140
+ cython_debug/
141
+
142
+ # report
143
+ allure-report
144
+ allure-results
145
+
146
+ # idea
147
+ .idea
148
+ .DS_Store
149
+ .vscode
150
+
151
+
152
+ *.txt
153
+ docs/scripts/set_env.sh
154
+ key.yaml
155
+ output.json
156
+ data
157
+ data/output_add.json
158
+ data.ms
159
+ examples/nb/
160
+ .chroma
161
+ *~$*
162
+ workspace/*
163
+ *.mmd
164
+ tmp
165
+ output.wav
166
+ *.bak
167
+
168
+ # output folder
169
+ output
170
+ tmp.png
171
+
.pre-commit-config.yaml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_stages: [ commit ]
2
+
3
+ # Install
4
+ # 1. pip install pre-commit
5
+ # 2. pre-commit install(the first time you download the repo, it will be cached for future use)
6
+ repos:
7
+ - repo: https://github.com/pycqa/isort
8
+ rev: 5.11.5
9
+ hooks:
10
+ - id: isort
11
+ args: ['--profile', 'black']
12
+ exclude: >-
13
+ (?x)^(
14
+ .*__init__\.py$
15
+ )
16
+
17
+ - repo: https://github.com/astral-sh/ruff-pre-commit
18
+ # Ruff version.
19
+ rev: v0.0.284
20
+ hooks:
21
+ - id: ruff
22
+
23
+ - repo: https://github.com/psf/black
24
+ rev: 23.3.0
25
+ hooks:
26
+ - id: black
27
+ args: ['--line-length', '120']
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a base image with Python3.9 and Nodejs20 slim version
2
+ FROM nikolaik/python-nodejs:python3.9-nodejs20-slim
3
+
4
+ USER root
5
+
6
+ # Install Debian software needed by MetaGPT and clean up in one RUN command to reduce image size
7
+ RUN apt update &&\
8
+ apt install -y libgomp1 git chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends &&\
9
+ apt clean && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Install Mermaid CLI globally
12
+ ENV CHROME_BIN="/usr/bin/chromium" \
13
+ PUPPETEER_CONFIG="/app/metagpt/config/puppeteer-config.json"\
14
+ PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
15
+ RUN npm install -g @mermaid-js/mermaid-cli &&\
16
+ npm cache clean --force
17
+
18
+ # Install Python dependencies and install MetaGPT
19
+ COPY requirements.txt requirements.txt
20
+
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ COPY . /app/metagpt
24
+ WORKDIR /app/metagpt
25
+ RUN mkdir logs &&\
26
+ chmod -R 777 /app/metagpt/logs/ &&\
27
+ mkdir workspace &&\
28
+ chmod -R 777 /app/metagpt/workspace/ &&\
29
+ python -m pip install -e.
30
+
31
+
32
+ CMD ["python", "metagpt/web/app.py"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License
2
+
3
+ Copyright (c) Chenglin Wu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
README.md CHANGED
@@ -1,11 +1,148 @@
1
  ---
2
- title: MG
3
- emoji: 📉
4
- colorFrom: red
5
- colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
- license: mit
9
  ---
10
 
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: MetaGPT
3
+ emoji: 🐼
4
+ colorFrom: green
5
+ colorTo: blue
6
  sdk: docker
7
+ app_file: app.py
8
  pinned: false
 
9
  ---
10
 
11
+ # MetaGPT: The Multi-Agent Framework
12
+
13
+ <p align="center">
14
+ <a href=""><img src="docs/resources/MetaGPT-new-log.png" alt="MetaGPT logo: Enable GPT to work in software company, collaborating to tackle more complex tasks." width="150px"></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <b>Assign different roles to GPTs to form a collaborative software entity for complex tasks.</b>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
23
+ <a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
24
+ <a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
25
+ <a href="https://discord.gg/DYn29wFk9z"><img src="https://dcbadge.vercel.app/api/server/DYn29wFk9z?style=flat" alt="Discord Follow"></a>
26
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
27
+ <a href="docs/ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>
28
+ <a href="https://twitter.com/MetaGPT_"><img src="https://img.shields.io/twitter/follow/MetaGPT?style=social" alt="Twitter Follow"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/geekan/MetaGPT"><img src="https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode" alt="Open in Dev Containers"></a>
33
+ <a href="https://codespaces.new/geekan/MetaGPT"><img src="https://img.shields.io/badge/Github_Codespace-Open-blue?logo=github" alt="Open in GitHub Codespaces"></a>
34
+ <a href="https://huggingface.co/spaces/deepwisdom/MetaGPT" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20-Hugging%20Face-blue?color=blue&logoColor=white" /></a>
35
+ </p>
36
+
37
+ 1. MetaGPT takes a **one line requirement** as input and outputs **user stories / competitive analysis / requirements / data structures / APIs / documents, etc.**
38
+ 2. Internally, MetaGPT includes **product managers / architects / project managers / engineers.** It provides the entire process of a **software company along with carefully orchestrated SOPs.**
39
+ 1. `Code = SOP(Team)` is the core philosophy. We materialize SOP and apply it to teams composed of LLMs.
40
+
41
+ ![A software company consists of LLM-based roles](docs/resources/software_company_cd.jpeg)
42
+
43
+ <p align="center">Software Company Multi-Role Schematic (Gradually Implementing)</p>
44
+
45
+
46
+
47
+ ## Install
48
+
49
+ ### Pip installation
50
+
51
+ ```bash
52
+ # Step 1: Ensure that Python 3.9+ is installed on your system. You can check this by using:
53
+ # You can use conda to initialize a new python env
54
+ # conda create -n metagpt python=3.9
55
+ # conda activate metagpt
56
+ python3 --version
57
+
58
+ # Step 2: Clone the repository to your local machine for latest version, and install it.
59
+ git clone https://github.com/geekan/MetaGPT.git
60
+ cd MetaGPT
61
+ pip3 install -e. # or pip3 install metagpt # for stable version
62
+
63
+ # Step 3: run the startup.py
64
+ # setup your OPENAI_API_KEY in key.yaml copy from config.yaml
65
+ python3 startup.py "Write a cli snake game"
66
+
67
+ # Step 4 [Optional]: If you want to save the artifacts like diagrams such as quadrant chart, system designs, sequence flow in the workspace, you can execute the step before Step 3. By default, the framework is compatible, and the entire process can be run completely without executing this step.
68
+ # If executing, 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.)
69
+ npm --version
70
+ sudo npm install -g @mermaid-js/mermaid-cli
71
+ ```
72
+
73
+ detail installation please refer to [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version)
74
+
75
+ ### Docker installation
76
+ > 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"
77
+
78
+ ```bash
79
+ # Step 1: Download metagpt official image and prepare config.yaml
80
+ docker pull metagpt/metagpt:latest
81
+ mkdir -p /opt/metagpt/{config,workspace}
82
+ docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
83
+ vim /opt/metagpt/config/key.yaml # Change the config
84
+
85
+ # Step 2: Run metagpt demo with container
86
+ docker run --rm \
87
+ --privileged \
88
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
89
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
90
+ metagpt/metagpt:latest \
91
+ python startup.py "Write a cli snake game"
92
+ ```
93
+
94
+ detail installation please refer to [docker_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-with-docker)
95
+
96
+ ### QuickStart & Demo Video
97
+ - Try it on [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT)
98
+ - [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY)
99
+ - [Official Demo Video](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d)
100
+
101
+ https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419
102
+
103
+ ## Tutorial
104
+
105
+ - 🗒 [Online Document](https://docs.deepwisdom.ai/)
106
+ - 💻 [Usage](https://docs.deepwisdom.ai/guide/get_started/quickstart.html)
107
+ - 🔎 [What can MetaGPT do?](https://docs.deepwisdom.ai/guide/get_started/introduction.html)
108
+ - 🛠 How to build your own agents?
109
+ - [MetaGPT Usage & Development Guide | Agent 101](https://docs.deepwisdom.ai/guide/tutorials/agent_101.html)
110
+ - [MetaGPT Usage & Development Guide | MultiAgent 101](https://docs.deepwisdom.ai/guide/tutorials/multi_agent_101.html)
111
+ - 🧑‍💻 Contribution
112
+ - [Develop Roadmap](docs/ROADMAP.md)
113
+ - 🔖 Use Cases
114
+ - [Debate](https://docs.deepwisdom.ai/guide/use_cases/multi_agent/debate.html)
115
+ - [Researcher](https://docs.deepwisdom.ai/guide/use_cases/agent/researcher.html)
116
+ - [Recepit Assistant](https://docs.deepwisdom.ai/guide/use_cases/agent/receipt_assistant.html)
117
+ - ❓ [FAQs](https://docs.deepwisdom.ai/guide/faq.html)
118
+
119
+ ## Support
120
+
121
+ ### Discard Join US
122
+ 📢 Join Our [Discord Channel](https://discord.gg/ZRHeExS6xv)!
123
+
124
+ Looking forward to seeing you there! 🎉
125
+
126
+ ### Contact Information
127
+
128
+ If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!
129
+
130
+ - **Email:** [email protected]
131
+ - **GitHub Issues:** For more technical inquiries, you can also create a new issue in our [GitHub repository](https://github.com/geekan/metagpt/issues).
132
+
133
+ We will respond to all questions within 2-3 business days.
134
+
135
+ ## Citation
136
+
137
+ For now, cite the [arXiv paper](https://arxiv.org/abs/2308.00352):
138
+
139
+ ```bibtex
140
+ @misc{hong2023metagpt,
141
+ title={MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework},
142
+ author={Sirui Hong and Mingchen Zhuge and Jonathan Chen and Xiawu Zheng and Yuheng Cheng and Ceyao Zhang and Jinlin Wang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu and Jürgen Schmidhuber},
143
+ year={2023},
144
+ eprint={2308.00352},
145
+ archivePrefix={arXiv},
146
+ primaryClass={cs.AI}
147
+ }
148
+ ```
agent/roles/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
agent/roles/software_company.py ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ from pathlib import Path
4
+
5
+ import aiofiles
6
+ from aiobotocore.session import get_session
7
+ from mdutils.mdutils import MdUtils
8
+ from metagpt.actions import Action, WriteCodeReview
9
+ from metagpt.actions.design_api import WriteDesign
10
+ from metagpt.actions.prepare_documents import PrepareDocuments
11
+ from metagpt.actions.project_management import WriteTasks
12
+ from metagpt.actions.summarize_code import SummarizeCode
13
+ from metagpt.actions.write_code import WriteCode
14
+ from metagpt.actions.write_prd import WritePRD
15
+ from metagpt.config import CONFIG
16
+ from metagpt.const import (
17
+ CODE_SUMMARIES_FILE_REPO,
18
+ COMPETITIVE_ANALYSIS_FILE_REPO,
19
+ DATA_API_DESIGN_FILE_REPO,
20
+ DOCS_FILE_REPO,
21
+ PRDS_FILE_REPO,
22
+ REQUIREMENT_FILENAME,
23
+ SEQ_FLOW_FILE_REPO,
24
+ SYSTEM_DESIGN_FILE_REPO,
25
+ TASK_FILE_REPO,
26
+ )
27
+ from metagpt.environment import Environment
28
+ from metagpt.roles import Architect, Engineer, ProductManager, ProjectManager, Role
29
+ from metagpt.schema import Message, MessageQueue
30
+ from metagpt.team import Team
31
+ from metagpt.utils.common import any_to_str, is_subscribed
32
+ from metagpt.utils.file_repository import FileRepository
33
+ from pydantic import Field
34
+ from zipstream import AioZipStream
35
+
36
+
37
+ class RoleRun(Action):
38
+ role: Role
39
+ desc: str # f"{role.profile} {role.todo}"
40
+
41
+
42
+ class SoftwareCompanyEnv(Environment):
43
+ buf: MessageQueue = Field(default_factory=MessageQueue)
44
+ peek_buf: MessageQueue = Field(default_factory=MessageQueue)
45
+
46
+ def publish_message(self, message: Message, peekable: bool = True) -> bool:
47
+ self.buf.push(msg=message)
48
+ if peekable:
49
+ self.peek_buf.push(msg=message)
50
+ return True
51
+
52
+ def peek_messages(self):
53
+ return self.peek_buf.pop_all()
54
+
55
+ def get_message(self):
56
+ return self.buf.pop()
57
+
58
+
59
+ class SoftwareCompany(Role):
60
+ """封装软件公司成角色,以快速接入agent store。"""
61
+
62
+ company: Team = Field(default_factory=Team)
63
+
64
+ def __init__(self, **kwargs):
65
+ super().__init__(**kwargs)
66
+ self.company.env = SoftwareCompanyEnv()
67
+ self.company.hire([ProductManager(), Architect(), ProjectManager(), Engineer(n_borg=5)])
68
+
69
+ async def _think(self) -> bool:
70
+ """软件公司运行需要4轮
71
+
72
+ BOSS -> ProductManager -> Architect -> ProjectManager -> Engineer
73
+ BossRequirement -> WritePRD -> WriteDesign -> WriteTasks -> WriteCode
74
+ """
75
+ while msg := self.company.env.get_message():
76
+ for role in self.company.env.roles.values():
77
+ if not is_subscribed(message=msg, tags=role.subscription) or not role.is_watch(caused_by=msg.cause_by):
78
+ continue
79
+ role.put_message(message=msg)
80
+ self.rc.todo = RoleRun(role=role, desc=f"{role.profile} {role.todo}")
81
+ return True
82
+ self.rc.todo = None
83
+ return False
84
+
85
+ async def _act(self) -> Message:
86
+ await self.company.run(1, auto_archive=False)
87
+ msgs = self.company.env.peek_messages()
88
+ mappings = {
89
+ any_to_str(PrepareDocuments): self.format_requirements,
90
+ any_to_str(WritePRD): self.format_prd,
91
+ any_to_str(WriteDesign): self.format_system_design,
92
+ any_to_str(WriteTasks): self.format_task,
93
+ any_to_str(WriteCode): self.format_code,
94
+ any_to_str(WriteCodeReview): self.format_code,
95
+ any_to_str(SummarizeCode): self.format_summarize_code,
96
+ }
97
+ for msg in msgs:
98
+ func = mappings.get(msg.cause_by)
99
+ if not func:
100
+ continue
101
+ output = await func(msg)
102
+ return output
103
+
104
+ async def format_requirements(self, msg: Message):
105
+ mdfile = MdUtils("")
106
+ doc = await FileRepository.get_file(filename=REQUIREMENT_FILENAME, relative_path=DOCS_FILE_REPO)
107
+ mdfile.new_header(2, "New Requirements", add_table_of_contents="n")
108
+ mdfile.new_paragraph(text=doc.content)
109
+ return Message(mdfile.get_md_text(), cause_by=msg.cause_by, role=msg.role)
110
+
111
+ async def format_summarize_code(self, msg: Message):
112
+ mdfile = MdUtils("")
113
+ docs = await FileRepository.get_all_files(relative_path=CODE_SUMMARIES_FILE_REPO)
114
+ if not docs:
115
+ mdfile.new_header(2, "Code Summaries", add_table_of_contents="n")
116
+ mdfile.new_paragraph(text="Pass.")
117
+ return Message(mdfile.get_md_text(), cause_by=msg.cause_by, role=msg.role)
118
+
119
+ ix = 0
120
+ for doc in docs:
121
+ if ix > 0:
122
+ mdfile.new_line("---")
123
+ ix += 1
124
+ mdfile.new_header(1, "RID:" + str(Path(doc.filename).with_suffix("")), add_table_of_contents="n")
125
+ data = json.loads(doc.content)
126
+ mdfile.new_header(2, "File names", add_table_of_contents="n")
127
+ mdfile.new_list(data.get("codes_filenames", []))
128
+
129
+ mdfile.new_header(2, "Summary", add_table_of_contents="n")
130
+ mdfile.insert_code(data.get("reason", ""), "json")
131
+ return Message(mdfile.get_md_text(), cause_by=msg.cause_by, role=msg.role)
132
+
133
+ async def format_prd(self, prd: Message):
134
+ mdfile = MdUtils("")
135
+ docs = await FileRepository.get_all_files(relative_path=PRDS_FILE_REPO)
136
+ ix = 0
137
+ for doc in docs:
138
+ filename = Path(doc.filename)
139
+ if ix > 0:
140
+ mdfile.new_line("---")
141
+ ix += 1
142
+ mdfile.new_header(1, "RID:" + str(filename.with_suffix("")), add_table_of_contents="n")
143
+
144
+ data = json.loads(doc.content)
145
+ for title, content in data.items():
146
+ if title == "Competitive Analysis":
147
+ mdfile.new_header(2, title, add_table_of_contents="n")
148
+ if all(i.count(":") == 1 for i in content):
149
+ mdfile.new_table(
150
+ 2,
151
+ len(content) + 1,
152
+ ["Competitor", "Description", *(i for j in content for i in j.split(":"))],
153
+ )
154
+ else:
155
+ mdfile.new_list(content, marked_with="1")
156
+ elif title == "Competitive Quadrant Chart":
157
+ mdfile.new_header(2, title, add_table_of_contents="n")
158
+ competitive_analysis_path = (
159
+ CONFIG.git_repo.workdir / COMPETITIVE_ANALYSIS_FILE_REPO / filename.with_suffix(".png")
160
+ )
161
+ if not await self._add_s3_url(md_file=mdfile, title=title, pathname=competitive_analysis_path):
162
+ mdfile.insert_code(content, "mermaid")
163
+ elif title == "Requirement Pool":
164
+ mdfile.new_header(2, title, add_table_of_contents="n")
165
+ mdfile.new_table(
166
+ 2, len(content) + 1, ["Task Description", "Priority", *(i for j in content for i in j)]
167
+ )
168
+ elif isinstance(content, list):
169
+ mdfile.new_header(2, title, add_table_of_contents="n")
170
+ mdfile.new_list(content, marked_with="1")
171
+ else:
172
+ mdfile.new_header(2, title, add_table_of_contents="n")
173
+ mdfile.new_paragraph(content)
174
+ return Message(mdfile.get_md_text(), cause_by=prd.cause_by, role=prd.role)
175
+
176
+ async def format_system_design(self, design: Message):
177
+ mdfile = MdUtils("")
178
+ docs = await FileRepository.get_all_files(relative_path=SYSTEM_DESIGN_FILE_REPO)
179
+ ix = 0
180
+ for doc in docs:
181
+ filename = Path(doc.filename)
182
+ if ix > 0:
183
+ mdfile.new_line("---")
184
+ ix += 1
185
+ mdfile.new_header(1, "RID:" + str(filename.with_suffix("")), add_table_of_contents="n")
186
+
187
+ data = json.loads(doc.content)
188
+ for title, content in data.items():
189
+ if title == "Project name":
190
+ mdfile.new_header(2, title, add_table_of_contents="n")
191
+ mdfile.insert_code(content, "python")
192
+ elif title == "Data structures and interfaces":
193
+ mdfile.new_header(2, title, add_table_of_contents="n")
194
+ data_api_design_path = (
195
+ CONFIG.git_repo.workdir / DATA_API_DESIGN_FILE_REPO / filename.with_suffix(".png")
196
+ )
197
+ if not await self._add_s3_url(md_file=mdfile, title=title, pathname=data_api_design_path):
198
+ mdfile.insert_code(content, "mermaid")
199
+ elif title == "Program call flow":
200
+ mdfile.new_header(2, title, add_table_of_contents="n")
201
+ seq_flow_path = CONFIG.git_repo.workdir / SEQ_FLOW_FILE_REPO / filename.with_suffix(".png")
202
+ if not await self._add_s3_url(md_file=mdfile, title=title, pathname=seq_flow_path):
203
+ mdfile.insert_code(content, "mermaid")
204
+ elif isinstance(content, list):
205
+ mdfile.new_header(2, title, add_table_of_contents="n")
206
+ mdfile.new_list(content, marked_with="1")
207
+ else:
208
+ mdfile.new_header(2, title, add_table_of_contents="n")
209
+ mdfile.new_paragraph(content)
210
+ return Message(mdfile.get_md_text(), cause_by=design.cause_by, role=design.role)
211
+
212
+ async def format_task(self, task: Message):
213
+ mdfile = MdUtils("")
214
+ docs = await FileRepository.get_all_files(relative_path=TASK_FILE_REPO)
215
+ ix = 0
216
+ for doc in docs:
217
+ filename = Path(doc.filename)
218
+ if ix > 0:
219
+ mdfile.new_line("---")
220
+ ix += 1
221
+ mdfile.new_header(1, "RID:" + str(filename.with_suffix("")), add_table_of_contents="n")
222
+
223
+ data = json.loads(doc.content)
224
+ for title, content in data.items():
225
+ if title in {
226
+ "Required Python third-party packages",
227
+ "Required Other language third-party packages",
228
+ "Task list",
229
+ }:
230
+ mdfile.new_header(2, title, add_table_of_contents="n")
231
+ mdfile.new_list(content)
232
+ elif title == "Full API spec":
233
+ mdfile.new_header(2, title, add_table_of_contents="n")
234
+ mdfile.insert_code(content, "text")
235
+ elif title == "Logic Analysis":
236
+ mdfile.new_header(2, title, add_table_of_contents="n")
237
+ mdfile.new_table(
238
+ 2, len(content) + 1, ["Filename", "Class/Function Name", *(i for j in content for i in j)]
239
+ )
240
+ elif title == "Shared Knowledge":
241
+ mdfile.new_header(2, title=title, add_table_of_contents="n")
242
+ mdfile.insert_code(content, "text")
243
+ elif isinstance(content, list):
244
+ mdfile.new_header(2, title, add_table_of_contents="n")
245
+ mdfile.new_list(content, marked_with="1")
246
+ else:
247
+ mdfile.new_header(2, title=title, add_table_of_contents="n")
248
+ mdfile.new_paragraph(text=content)
249
+ return Message(mdfile.get_md_text(), cause_by=task.cause_by, role=task.role)
250
+
251
+ async def format_code(self, code: Message):
252
+ mdfile = MdUtils("")
253
+ docs = await FileRepository.get_all_files(relative_path=CONFIG.src_workspace)
254
+ code_block_types = {
255
+ ".py": "python",
256
+ ".yaml": "yaml",
257
+ ".yml": "yaml",
258
+ ".json": "json",
259
+ ".js": "javascript",
260
+ ".sql": "sql",
261
+ }
262
+ for doc in docs:
263
+ mdfile.new_header(2, doc.filename, add_table_of_contents="n")
264
+ suffix = doc.filename.rsplit(".", maxsplit=1)[-1]
265
+ mdfile.insert_code(doc.content, code_block_types.get(suffix, "text"))
266
+ url = await self.upload()
267
+ mdfile.new_header(2, "Project Packaging Complete", add_table_of_contents="n")
268
+ mdfile.new_paragraph(
269
+ "We are thrilled to inform you that our project has been successfully packaged "
270
+ "and is ready for download and use. You can download the packaged project through"
271
+ f" the following link:\n[Project Download Link]({url})"
272
+ )
273
+ return Message(mdfile.get_md_text(), cause_by=code.cause_by, role=code.role)
274
+
275
+ async def upload_file_to_s3(self, filepath: str, key: str):
276
+ async with aiofiles.open(filepath, "rb") as f:
277
+ content = await f.read()
278
+ return await self.upload_to_s3(content, key)
279
+
280
+ async def upload_to_s3(self, content: bytes, key: str):
281
+ session = get_session()
282
+ async with session.create_client(
283
+ "s3",
284
+ aws_secret_access_key=os.getenv("S3_SECRET_KEY"),
285
+ aws_access_key_id=os.getenv("S3_ACCESS_KEY"),
286
+ endpoint_url=os.getenv("S3_ENDPOINT_URL"),
287
+ use_ssl=os.getenv("S3_SECURE"),
288
+ ) as client:
289
+ # upload object to amazon s3
290
+ bucket = os.getenv("S3_BUCKET")
291
+ await client.put_object(Bucket=bucket, Key=key, Body=content)
292
+ return f"{os.getenv('S3_ENDPOINT_URL')}/{bucket}/{key}"
293
+
294
+ async def upload(self):
295
+ files = []
296
+ all_filenames = CONFIG.git_repo.get_files(relative_path=".")
297
+ for filename in all_filenames:
298
+ full_path = CONFIG.git_repo.workdir / filename
299
+ files.append({"file": str(full_path), "name": str(filename)})
300
+ # aiozipstream
301
+ chunks = []
302
+ async for chunk in AioZipStream(files, chunksize=32768).stream():
303
+ chunks.append(chunk)
304
+ key = f"{CONFIG.workspace_path.name}/metagpt-{CONFIG.git_repo.workdir.name}.zip"
305
+ return await self.upload_to_s3(b"".join(chunks), key)
306
+
307
+ async def _add_s3_url(self, md_file: MdUtils, title: str, pathname: Path) -> bool:
308
+ if pathname.exists():
309
+ key = pathname.relative_to(CONFIG.workspace_path.parent)
310
+ url = await self.upload_file_to_s3(filepath=str(pathname), key=str(key))
311
+ md_file.new_line(md_file.new_inline_image(title, url))
312
+ return True
313
+ return False
agent/static/cy_aps/assets/__commonjsHelpers__-042e6b4d.js ADDED
@@ -0,0 +1 @@
 
 
1
+ var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var o=function n(){if(this instanceof n){var t=[null];t.push.apply(t,arguments);var u=Function.bind.apply(r,t);return new u}return r.apply(this,arguments)};o.prototype=r.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}),o}export{a,f as c,l as g};
agent/static/cy_aps/assets/bigTexCard-be1474a9.svg ADDED

Git LFS Details

  • SHA256: be1474a92e5ee1a0faf5a29a95da64ccbde62d6b4bb0722eb1151cffa2d8f25d
  • Pointer size: 129 Bytes
  • Size of remote file: 2.77 kB
agent/static/cy_aps/assets/blacklogo-ead63efd.svg ADDED

Git LFS Details

  • SHA256: ead63efd7a6e23d6c998b696fb78e8dda7039b5a54695f77005eb9ec4083f3e9
  • Pointer size: 129 Bytes
  • Size of remote file: 5.32 kB
agent/static/cy_aps/assets/btn0-e612db37.png ADDED

Git LFS Details

  • SHA256: e612db371f4bf5fb40ce44b4bf4b77364422924f762b898d9e250074b0423306
  • Pointer size: 129 Bytes
  • Size of remote file: 4.79 kB
agent/static/cy_aps/assets/btn1-25da2f4c.png ADDED

Git LFS Details

  • SHA256: 25da2f4cf7929a1b056c2870bf0892200d4fed7e37ef8e5181c398fc705088ef
  • Pointer size: 129 Bytes
  • Size of remote file: 6.63 kB
agent/static/cy_aps/assets/btn2-d21834a1.png ADDED

Git LFS Details

  • SHA256: d21834a1bb77e4dc8bbbd69cf8b124e97bebc779cb9866b6f8ea9ee64434aca2
  • Pointer size: 129 Bytes
  • Size of remote file: 5.21 kB
agent/static/cy_aps/assets/btn3-cf765453.png ADDED

Git LFS Details

  • SHA256: cf7654533e5892036a7c9d6671da5a7380fcdc8afa215ecf7fa449d8d50b10ba
  • Pointer size: 129 Bytes
  • Size of remote file: 6.11 kB
agent/static/cy_aps/assets/contributors-753a72cb.png ADDED

Git LFS Details

  • SHA256: 753a72cb5284ad76c7176475e3e86f233ffd0dd81610dd39079a6d2c840cb5fe
  • Pointer size: 131 Bytes
  • Size of remote file: 122 kB
agent/static/cy_aps/assets/example-c23c1e5e.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c23c1e5e721d05c000d3cae32e33c3883b7736b9e059a674dc6a2093c24ba4fd
3
+ size 14430374
agent/static/cy_aps/assets/example-ce12f6a4.png ADDED

Git LFS Details

  • SHA256: ce12f6a4685ccbfe96416f527892afad06b17e2627e79a203c9433d0340990f7
  • Pointer size: 130 Bytes
  • Size of remote file: 87.4 kB
agent/static/cy_aps/assets/favicon-beef0aa9.ico ADDED

Git LFS Details

  • SHA256: beef0aa93bd461d89fe8d5613ca9328b3173a6747a860891f968e940554cdd8b
  • Pointer size: 130 Bytes
  • Size of remote file: 17 kB
agent/static/cy_aps/assets/home-0791050d.js ADDED
The diff for this file is too large to render. See raw diff
 
agent/static/cy_aps/assets/index-5df855a0.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{c as T,Y as re,Z as ce,r as ae,_ as ie,d as le,m as ue,f as de,p as fe,q as me,$ as I,v as ge,a0 as R}from"./vue-e0bc46a9.js";import{c as pe,l as he,a as ve,b as H,M as J,t as ye,d as be,C as Se,S as N,o as j,e as P,f as we}from"./vendor-4cd7d240.js";import"./__commonjsHelpers__-042e6b4d.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();const _e={},Ce=new Proxy(_e,{get(e,t){return e[t]||t}}),ke={},Le=new Proxy(ke,{get(e,t){return!t.toString().startsWith("__v_")&&e[t],e[t]}}),Oe={"zh-CN":he,"en-US":ve},E={"zh-CN":"zh-CN","en-US":"en-US"};let x="lang";const Re="zh-CN";try{x=localStorage==null?void 0:localStorage.getItem(x)}catch{console.warn("[Client]:localStorage is not available.")}const Ee=Re,_=pe({locale:E[Ee],fallbackLocale:E["zh-CN"],messages:{"zh-CN":Ce,"en-US":Le}}),st=(e,t={})=>`${_.global.t(e,t)}`,xe=e=>{if(E[e]){_.global.locale=e;try{localStorage==null||localStorage.setItem(x,e)}catch{console.warn("[Client]:localStorage is not available.")}window.location.reload()}},Ae=()=>{const e=T(()=>_.global.locale);return{setLang:xe,lang:e}},qe=T(()=>Oe[_.global.locale]),y={error:-1,success:[0,200,204],needAuthorization:401,notFound:404,notAllowed:[403,1403],needRequest:202,needMessage:[208,1e3]},U=()=>{let e=()=>{};const t=new Promise(r=>{e=r});return[e,t]},{CancelToken:Y}=H,D=Math.random().toString().slice(2),Te=1*60*1e3,Me="/api";let k;const Ie=()=>{k==null||k();const{close:e}=J.error("登录失效,请重新登录!");k=e};let Z=Y.source();const Ne=()=>{Z=Y.source()},je=H.create({baseURL:Me,timeout:Te}),z=e=>y.success.includes(+e),Q=async e=>{const{getToken:t,logout:r}=ee(),{lang:n}=Ae(),s=Z;e.cancelToken=e.cancelToken||s.token;let o=!1;e.headers=e.headers||{},t()&&(e.headers.Authorization=t()),e.headers.lang=n.value;const a=i=>{const{data:c}=i,[u,h]=U(),f=new FileReader;return f.readAsText(c,"utf-8"),f.onload=()=>{var M;try{const C=JSON.parse(f.result);if(C){u(C);return}}catch(C){console.log(C)}const se=(M=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(i.headers["content-disposition"]))==null?void 0:M[1],ne=new Blob([c],{type:i.headers["content-type"]});u({code:y.success[0],data:{name:se,blob:ne},message:"",isRequestSuccess:!0})},h},l=(i,c)=>{var h;const{code:u}=i.data;(u===y.needAuthorization||((h=c==null?void 0:c.response)==null?void 0:h.status)===401)&&(o=!0,Ie(),s.cancel(D),Ne(),r())},m=e.responseType==="blob";function d(i){o||J.error(i||this.message)}try{const i=await je.request(e);let{data:c}=i;return m&&(c=await a(i)),l(i),c.message=c.message||c.msg||"",c.isRequestSuccess=z(c.code),c.showRequestErrorMessage=d.bind(c),c}catch(i){if(i.message===D){const[,f]=U();return f}const c=i.response;if(!c){const f={code:y.error,message:i.message,isRequestSuccess:!1};return f.showRequestErrorMessage=d.bind(f),f}let{data:u}=c;if(m&&(u=await a(c)),typeof u=="string"){const f={code:y.error,message:i.message||c.statusText,isRequestSuccess:!1};return f.showRequestErrorMessage=d.bind(f),f}l(c,i),u&&(u.message=u.message||u.msg||i.message||"",u.isRequestSuccess=z(u.code),u.showRequestErrorMessage=d.bind(u));const h={code:y.error,message:i.message,isRequestSuccess:!1};return h.showRequestErrorMessage=d.bind(h),Object.assign(h,u)}},nt=e=>Q({url:"/v1/user/login",method:"post",data:e}),Pe=()=>Q({url:"/v1/user/detail"});var b=(e=>(e.home="/static/index.html",e.login="/login",e.register="/register",e.notFound="/404",e.app="/app",e.appConfig="/app/config/:id",e.appCreate="/appCreate",e.library="/library",e.knowledge="/library/knowledge",e.history="/library/history",e.config="/config",e))(b||{}),A=(e=>(e.Admin="admin",e.SuperAdmin="super_admin",e.User="user",e))(A||{});const Ue="modulepreload",De=function(e){return"https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/"+e},B={},O=function(t,r,n){if(!r||r.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(r.map(o=>{if(o=De(o),o in B)return;B[o]=!0;const a=o.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!n)for(let i=s.length-1;i>=0;i--){const c=s[i];if(c.href===o&&(!a||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${l}`))return;const d=document.createElement("link");if(d.rel=a?"stylesheet":Ue,a||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),a)return new Promise((i,c)=>{d.addEventListener("load",i),d.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t())},ze=[{path:b.login,name:b.login,component:()=>O(()=>import("./login-684ccf2f.js"),["cy_aps/assets/login-684ccf2f.js","cy_aps/assets/vue-e0bc46a9.js","cy_aps/assets/vendor-4cd7d240.js","cy_aps/assets/__commonjsHelpers__-042e6b4d.js"])},{path:b.home,name:b.home,component:()=>O(()=>import("./home-0791050d.js"),["cy_aps/assets/home-0791050d.js","cy_aps/assets/vue-e0bc46a9.js","cy_aps/assets/vendor-4cd7d240.js","cy_aps/assets/__commonjsHelpers__-042e6b4d.js"]),meta:{showSideBar:!0,needLogin:!0}},{path:"/:pathMatch(.*)*",component:()=>O(()=>import("./home-0791050d.js"),["cy_aps/assets/home-0791050d.js","cy_aps/assets/vue-e0bc46a9.js","cy_aps/assets/vendor-4cd7d240.js","cy_aps/assets/__commonjsHelpers__-042e6b4d.js"])}],Be="/",X=re({history:ce(Be),routes:ze}),S=ae(),q="token",Fe=()=>localStorage.getItem(q)||"",F=e=>e?localStorage.setItem(q,e):localStorage.removeItem(q),ee=()=>{const e=async()=>{const{data:n,showRequestErrorMessage:s,isRequestSuccess:o}=await Pe();if(!o){s();return}S.value=n},t=async()=>{F(),S.value=void 0,X.push({name:b.login})},r=T(()=>{var n,s;return((n=S.value)==null?void 0:n.user_role)===A.Admin||((s=S.value)==null?void 0:s.user_role)===A.SuperAdmin});return{getUser:e,user:S,isAdmin:r,logout:t,setToken:F,getToken:Fe}},v=ie(null);function $e(){ee();const e=n=>{var o,a;if(!v.value)return;const s=()=>{var l;n(),(l=v.value)==null||l.off("connect",s)};(o=v.value)!=null&&o.connected?n():(a=v.value)==null||a.on("connect",s)};return{socket:v,onAndAutoOff:n=>{const s=Object.entries(n).reduce((o,[a,l])=>(o[a]=m=>{l(m)},o),{});ye(async()=>{for(const[o,a]of Object.entries(s))e(()=>{v.value.on(o,a)})}),be(async()=>{var o;for(const[a,l]of Object.entries(s))(o=v.value)==null||o.off(a,l)})},emit:(n,...s)=>{e(()=>{var o;(o=v.value)==null||o.emit(n,...s)})}}}const Ve=le({__name:"App",setup(e){return $e(),(t,r)=>{const n=ue("router-view");return de(),fe(I(Se),{locale:I(qe)},{default:me(()=>[ge(n)]),_:1},8,["locale"])}}});const te=(e,t)=>Object.prototype.toString.call(e)===t,Ke=e=>te(e,"[object Boolean]"),oe=e=>te(e,"[object Object]"),rt=e=>{var t,r;if((t=navigator==null?void 0:navigator.clipboard)!=null&&t.writeText)(r=navigator==null?void 0:navigator.clipboard)==null||r.writeText(e);else{const n=document.createElement("textarea");n.value=e,n.style.position="absolute",n.style.opacity="0",n.style.left="-999999px",n.style.top="-999999px",document.body.appendChild(n),n.focus(),n.select(),document.execCommand("copy")}},ct=e=>new TextDecoder("utf-8").decode(e),We=(e,t)=>oe(e)?t.every(r=>Object.hasOwn(e,r)):!1,Ge=e=>oe(e)&&We(e,["loading"]),$=e=>{const t={loading:!0,text:""};return Ke(e)?t.loading=e:Ge(e)?(t.loading=e.loading,t.text=e.text||""):(console.warn("please check v-loading binding, should be boolean or { loading: boolean; text: string; }"),t.loading=!!e),t},V="loadingDirectiveElement",K="fullScreen",w="posRelative",g=Symbol("vLoadingDirective"),p=Symbol("loadingSpinApp"),He={mounted:(e,t)=>{e.classList.remove(w);const n=window.getComputedStyle(e).position;if(e[g]&&(e[g].remove(),delete e[g]),e[p]&&(e[p].unmount(),delete e[p]),!t.value)return;const{loading:s,text:o}=$(t.value);if(!s)return;const a=t.arg==="fullScreen",l=document.createElement("div");l.classList.add(V),a&&l.classList.add(K);const m=R(N,{tip:o});m.mount(l),n==="static"&&e.classList.add(w),e[g]=l,e[p]=m,e.append(l)},updated:(e,t)=>{e.classList.remove(w);const n=window.getComputedStyle(e).position;if(e[g]&&(e[g].remove(),delete e[g]),e[p]&&(e[p].unmount(),delete e[p]),!t.value)return;const{loading:s,text:o}=$(t.value);if(!s)return;const a=t.arg==="fullScreen",l=document.createElement("div");l.classList.add(V),a&&l.classList.add(K);const m=R(N,{tip:o});m.mount(l),n==="static"&&e.classList.add(w),e[g]=l,e[p]=m,e.append(l)},unmounted:e=>{e.classList.remove(w),e[g]&&(e[g].remove(),delete e[g]),e[p]&&(e[p].unmount(),delete e[p])}},W=e=>typeof e=="function",L=Symbol("clickOutside"),G=e=>()=>{e()},Je={mounted:(e,t)=>{if(!W(t.value)){console.warn("v-clickoutside binding should be function");return}const r=G(t.value);e[L]=r,j("clickoutside",e,r)},updated:(e,t)=>{let r=e[L];if(r&&P("clickoutside",e,r),!W(t.value)){console.warn("v-clickoutside binding should be function");return}r=G(t.value),e[L]=r,j("clickoutside",e,r)},unmounted:e=>{const t=e[L];t&&P("clickoutside",e,t)}},Ye=e=>{e.directive("loading",He),e.directive("clickoutside",Je)},Ze={install:Ye};const Qe=R(Ve);Qe.use(we()).use(X).use(Ze).use(_).mount("#app");export{rt as C,b as P,ct as U,nt as l,st as t,ee as u};
agent/static/cy_aps/assets/kanban-d6729062.png ADDED

Git LFS Details

  • SHA256: d67290620e7ac04d785fe02ac125985074db890584fd475b56fc8442310d6a23
  • Pointer size: 131 Bytes
  • Size of remote file: 161 kB
agent/static/cy_aps/assets/login-684ccf2f.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{d as H,f as v,h as w,N as U,a1 as b,r as _,a as x,c as S,o as F,l,v as s,q as t,$ as e,u as i,t as n,a2 as T}from"./vue-e0bc46a9.js";import{t as h,u as R,P as V,l as q}from"./index-5df855a0.js";import{F as f,I as L,B as G,g as N,h as E,L as g,i as z}from"./vendor-4cd7d240.js";import"./__commonjsHelpers__-042e6b4d.js";const A={width:"111",height:"23",viewBox:"0 0 111 23",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I=U('<path fill-rule="evenodd" clip-rule="evenodd" d="M20.3557 17.1143C18.3798 20.1442 14.9605 22.147 11.0735 22.147C4.95777 22.147 0 17.1892 0 11.0735C0 4.95777 4.95777 0 11.0735 0C14.7962 0 18.0898 1.83697 20.0974 4.65391C19.6754 5.23439 19.2963 5.8095 18.9874 6.34413C18.615 6.98892 18.2368 8.23682 18.2368 8.23682C18.2368 8.23682 19.1135 6.73114 19.5206 6.13508C19.6982 5.87516 19.905 5.61105 20.0755 5.39339C20.1919 5.24472 20.2914 5.11768 20.353 5.02848L20.3557 5.03266C22.3316 2.00275 25.7508 0 29.6379 0C35.7536 0 40.7113 4.95777 40.7113 11.0735C40.7113 17.1892 35.7536 22.147 29.6379 22.147C25.9138 22.147 22.6191 20.3086 20.6117 17.4899C21.0337 16.9094 21.4128 16.3343 21.7217 15.7997C22.0942 15.1549 22.4723 13.907 22.4723 13.907C22.4723 13.907 21.5956 15.4127 21.1885 16.0087C21.0109 16.2687 20.8041 16.5328 20.6336 16.7505C20.5172 16.8991 20.4178 17.026 20.3562 17.1152C20.3561 17.1149 20.3559 17.1146 20.3557 17.1143ZM10.585 18.2387C12.5349 18.2387 14.2796 17.2247 15.4446 15.6288L18.2616 12.2261L18.2708 12.236C18.3855 12.0918 18.5037 11.9418 18.6252 11.7869L18.8823 11.4763C18.9135 11.4386 18.9398 11.3983 18.9612 11.3562C19.2186 11.0251 19.4873 10.6769 19.7636 10.3188L19.7645 10.3176C21.5496 8.00437 23.6531 5.27856 25.0782 4.07069C26.0327 3.26168 27.5208 2.2445 29.1493 2.11655C30.3663 1.94388 31.8366 2.08434 33.5461 2.76816C32.2433 1.9537 30.6821 1.66413 29.0024 1.7618C27.3226 1.85947 25.6832 2.72667 24.2639 3.745C22.8141 4.78522 20.9312 7.16948 18.7438 9.93939L18.5369 10.2013L15.6643 6.51091C14.5055 4.73266 12.6616 3.5826 10.585 3.5826C7.07741 3.5826 4.23398 6.86347 4.23398 10.9106C4.23398 14.9578 7.07741 18.2387 10.585 18.2387ZM30.1264 18.2387C28.1764 18.2387 26.4317 17.2247 25.2667 15.6288L22.1697 11.8877L21.9482 12.1681C19.7607 14.9381 17.8779 17.3223 16.428 18.3625C15.0087 19.3809 13.3693 20.2481 11.6896 20.3457C10.0099 20.4434 8.4486 20.1538 7.14583 19.3394C8.85539 20.0232 10.3256 20.1637 11.5427 19.991C13.1711 19.863 14.6593 18.8459 15.6138 18.0368C17.0389 16.829 19.1424 14.1031 20.9275 11.7899C21.463 11.0959 21.9699 10.4391 22.4212 9.87151L22.4266 9.87738L25.047 6.51091C26.2058 4.73266 28.0497 3.5826 30.1264 3.5826C33.6339 3.5826 36.4774 6.86347 36.4774 10.9106C36.4774 14.9578 33.6339 18.2387 30.1264 18.2387Z" fill="white"></path><mask id="mask0_3275_99396" style="mask-type:alpha;" maskUnits="userSpaceOnUse" x="0" y="0" width="41" height="23"><path fill-rule="evenodd" clip-rule="evenodd" d="M20.3557 17.1143C18.3798 20.1442 14.9605 22.147 11.0735 22.147C4.95777 22.147 0 17.1892 0 11.0735C0 4.95777 4.95777 0 11.0735 0C14.7962 0 18.0898 1.83697 20.0974 4.65391C19.6754 5.23439 19.2963 5.8095 18.9874 6.34413C18.615 6.98892 18.2368 8.23682 18.2368 8.23682C18.2368 8.23682 19.1135 6.73114 19.5206 6.13508C19.6982 5.87516 19.905 5.61105 20.0755 5.39339C20.1919 5.24472 20.2914 5.11768 20.353 5.02848L20.3557 5.03266C22.3316 2.00275 25.7508 0 29.6379 0C35.7536 0 40.7113 4.95777 40.7113 11.0735C40.7113 17.1892 35.7536 22.147 29.6379 22.147C25.9138 22.147 22.6191 20.3086 20.6117 17.4899C21.0337 16.9094 21.4128 16.3343 21.7217 15.7997C22.0942 15.1549 22.4723 13.907 22.4723 13.907C22.4723 13.907 21.5956 15.4127 21.1885 16.0087C21.0109 16.2687 20.8041 16.5328 20.6336 16.7505C20.5172 16.8991 20.4178 17.026 20.3562 17.1152C20.3561 17.1149 20.3559 17.1146 20.3557 17.1143ZM10.585 18.2387C12.5349 18.2387 14.2796 17.2247 15.4446 15.6288L18.2616 12.2261L18.2708 12.236C18.3855 12.0918 18.5037 11.9418 18.6252 11.7869L18.8823 11.4763C18.9135 11.4386 18.9398 11.3983 18.9612 11.3562C19.2186 11.0251 19.4873 10.6769 19.7636 10.3188L19.7645 10.3176C21.5496 8.00437 23.6531 5.27856 25.0782 4.07069C26.0327 3.26168 27.5208 2.2445 29.1493 2.11655C30.3663 1.94388 31.8366 2.08434 33.5461 2.76816C32.2433 1.9537 30.6821 1.66413 29.0024 1.7618C27.3226 1.85947 25.6832 2.72667 24.2639 3.745C22.8141 4.78522 20.9312 7.16948 18.7438 9.93939L18.5369 10.2013L15.6643 6.51091C14.5055 4.73266 12.6616 3.5826 10.585 3.5826C7.07741 3.5826 4.23398 6.86347 4.23398 10.9106C4.23398 14.9578 7.07741 18.2387 10.585 18.2387ZM30.1264 18.2387C28.1764 18.2387 26.4317 17.2247 25.2667 15.6288L22.1697 11.8877L21.9482 12.1681C19.7607 14.9381 17.8779 17.3223 16.428 18.3625C15.0087 19.3809 13.3693 20.2481 11.6896 20.3457C10.0099 20.4434 8.4486 20.1538 7.14583 19.3394C8.85539 20.0232 10.3256 20.1637 11.5427 19.991C13.1711 19.863 14.6593 18.8459 15.6138 18.0368C17.0389 16.829 19.1424 14.1031 20.9275 11.7899C21.463 11.0959 21.9699 10.4391 22.4212 9.87151L22.4266 9.87738L25.047 6.51091C26.2058 4.73266 28.0497 3.5826 30.1264 3.5826C33.6339 3.5826 36.4774 6.86347 36.4774 10.9106C36.4774 14.9578 33.6339 18.2387 30.1264 18.2387Z" fill="black"></path></mask><g mask="url(#mask0_3275_99396)"><circle cx="18.3917" cy="9.75161" r="12.3957" fill="url(#paint0_radial_3275_99396)"></circle><path d="M6.81156 6.45303L8.28313 -6.26299L20.7218 4.39474C20.7218 4.39474 20.1285 4.81161 19.6762 5.62887C18.8474 7.12662 17.6593 9.2678 17.6593 9.2678L6.81156 6.45303Z" fill="url(#paint1_linear_3275_99396)"></path></g><path d="M49.6909 6.07724H51.4969L54.9829 14.0852H55.0249L58.4969 6.07724H60.3029V16.0732H58.7769V8.93324H58.7209L55.6549 16.0732H54.3389L51.2729 8.93324H51.2169V16.0732H49.6909V6.07724ZM65.1951 8.63924C66.3711 8.63924 67.2811 9.03124 67.8971 9.84324C68.4571 10.5712 68.7511 11.5792 68.7651 12.8672H63.2771C63.3331 13.5672 63.5151 14.1132 63.8511 14.4912C64.1871 14.8552 64.6491 15.0512 65.2371 15.0512C65.7551 15.0512 66.1751 14.9252 66.4971 14.6872C66.7491 14.4912 66.9591 14.1692 67.1551 13.7492H68.6391C68.4711 14.4212 68.1491 14.9952 67.6451 15.4432C67.0151 15.9892 66.2171 16.2692 65.2511 16.2692C64.1871 16.2692 63.3331 15.9332 62.7171 15.2752C62.0451 14.5752 61.7091 13.6372 61.7091 12.4472C61.7091 11.3692 62.0171 10.4732 62.6611 9.74524C63.2771 9.00324 64.1311 8.63924 65.1951 8.63924ZM65.2371 9.85724C64.6771 9.85724 64.2431 10.0112 63.9071 10.3472C63.5991 10.6692 63.3891 11.1312 63.3051 11.7472H67.2111C67.0711 10.4872 66.4131 9.85724 65.2371 9.85724ZM72.2294 6.49724V8.83524H73.8814V10.0672H72.2294V14.2672C72.2294 14.4632 72.2714 14.6032 72.3554 14.7012C72.4394 14.7852 72.5654 14.8412 72.7474 14.8412H73.6994V16.0732H72.5094C71.8934 16.0732 71.4314 15.9052 71.1514 15.5832C70.8714 15.2752 70.7454 14.8412 70.7454 14.2672V10.0672H69.4014V8.83524H70.7454V7.11324L72.2294 6.49724ZM78.3383 8.63924C79.4023 8.63924 80.1863 8.90524 80.6903 9.43724C81.1243 9.89924 81.3483 10.5712 81.3483 11.4532V16.0732H79.9763V15.0512C79.6963 15.4152 79.3463 15.7092 78.9263 15.9192C78.4503 16.1432 77.8903 16.2692 77.2463 16.2692C76.4903 16.2692 75.9023 16.0732 75.4823 15.6952C75.0203 15.3172 74.7963 14.8272 74.7963 14.2252C74.7963 13.4132 75.1183 12.7832 75.7623 12.3492C76.3503 11.9292 77.1903 11.7192 78.2543 11.6912L79.8783 11.6492V11.3552C79.8783 10.3472 79.3323 9.84324 78.2403 9.84324C77.7783 9.84324 77.4003 9.92724 77.1203 10.0952C76.7843 10.2912 76.5743 10.5852 76.4903 10.9912L75.0203 10.8652C75.1743 10.0812 75.5663 9.49324 76.1823 9.12924C76.7143 8.79324 77.4423 8.63924 78.3383 8.63924ZM79.8783 12.7272L78.3523 12.7692C76.9943 12.7972 76.3223 13.2732 76.3223 14.1692C76.3223 14.4492 76.4343 14.6732 76.6723 14.8552C76.8963 15.0372 77.2043 15.1352 77.5823 15.1352C78.2123 15.1352 78.7443 14.9392 79.1923 14.5612C79.6403 14.1832 79.8783 13.7072 79.8783 13.1472V12.7272ZM87.513 5.88124C88.787 5.88124 89.795 6.16124 90.537 6.74924C91.251 7.30924 91.699 8.13524 91.881 9.25524H90.341C90.201 8.58324 89.893 8.07924 89.417 7.74324C88.941 7.39324 88.297 7.22524 87.513 7.22524C86.547 7.22524 85.777 7.54724 85.203 8.21924C84.587 8.91924 84.293 9.88524 84.293 11.1172C84.293 12.3212 84.559 13.2452 85.119 13.8892C85.707 14.5892 86.631 14.9392 87.877 14.9392C88.367 14.9392 88.829 14.8692 89.263 14.7572C89.683 14.6452 90.047 14.4772 90.383 14.2672V12.0972H87.625V10.7952H91.909V14.9952C91.391 15.4012 90.789 15.7092 90.103 15.9332C89.375 16.1572 88.577 16.2692 87.709 16.2692C86.113 16.2692 84.881 15.7652 83.999 14.7572C83.173 13.8192 82.767 12.6012 82.767 11.1172C82.767 9.61924 83.173 8.38724 83.999 7.42124C84.867 6.38524 86.043 5.88124 87.513 5.88124ZM93.7417 6.07724H97.8857C100.266 6.07724 101.456 7.08524 101.456 9.11524C101.456 11.1592 100.252 12.1812 97.8577 12.1812H95.2677V16.0732H93.7417V6.07724ZM95.2677 7.37924V10.8792H97.7597C98.5157 10.8792 99.0617 10.7392 99.4117 10.4592C99.7477 10.1792 99.9297 9.73124 99.9297 9.11524C99.9297 8.49924 99.7477 8.05124 99.3977 7.79924C99.0477 7.51924 98.5017 7.37924 97.7597 7.37924H95.2677ZM102.105 6.07724H110.295V7.37924H106.963V16.0732H105.451V7.37924H102.105V6.07724Z" fill="white"></path><defs><radialGradient id="paint0_radial_3275_99396" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(18.3917 9.75161) rotate(90) scale(12.3957)"><stop stop-color="#582AFF"></stop><stop offset="1" stop-color="#582AFF" stop-opacity="0"></stop></radialGradient><linearGradient id="paint1_linear_3275_99396" x1="8.37635" y1="1.52165" x2="19.1719" y2="7.92579" gradientUnits="userSpaceOnUse"><stop offset="0.15027" stop-color="#5329EA" stop-opacity="0"></stop><stop offset="1" stop-color="#5027E4" stop-opacity="0.82"></stop></linearGradient></defs>',5),O=[I],P=H({__name:"LogoWhite",setup(k){return(p,c)=>(v(),w("svg",A,O))}}),W={class:"login"},D={class:"loginbg"},j=l("div",{class:"title"},"MetaGPT",-1),J={class:"loginform"},K={style:{width:"418px"}},Q={class:"formTitle"},X={class:"toolBoxBtn"},Y={class:"desc"},o1=H({__name:"login",setup(k){const p=b(),c=_(),C=x({username:"",password:""}),d=_(!1),M=S(()=>({username:[{required:!0,message:h("请输入用户名")}],password:[{required:!0,message:h("请输入密码")}]})),{setToken:y,getToken:Z}=R(),u=_(!1),$=async()=>{var m;if(u.value||await((m=c.value)==null?void 0:m.validate()))return;u.value=!0;const{isRequestSuccess:o,showRequestErrorMessage:r,data:B}=await q({account:C.username,password:C.password});if(u.value=!1,!o){r();return}y(B.token),p.replace({name:V.home})};return F(()=>{Z()&&p.replace({name:V.home})}),(a,o)=>(v(),w("div",W,[l("div",D,[s(P,{class:"logiWhite"}),j]),l("div",J,[l("div",K,[s(e(z),{ref_key:"formRef",ref:c,model:e(C),rules:e(M)},{default:t(()=>[s(e(f),{"hide-label":""},{default:t(()=>[l("div",Q,i(a.$t("账号登录")),1)]),_:1}),s(e(f),{"hide-label":"",field:"username"},{default:t(()=>[s(e(L),{modelValue:e(C).username,"onUpdate:modelValue":o[0]||(o[0]=r=>e(C).username=r),placeholder:a.$t("用户名/邮箱"),size:"large"},null,8,["modelValue","placeholder"])]),_:1}),s(e(f),{"hide-label":"",field:"password"},{default:t(()=>[s(e(L),{modelValue:e(C).password,"onUpdate:modelValue":o[1]||(o[1]=r=>e(C).password=r),type:"password",placeholder:a.$t("密码"),size:"large"},null,8,["modelValue","placeholder"])]),_:1}),s(e(G),{type:"primary",long:"",size:"large",disabled:!e(d),loading:e(u),onClick:$},{default:t(()=>[n(i(a.$t("登录")),1)]),_:1},8,["disabled","loading"]),s(e(N),{class:"spaceBTW toolBox",fill:""},{default:t(()=>[l("span",X,i(a.$t("忘记密码")),1)]),_:1}),l("div",null,[s(e(E),{modelValue:e(d),"onUpdate:modelValue":o[2]||(o[2]=r=>T(d)?d.value=r:null)},{default:t(()=>[l("div",Y,[n(i(a.$t("登录或完成注册即代表你同意")),1),s(e(g),null,{default:t(()=>[n(i(a.$t("用户协议")),1)]),_:1}),n(" "+i(a.$t("和"))+" ",1),s(e(g),null,{default:t(()=>[n(i(a.$t("隐私政策")),1)]),_:1})])]),_:1},8,["modelValue"])])]),_:1},8,["model","rules"])])])]))}});export{o1 as default};
agent/static/cy_aps/assets/role0-73c01153.png ADDED

Git LFS Details

  • SHA256: 73c01153d88bd2b112dc3bcb7b77333cc438bfac964fc5682fe176432fbc5281
  • Pointer size: 130 Bytes
  • Size of remote file: 20.4 kB
agent/static/cy_aps/assets/role1-8fd25a72.png ADDED

Git LFS Details

  • SHA256: 8fd25a72c9392e99514b33ad1165039e1d7dca6f16a9e3af4b259a09baa994db
  • Pointer size: 130 Bytes
  • Size of remote file: 28.5 kB
agent/static/cy_aps/assets/role2-d49c6a81.png ADDED

Git LFS Details

  • SHA256: d49c6a816cff202168d4fd7f83ec8d3da5974da7bc0831106e8986cfe6156b7c
  • Pointer size: 130 Bytes
  • Size of remote file: 23.2 kB
agent/static/cy_aps/assets/role3-d2c54a2d.png ADDED

Git LFS Details

  • SHA256: d2c54a2dc8a598e20204689a5506d6d6a47a642d3f530fe60fa927431912efea
  • Pointer size: 130 Bytes
  • Size of remote file: 22 kB
agent/static/cy_aps/assets/role4-a6ccbb5f.png ADDED

Git LFS Details

  • SHA256: a6ccbb5fe1e9cbb28d969641c5d5496fb74a324521fbc830ae6742b11614bf76
  • Pointer size: 130 Bytes
  • Size of remote file: 22 kB
agent/static/cy_aps/assets/role5-16fddacc.png ADDED

Git LFS Details

  • SHA256: 16fddacc0ae7788b76a9985e6e378e00219c71bc6f7c1777bc735dc707b696f0
  • Pointer size: 130 Bytes
  • Size of remote file: 22.4 kB
agent/static/cy_aps/assets/role6-c9a82246.png ADDED

Git LFS Details

  • SHA256: c9a82246df4ec568f9ac129dc689cb366a8f20929735c3020b9ee645b1f134e8
  • Pointer size: 130 Bytes
  • Size of remote file: 22.3 kB
agent/static/cy_aps/assets/roundLogo-a63958eb.png ADDED

Git LFS Details

  • SHA256: a63958eb8d82dca2be14f5b6128cf20703a3218503ce0ec7ae8d6f8f6c56a22a
  • Pointer size: 130 Bytes
  • Size of remote file: 55.7 kB
agent/static/cy_aps/assets/sparkles-50d190d6.svg ADDED

Git LFS Details

  • SHA256: 50d190d6c21b3d5e04a1203e6b856a751ef63d5e62b68d86e348910d9d5fc81d
  • Pointer size: 131 Bytes
  • Size of remote file: 469 kB
agent/static/cy_aps/assets/style-86c4771e.css ADDED
The diff for this file is too large to render. See raw diff
 
agent/static/cy_aps/assets/vendor-4cd7d240.js ADDED
The diff for this file is too large to render. See raw diff
 
agent/static/cy_aps/assets/vue-e0bc46a9.js ADDED
The diff for this file is too large to render. See raw diff
 
agent/static/cy_aps/assets/wechat-4dad209c.png ADDED

Git LFS Details

  • SHA256: 4dad209c367c28753f493fbbe27e4c4f3e769efe5e712895d9214a776e1ced0e
  • Pointer size: 130 Bytes
  • Size of remote file: 60.9 kB
agent/static/index.html ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <link rel="shortcut icon" href="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/favicon-beef0aa9.ico" type="image/x-icon" />
8
+ <title>meta-gpt</title>
9
+ <script type="module" crossorigin src="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/index-5df855a0.js"></script>
10
+ <link rel="modulepreload" crossorigin href="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/vue-e0bc46a9.js">
11
+ <link rel="modulepreload" crossorigin href="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/__commonjsHelpers__-042e6b4d.js">
12
+ <link rel="modulepreload" crossorigin href="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/vendor-4cd7d240.js">
13
+ <link rel="stylesheet" href="https://public-frontend-1300249583.cos-website.ap-nanjing.myqcloud.com/cy_aps/assets/style-86c4771e.css">
14
+ </head>
15
+
16
+ <body>
17
+ <div id="app"></div>
18
+
19
+ <script src="//at.alicdn.com/t/c/font_4154416_ztcldmhaba.js"></script>
20
+ </body>
21
+
22
+ </html>
agent/web/app.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import urllib.parse
5
+ import uuid
6
+ from datetime import datetime
7
+ from enum import Enum
8
+ from typing import Any, Optional
9
+
10
+ import fire
11
+ import uvicorn
12
+ from fastapi import FastAPI, HTTPException, Request
13
+ from fastapi.responses import RedirectResponse, StreamingResponse
14
+ from fastapi.staticfiles import StaticFiles
15
+ from metagpt.actions.action import Action
16
+ from metagpt.actions.action_output import ActionOutput
17
+ from metagpt.config import CONFIG
18
+ from pydantic import BaseModel, Field
19
+
20
+ from agent.roles.software_company import RoleRun, SoftwareCompany
21
+
22
+
23
+ class QueryAnswerType(Enum):
24
+ Query = "Q"
25
+ Answer = "A"
26
+
27
+
28
+ class SentenceType(Enum):
29
+ TEXT = "text"
30
+ HIHT = "hint"
31
+ ACTION = "action"
32
+
33
+
34
+ class MessageStatus(Enum):
35
+ COMPLETE = "complete"
36
+
37
+
38
+ class SentenceValue(BaseModel):
39
+ answer: str
40
+
41
+
42
+ class Sentence(BaseModel):
43
+ type: str
44
+ id: Optional[str] = None
45
+ value: SentenceValue
46
+ is_finished: Optional[bool] = None
47
+
48
+
49
+ class Sentences(BaseModel):
50
+ id: Optional[str] = None
51
+ action: Optional[str] = None
52
+ role: Optional[str] = None
53
+ skill: Optional[str] = None
54
+ description: Optional[str] = None
55
+ timestamp: str = datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f%z")
56
+ status: str
57
+ contents: list[Sentence]
58
+
59
+
60
+ class NewMsg(BaseModel):
61
+ """Chat with MetaGPT"""
62
+
63
+ query: str = Field(description="Problem description")
64
+ config: dict[str, Any] = Field(description="Configuration information")
65
+
66
+
67
+ class ErrorInfo(BaseModel):
68
+ error: str = None
69
+ traceback: str = None
70
+
71
+
72
+ class ThinkActStep(BaseModel):
73
+ id: str
74
+ status: str
75
+ title: str
76
+ timestamp: str
77
+ description: str
78
+ content: Sentence = None
79
+
80
+
81
+ class ThinkActPrompt(BaseModel):
82
+ message_id: int = None
83
+ timestamp: str = datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f%z")
84
+ step: ThinkActStep = None
85
+ skill: Optional[str] = None
86
+ role: Optional[str] = None
87
+
88
+ def update_think(self, tc_id, action: Action):
89
+ self.step = ThinkActStep(
90
+ id=str(tc_id),
91
+ status="running",
92
+ title=action.desc,
93
+ timestamp=datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f%z"),
94
+ description=action.desc,
95
+ )
96
+
97
+ def update_act(self, message: ActionOutput):
98
+ self.step.status = "finish"
99
+ self.step.content = Sentence(
100
+ type="text",
101
+ id=ThinkActPrompt.guid32(),
102
+ value=SentenceValue(answer=message.content),
103
+ is_finished=True,
104
+ )
105
+
106
+ @staticmethod
107
+ def guid32():
108
+ return str(uuid.uuid4()).replace("-", "")[0:32]
109
+
110
+ @property
111
+ def prompt(self):
112
+ v = self.model_dump_json()
113
+ return urllib.parse.quote(v)
114
+
115
+
116
+ class MessageJsonModel(BaseModel):
117
+ steps: list[Sentences]
118
+ qa_type: str
119
+ created_at: datetime = datetime.now()
120
+ query_time: datetime = datetime.now()
121
+ answer_time: datetime = datetime.now()
122
+ score: Optional[int] = None
123
+ feedback: Optional[str] = None
124
+
125
+ def add_think_act(self, think_act_prompt: ThinkActPrompt):
126
+ s = Sentences(
127
+ action=think_act_prompt.step.title,
128
+ skill=think_act_prompt.skill,
129
+ description=think_act_prompt.step.description,
130
+ timestamp=think_act_prompt.timestamp,
131
+ status=think_act_prompt.step.status,
132
+ contents=[think_act_prompt.step.content.model_dump()],
133
+ )
134
+ self.steps.append(s)
135
+
136
+ @property
137
+ def prompt(self):
138
+ v = self.model_dump_json(exclude_unset=True)
139
+ return urllib.parse.quote(v)
140
+
141
+
142
+ async def create_message(req_model: NewMsg, request: Request):
143
+ """
144
+ Session message stream
145
+ """
146
+ config = {k.upper(): v for k, v in req_model.config.items()}
147
+ CONFIG.set_context(config)
148
+ role = SoftwareCompany()
149
+ role.company.run_project(idea=req_model.query)
150
+ answer = MessageJsonModel(
151
+ steps=[
152
+ Sentences(
153
+ contents=[
154
+ Sentence(
155
+ type=SentenceType.TEXT.value, value=SentenceValue(answer=req_model.query), is_finished=True
156
+ )
157
+ ],
158
+ status=MessageStatus.COMPLETE.value,
159
+ )
160
+ ],
161
+ qa_type=QueryAnswerType.Answer.value,
162
+ )
163
+
164
+ tc_id = 0
165
+
166
+ while True:
167
+ tc_id += 1
168
+ if request and await request.is_disconnected():
169
+ return
170
+ think_result: RoleRun = await role.think()
171
+ if not think_result: # End of conversion
172
+ break
173
+ think_act_prompt = ThinkActPrompt(role=think_result.role.profile)
174
+ think_act_prompt.update_think(tc_id, think_result)
175
+ yield think_act_prompt.prompt + "\n\n"
176
+ act_result = await role.act()
177
+ think_act_prompt.update_act(act_result)
178
+ yield think_act_prompt.prompt + "\n\n"
179
+ answer.add_think_act(think_act_prompt)
180
+ yield answer.prompt + "\n\n" # Notify the front-end that the message is complete.
181
+
182
+
183
+ class ChatHandler:
184
+ @staticmethod
185
+ async def create_message(req_model: NewMsg, request: Request):
186
+ """Message stream, using SSE."""
187
+ event = create_message(req_model, request)
188
+ headers = {"Cache-Control": "no-cache", "Connection": "keep-alive"}
189
+ return StreamingResponse(event, headers=headers, media_type="text/event-stream")
190
+
191
+
192
+ app = FastAPI()
193
+
194
+ app.mount(
195
+ "/static",
196
+ StaticFiles(directory="./agent/static/", check_dir=True),
197
+ name="static",
198
+ )
199
+ app.add_api_route(
200
+ "/api/messages",
201
+ endpoint=ChatHandler.create_message,
202
+ methods=["post"],
203
+ summary="Session message sending (streaming response)",
204
+ )
205
+
206
+
207
+ @app.get("/{catch_all:path}")
208
+ async def catch_all(request: Request):
209
+ if request.url.path == "/":
210
+ return RedirectResponse(url="/static/index.html")
211
+ if request.url.path.startswith("/api"):
212
+ raise HTTPException(status_code=404)
213
+
214
+ new_path = f"/static{request.url.path}"
215
+ return RedirectResponse(url=new_path)
216
+
217
+
218
+ def main():
219
+ uvicorn.run(app="__main__:app", host="0.0.0.0", port=7860)
220
+
221
+
222
+ if __name__ == "__main__":
223
+ fire.Fire(main)
config/config.yaml ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DO NOT MODIFY THIS FILE, create a new key.yaml, define OPENAI_API_KEY.
2
+ # The configuration of key.yaml has a higher priority and will not enter git
3
+
4
+ #### Project Path Setting
5
+ # WORKSPACE_PATH: "Path for placing output files"
6
+
7
+ #### if OpenAI
8
+ ## The official OPENAI_BASE_URL is https://api.openai.com/v1
9
+ ## If the official OPENAI_BASE_URL is not available, we recommend using the [openai-forward](https://github.com/beidongjiedeguang/openai-forward).
10
+ ## Or, you can configure OPENAI_PROXY to access official OPENAI_BASE_URL.
11
+ OPENAI_BASE_URL: "https://api.openai.com/v1"
12
+ #OPENAI_PROXY: "http://127.0.0.1:8118"
13
+ #OPENAI_API_KEY: "YOUR_API_KEY" # set the value to sk-xxx if you host the openai interface for open llm model
14
+ OPENAI_API_MODEL: "gpt-4-1106-preview"
15
+ MAX_TOKENS: 4096
16
+ RPM: 10
17
+ LLM_TYPE: OpenAI # Except for these three major models – OpenAI, MetaGPT LLM, and Azure – other large models can be distinguished based on the validity of the key.
18
+ TIMEOUT: 60 # Timeout for llm invocation
19
+ DEFAULT_PROVIDER: openai
20
+
21
+ #### if Spark
22
+ #SPARK_APPID : "YOUR_APPID"
23
+ #SPARK_API_SECRET : "YOUR_APISecret"
24
+ #SPARK_API_KEY : "YOUR_APIKey"
25
+ #DOMAIN : "generalv2"
26
+ #SPARK_URL : "ws://spark-api.xf-yun.com/v2.1/chat"
27
+
28
+ #### if Anthropic
29
+ #ANTHROPIC_API_KEY: "YOUR_API_KEY"
30
+
31
+ #### if AZURE, check https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb
32
+ #OPENAI_API_TYPE: "azure"
33
+ #OPENAI_BASE_URL: "YOUR_AZURE_ENDPOINT"
34
+ #OPENAI_API_KEY: "YOUR_AZURE_API_KEY"
35
+ #OPENAI_API_VERSION: "YOUR_AZURE_API_VERSION"
36
+ #DEPLOYMENT_NAME: "YOUR_DEPLOYMENT_NAME"
37
+
38
+ #### if zhipuai from `https://open.bigmodel.cn`. You can set here or export API_KEY="YOUR_API_KEY"
39
+ # ZHIPUAI_API_KEY: "YOUR_API_KEY"
40
+
41
+ #### if Google Gemini from `https://ai.google.dev/` and API_KEY from `https://makersuite.google.com/app/apikey`.
42
+ #### You can set here or export GOOGLE_API_KEY="YOUR_API_KEY"
43
+ # GEMINI_API_KEY: "YOUR_API_KEY"
44
+
45
+ #### if use self-host open llm model with openai-compatible interface
46
+ #OPEN_LLM_API_BASE: "http://127.0.0.1:8000/v1"
47
+ #OPEN_LLM_API_MODEL: "llama2-13b"
48
+ #
49
+ ##### if use Fireworks api
50
+ #FIREWORKS_API_KEY: "YOUR_API_KEY"
51
+ #FIREWORKS_API_BASE: "https://api.fireworks.ai/inference/v1"
52
+ #FIREWORKS_API_MODEL: "YOUR_LLM_MODEL" # example, accounts/fireworks/models/llama-v2-13b-chat
53
+
54
+ #### if use self-host open llm model by ollama
55
+ # OLLAMA_API_BASE: http://127.0.0.1:11434/api
56
+ # OLLAMA_API_MODEL: llama2
57
+
58
+ #### for Search
59
+
60
+ ## Supported values: serpapi/google/serper/ddg
61
+ #SEARCH_ENGINE: serpapi
62
+
63
+ ## Visit https://serpapi.com/ to get key.
64
+ #SERPAPI_API_KEY: "YOUR_API_KEY"
65
+
66
+ ## Visit https://console.cloud.google.com/apis/credentials to get key.
67
+ #GOOGLE_API_KEY: "YOUR_API_KEY"
68
+ ## Visit https://programmablesearchengine.google.com/controlpanel/create to get id.
69
+ #GOOGLE_CSE_ID: "YOUR_CSE_ID"
70
+
71
+ ## Visit https://serper.dev/ to get key.
72
+ #SERPER_API_KEY: "YOUR_API_KEY"
73
+
74
+ #### for web access
75
+
76
+ ## Supported values: playwright/selenium
77
+ #WEB_BROWSER_ENGINE: playwright
78
+
79
+ ## Supported values: chromium/firefox/webkit, visit https://playwright.dev/python/docs/api/class-browsertype
80
+ ##PLAYWRIGHT_BROWSER_TYPE: chromium
81
+
82
+ ## Supported values: chrome/firefox/edge/ie, visit https://www.selenium.dev/documentation/webdriver/browsers/
83
+ # SELENIUM_BROWSER_TYPE: chrome
84
+
85
+ #### for TTS
86
+
87
+ #AZURE_TTS_SUBSCRIPTION_KEY: "YOUR_API_KEY"
88
+ #AZURE_TTS_REGION: "eastus"
89
+
90
+ #### for Stable Diffusion
91
+ ## Use SD service, based on https://github.com/AUTOMATIC1111/stable-diffusion-webui
92
+ #SD_URL: "YOUR_SD_URL"
93
+ #SD_T2I_API: "/sdapi/v1/txt2img"
94
+
95
+ #### for Execution
96
+ #LONG_TERM_MEMORY: false
97
+
98
+ #### for Mermaid CLI
99
+ ## If you installed mmdc (Mermaid CLI) only for metagpt then enable the following configuration.
100
+ #PUPPETEER_CONFIG: "./config/puppeteer-config.json"
101
+ #MMDC: "./node_modules/.bin/mmdc"
102
+
103
+
104
+ ### for calc_usage
105
+ # CALC_USAGE: false
106
+
107
+ ### for Research
108
+ # MODEL_FOR_RESEARCHER_SUMMARY: gpt-3.5-turbo
109
+ # MODEL_FOR_RESEARCHER_REPORT: gpt-3.5-turbo-16k
110
+
111
+ ### choose the engine for mermaid conversion,
112
+ # default is nodejs, you can change it to playwright,pyppeteer or ink
113
+ # MERMAID_ENGINE: nodejs
114
+
115
+ ### browser path for pyppeteer engine, support Chrome, Chromium,MS Edge
116
+ #PYPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable"
117
+
118
+ ### for repair non-openai LLM's output when parse json-text if PROMPT_FORMAT=json
119
+ ### due to non-openai LLM's output will not always follow the instruction, so here activate a post-process
120
+ ### repair operation on the content extracted from LLM's raw output. Warning, it improves the result but not fix all cases.
121
+ # REPAIR_LLM_OUTPUT: false
122
+
123
+ # PROMPT_FORMAT: json #json or markdown
124
+
125
+ ### Agent configurations
126
+ # RAISE_NOT_CONFIG_ERROR: true # "true" if the LLM key is not configured, throw a NotConfiguredException, else "false".
127
+ # WORKSPACE_PATH_WITH_UID: false # "true" if using `{workspace}/{uid}` as the workspace path; "false" use `{workspace}`.
128
+
129
+ ### Meta Models
130
+ #METAGPT_TEXT_TO_IMAGE_MODEL: MODEL_URL
131
+
132
+ ### S3 config
133
+ #S3_ACCESS_KEY: "YOUR_S3_ACCESS_KEY"
134
+ #S3_SECRET_KEY: "YOUR_S3_SECRET_KEY"
135
+ #S3_ENDPOINT_URL: "YOUR_S3_ENDPOINT_URL"
136
+ #S3_SECURE: true # true/false
137
+ #S3_BUCKET: "YOUR_S3_BUCKET"
138
+
139
+ ### Redis config
140
+ #REDIS_HOST: "YOUR_REDIS_HOST"
141
+ #REDIS_PORT: "YOUR_REDIS_PORT"
142
+ #REDIS_PASSWORD: "YOUR_REDIS_PASSWORD"
143
+ #REDIS_DB: "YOUR_REDIS_DB_INDEX, str, 0-based"
144
+
145
+ # DISABLE_LLM_PROVIDER_CHECK: false
config/puppeteer-config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "executablePath": "/usr/bin/chromium",
3
+ "args": [
4
+ "--no-sandbox"
5
+ ]
6
+ }
docs/FAQ-EN.md ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Our vision is to [extend human life](https://github.com/geekan/HowToLiveLonger) and [reduce working hours](https://github.com/geekan/MetaGPT/).
2
+
3
+ 1. ### Convenient Link for Sharing this Document:
4
+
5
+ ```
6
+ - MetaGPT-Index/FAQ https://deepwisdom.feishu.cn/wiki/MsGnwQBjiif9c3koSJNcYaoSnu4
7
+ ```
8
+
9
+ 2. ### Link
10
+
11
+ <!---->
12
+
13
+ 1. Code:https://github.com/geekan/MetaGPT
14
+
15
+ 1. Roadmap:https://github.com/geekan/MetaGPT/blob/main/docs/ROADMAP.md
16
+
17
+ 1. EN
18
+
19
+ 1. Demo Video: [MetaGPT: Multi-Agent AI Programming Framework](https://www.youtube.com/watch?v=8RNzxZBTW8M)
20
+ 2. Tutorial: [MetaGPT: Deploy POWERFUL Autonomous Ai Agents BETTER Than SUPERAGI!](https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s)
21
+ 3. Author's thoughts video(EN): [MetaGPT Matthew Berman](https://youtu.be/uT75J_KG_aY?si=EgbfQNAwD8F5Y1Ak)
22
+
23
+ 1. CN
24
+
25
+ 1. Demo Video: [MetaGPT:一行代码搭建你的虚拟公司_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1NP411C7GW/?spm_id_from=333.999.0.0&vd_source=735773c218b47da1b4bd1b98a33c5c77)
26
+ 1. Tutorial: [一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目](https://youtu.be/Bp95b8yIH5c)
27
+ 2. Author's thoughts video(CN): [MetaGPT作者深度解析直播回放_哔哩哔哩_bilibili](https://www.bilibili.com/video/BV1Ru411V7XL/?spm_id_from=333.337.search-card.all.click)
28
+
29
+ <!---->
30
+
31
+ 3. ### How to become a contributor?
32
+
33
+ <!---->
34
+
35
+ 1. Choose a task from the Roadmap (or you can propose one). By submitting a PR, you can become a contributor and join the dev team.
36
+ 1. Current contributors come from backgrounds including ByteDance AI Lab/DingDong/Didi/Xiaohongshu, Tencent/Baidu/MSRA/TikTok/BloomGPT Infra/Bilibili/CUHK/HKUST/CMU/UCB
37
+
38
+ <!---->
39
+
40
+ 4. ### Chief Evangelist (Monthly Rotation)
41
+
42
+ MetaGPT Community - The position of Chief Evangelist rotates on a monthly basis. The primary responsibilities include:
43
+
44
+ 1. Maintaining community FAQ documents, announcements, and Github resources/READMEs.
45
+ 1. Responding to, answering, and distributing community questions within an average of 30 minutes, including on platforms like Github Issues, Discord and WeChat.
46
+ 1. Upholding a community atmosphere that is enthusiastic, genuine, and friendly.
47
+ 1. Encouraging everyone to become contributors and participate in projects that are closely related to achieving AGI (Artificial General Intelligence).
48
+ 1. (Optional) Organizing small-scale events, such as hackathons.
49
+
50
+ <!---->
51
+
52
+ 5. ### FAQ
53
+
54
+ <!---->
55
+
56
+ 1. Experience with the generated repo code:
57
+
58
+ 1. https://github.com/geekan/MetaGPT/releases/tag/v0.1.0
59
+
60
+ 1. Code truncation/ Parsing failure:
61
+
62
+ 1. Check if it's due to exceeding length. Consider using the gpt-3.5-turbo-16k or other long token versions.
63
+
64
+ 1. Success rate:
65
+
66
+ 1. There hasn't been a quantitative analysis yet, but the success rate of code generated by GPT-4 is significantly higher than that of gpt-3.5-turbo.
67
+
68
+ 1. Support for incremental, differential updates (if you wish to continue a half-done task):
69
+
70
+ 1. Several prerequisite tasks are listed on the ROADMAP.
71
+
72
+ 1. Can existing code be loaded?
73
+
74
+ 1. It's not on the ROADMAP yet, but there are plans in place. It just requires some time.
75
+
76
+ 1. Support for multiple programming languages and natural languages?
77
+
78
+ 1. It's listed on ROADMAP.
79
+
80
+ 1. Want to join the contributor team? How to proceed?
81
+
82
+ 1. Merging a PR will get you into the contributor's team. The main ongoing tasks are all listed on the ROADMAP.
83
+
84
+ 1. PRD stuck / unable to access/ connection interrupted
85
+
86
+ 1. The official OPENAI_API_BASE address is `https://api.openai.com/v1`
87
+ 1. If the official OPENAI_API_BASE address is inaccessible in your environment (this can be verified with curl), it's recommended to configure using the reverse proxy OPENAI_API_BASE provided by libraries such as openai-forward. For instance, `OPENAI_API_BASE: "``https://api.openai-forward.com/v1``"`
88
+ 1. If the official OPENAI_API_BASE 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_API_BASE 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_API_BASE.
89
+ 1. Note: OpenAI's default API design ends with a v1. An example of the correct configuration is: `OPENAI_API_BASE: "``https://api.openai.com/v1``"`
90
+
91
+ 1. Absolutely! How can I assist you today?
92
+
93
+ 1. Did you use Chi or a similar service? These services are prone to errors, and it seems that the error rate is higher when consuming 3.5k-4k tokens in GPT-4
94
+
95
+ 1. What does Max token mean?
96
+
97
+ 1. It's a configuration for OpenAI's maximum response length. If the response exceeds the max token, it will be truncated.
98
+
99
+ 1. How to change the investment amount?
100
+
101
+ 1. You can view all commands by typing `python startup.py --help`
102
+
103
+ 1. Which version of Python is more stable?
104
+
105
+ 1. python3.9 / python3.10
106
+
107
+ 1. Can't use GPT-4, getting the error "The model gpt-4 does not exist."
108
+
109
+ 1. OpenAI's official requirement: You can use GPT-4 only after spending $1 on OpenAI.
110
+ 1. Tip: Run some data with gpt-3.5-turbo (consume the free quota and $1), and then you should be able to use gpt-4.
111
+
112
+ 1. Can games whose code has never been seen before be written?
113
+
114
+ 1. Refer to the README. The recommendation system of Toutiao is one of the most complex systems in the world currently. Although it's not on GitHub, many discussions about it exist online. If it can visualize these, it suggests it can also summarize these discussions and convert them into code. The prompt would be something like "write a recommendation system similar to Toutiao". Note: this was approached in earlier versions of the software. The SOP of those versions was different; the current one adopts Elon Musk's five-step work method, emphasizing trimming down requirements as much as possible.
115
+
116
+ 1. Under what circumstances would there typically be errors?
117
+
118
+ 1. More than 500 lines of code: some function implementations may be left blank.
119
+ 1. When using a database, it often gets the implementation wrong — since the SQL database initialization process is usually not in the code.
120
+ 1. With more lines of code, there's a higher chance of false impressions, leading to calls to non-existent APIs.
121
+
122
+ 1. Instructions for using SD Skills/UI Role:
123
+
124
+ 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.
125
+
126
+ 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:
127
+
128
+ 1. UI Design Description: Describes the content to be designed and the design objectives.
129
+ 1. Selected Elements: Describes the elements in the design that need to be illustrated.
130
+ 1. HTML Layout: Outputs the HTML code for the page.
131
+ 1. CSS Styles (styles.css): Outputs the CSS code for the page.
132
+
133
+ 1. Currently, the SD skill is a tool invoked by UIDesign. It instantiates the SDEngine, with specific code found in metagpt/tools/sd_engine.
134
+
135
+ 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.,
136
+
137
+ 1. > python webui.py --enable-insecure-extension-access --port xxx --no-gradio-queue --nowebui
138
+ 1.     Once it runs without errors, the interface will be accessible after approximately 1 minute when the model finishes loading.
139
+ 1. Configure SD_URL and SD_T2I_API in the config.yaml/key.yaml files.
140
+ 1. ![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/065295a67b0b4feea665d1372722d49d~tplv-k3u1fbpfcp-zoom-1.image)
141
+ 1.     SD_URL is the deployed server/machine IP, and Port is the specified port above, defaulting to 7860.
142
+ 1. > SD_URL: IP:Port
143
+
144
+ 1. An error occurred during installation: "Another program is using this file...egg".
145
+
146
+ 1. Delete the file and try again.
147
+ 1. Or manually execute`pip install -r requirements.txt`
148
+
149
+ 1. The origin of the name MetaGPT?
150
+
151
+ 1. The name was derived after iterating with GPT-4 over a dozen rounds. GPT-4 scored and suggested it.
152
+
153
+ 1. Is there a more step-by-step installation tutorial?
154
+
155
+ 1. Youtube(CN):[一个提示词写游戏 Flappy bird, 比AutoGPT强10倍的MetaGPT,最接近AGI的AI项目=一个软件公司产品经理+程序员](https://youtu.be/Bp95b8yIH5c)
156
+ 1. Youtube(EN)https://www.youtube.com/watch?v=q16Gi9pTG_M&t=659s
157
+ 2. video(EN): [MetaGPT Matthew Berman](https://youtu.be/uT75J_KG_aY?si=EgbfQNAwD8F5Y1Ak)
158
+
159
+ 1. openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details
160
+
161
+ 1. If you haven't exhausted your free quota, set RPM to 3 or lower in the settings.
162
+ 1. If your free quota is used up, consider adding funds to your account.
163
+
164
+ 1. What does "borg" mean in n_borg?
165
+
166
+ 1. [Wikipedia borg meaning ](https://en.wikipedia.org/wiki/Borg)
167
+ 1. The Borg civilization operates based on a hive or collective mentality, known as "the Collective." Every Borg individual is connected to the collective via a sophisticated subspace network, ensuring continuous oversight and guidance for every member. This collective consciousness allows them to not only "share the same thoughts" but also to adapt swiftly to new strategies. While individual members of the collective rarely communicate, the collective "voice" sometimes transmits aboard ships.
168
+
169
+ 1. How to use the Claude API?
170
+
171
+ 1. The full implementation of the Claude API is not provided in the current code.
172
+ 1. You can use the Claude API through third-party API conversion projects like: https://github.com/jtsang4/claude-to-chatgpt
173
+
174
+ 1. Is Llama2 supported?
175
+
176
+ 1. On the day Llama2 was released, some of the community members began experiments and found that output can be generated based on MetaGPT's structure. However, Llama2's context is too short to generate a complete project. Before regularly using Llama2, it's necessary to expand the context window to at least 8k. If anyone has good recommendations for expansion models or methods, please leave a comment.
177
+
178
+ 1. `mermaid-cli getElementsByTagName SyntaxError: Unexpected token '.'`
179
+
180
+ 1. Upgrade node to version 14.x or above:
181
+
182
+ 1. `npm install -g n`
183
+ 1. `n stable` to install the stable version of node(v18.x)
docs/README_CN.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MetaGPT: 多智能体框架
2
+
3
+ <p align="center">
4
+ <a href=""><img src="resources/MetaGPT-new-log.png" alt="MetaGPT logo: 使 GPT 以软件公司的形式工作,协作处理更复杂的任务" width="150px"></a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <b>使 GPTs 组成软件公司,协作处理更复杂的任务</b>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
13
+ <a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
14
+ <a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
15
+ <a href="https://discord.gg/DYn29wFk9z"><img src="https://dcbadge.vercel.app/api/server/DYn29wFk9z?style=flat" alt="Discord Follow"></a>
16
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
17
+ <a href="docs/ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>
18
+ <a href="https://twitter.com/MetaGPT_"><img src="https://img.shields.io/twitter/follow/MetaGPT?style=social" alt="Twitter Follow"></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/geekan/MetaGPT"><img src="https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode" alt="Open in Dev Containers"></a>
23
+ <a href="https://codespaces.new/geekan/MetaGPT"><img src="https://img.shields.io/badge/Github_Codespace-Open-blue?logo=github" alt="Open in GitHub Codespaces"></a>
24
+ <a href="https://huggingface.co/spaces/deepwisdom/MetaGPT" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20-Hugging%20Face-blue?color=blue&logoColor=white" /></a>
25
+ </p>
26
+
27
+ 1. MetaGPT输入**一句话的老板需求**,输出**用户故事 / 竞品分析 / 需求 / 数据结构 / APIs / 文件等**
28
+ 2. MetaGPT内部包括**产品经理 / 架构师 / 项目经理 / 工程师**,它提供了一个**软件公司**的全过程与精心调配的SOP
29
+ 1. `Code = SOP(Team)` 是核心哲学。我们将SOP具象化,并且用于LLM构成的团队
30
+
31
+ ![一个完全由大语言模型角色构成的软件公司](resources/software_company_cd.jpeg)
32
+
33
+ <p align="center">软件公司多角色示意图(正在逐步实现)</p>
34
+
35
+ ## 安装
36
+ ### Pip安装
37
+
38
+ ```bash
39
+ # 第 1 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查:
40
+ # 可以使用conda来初始化新的python环境
41
+ # conda create -n metagpt python=3.9
42
+ # conda activate metagpt
43
+ python3 --version
44
+
45
+ # 第 2 步:克隆最新仓库到您的本地机器,并进行安装。
46
+ git clone https://github.com/geekan/MetaGPT.git
47
+ cd MetaGPT
48
+ pip3 install -e. # 或者 pip3 install metagpt # 安装稳定版本
49
+
50
+ # 第 3 步:执行startup.py
51
+ # 拷贝config.yaml为key.yaml,并设置你自己的OPENAI_API_KEY
52
+ python3 startup.py "Write a cli snake game"
53
+
54
+ # 第 4 步【可选的】:如果你想在执行过程中保存像象限图、系统设计、序列流程等图表这些产物,可以在第3步前执行该步骤。默认的,框架做了兼容,在不执行该步的情况下,也可以完整跑完整个流程。
55
+ # 如果执行,确保您的系统上安装了 NPM。并使用npm安装mermaid-js
56
+ npm --version
57
+ sudo npm install -g @mermaid-js/mermaid-cli
58
+ ```
59
+
60
+ 详细的安装请安装 [cli_install](https://docs.deepwisdom.ai/guide/get_started/installation.html#install-stable-version)
61
+
62
+ ### Docker安装
63
+ > 注意:在Windows中,你需要将 "/opt/metagpt" 替换为Docker具有创建权限的目录,比如"D:\Users\x\metagpt"
64
+
65
+ ```bash
66
+ # 步骤1: 下载metagpt官方镜像并准备好config.yaml
67
+ docker pull metagpt/metagpt:latest
68
+ mkdir -p /opt/metagpt/{config,workspace}
69
+ docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
70
+ vim /opt/metagpt/config/key.yaml # 修改配置文件
71
+
72
+ # 步骤2: 使用容器运行metagpt演示
73
+ docker run --rm \
74
+ --privileged \
75
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
76
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
77
+ metagpt/metagpt:latest \
78
+ python startup.py "Write a cli snake game"
79
+ ```
80
+
81
+ 详细的安装请安装 [docker_install](https://docs.deepwisdom.ai/zhcn/guide/get_started/installation.html#%E4%BD%BF%E7%94%A8docker%E5%AE%89%E8%A3%85)
82
+
83
+ ### 快速开始的演示视频
84
+ - 在 [MetaGPT Huggingface Space](https://huggingface.co/spaces/deepwisdom/MetaGPT) 上进行体验
85
+ - [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY)
86
+ - [官方演示视频](https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d)
87
+
88
+ https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419
89
+
90
+ ## 教程
91
+ - 🗒 [在线文档](https://docs.deepwisdom.ai/zhcn/)
92
+ - 💻 [如何使用](https://docs.deepwisdom.ai/zhcn/guide/get_started/quickstart.html)
93
+ - 🔎 [MetaGPT的能力及应用场景](https://docs.deepwisdom.ai/zhcn/guide/get_started/introduction.html)
94
+ - 🛠 如何构建你自己的智能体?
95
+ - [MetaGPT的使用和开发教程 | 智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/agent_101.html)
96
+ - [MetaGPT的使用和开发教程 | 多智能体入门](https://docs.deepwisdom.ai/zhcn/guide/tutorials/multi_agent_101.html)
97
+ - 🧑‍💻 贡献
98
+ - [开发路线图](ROADMAP.md)
99
+ - 🔖 示例
100
+ - [辩论](https://docs.deepwisdom.ai/zhcn/guide/use_cases/multi_agent/debate.html)
101
+ - [调研员](https://docs.deepwisdom.ai/zhcn/guide/use_cases/agent/researcher.html)
102
+ - [票据助手](https://docs.deepwisdom.ai/zhcn/guide/use_cases/agent/receipt_assistant.html)
103
+ - ❓ [常见问题解答](https://docs.deepwisdom.ai/zhcn/guide/faq.html)
104
+
105
+ ## 支持
106
+
107
+ ### 加入我们
108
+
109
+ 📢 加入我们的[Discord频道](https://discord.gg/ZRHeExS6xv)!
110
+
111
+ 期待在那里与您相见!🎉
112
+
113
+ ### 联系信息
114
+
115
+ 如果您对这个项目有任何问题或反馈,欢迎联系我们。我们非常欢迎您的建议!
116
+
117
+ - **邮箱:** [email protected]
118
+ - **GitHub 问题:** 对于更技术性的问题,您也可以在我们的 [GitHub 仓库](https://github.com/geekan/metagpt/issues) 中创建一个新的问题。
119
+
120
+ 我们会在2-3个工作日内回复所有问题。
121
+
122
+ ## 引用
123
+
124
+ 引用 [arXiv paper](https://arxiv.org/abs/2308.00352):
125
+
126
+ ```bibtex
127
+ @misc{hong2023metagpt,
128
+ title={MetaGPT: Meta Programming for Multi-Agent Collaborative Framework},
129
+ author={Sirui Hong and Xiawu Zheng and Jonathan Chen and Yuheng Cheng and Jinlin Wang and Ceyao Zhang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu},
130
+ year={2023},
131
+ eprint={2308.00352},
132
+ archivePrefix={arXiv},
133
+ primaryClass={cs.AI}
134
+ }
135
+ ```
docs/README_JA.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MetaGPT: マルチエージェントフレームワーク
2
+
3
+ <p align="center">
4
+ <a href=""><img src="resources/MetaGPT-new-log.png" alt="MetaGPT ロゴ: GPT がソフトウェア会社で働けるようにし、協力してより複雑な仕事に取り組む。" width="150px"></a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <b>GPT にさまざまな役割を割り当てることで、複雑なタスクのための共同ソフトウェアエンティティを形成します。</b>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
13
+ <a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
14
+ <a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
15
+ <a href="https://discord.gg/wCp6Q3fsAk"><img src="https://img.shields.io/badge/Discord-Join-blue?logo=discord&logoColor=white&color=blue" alt="Discord Follow"></a>
16
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
17
+ <a href="docs/ROADMAP.md"><img src="https://img.shields.io/badge/ROADMAP-路线图-blue" alt="roadmap"></a>
18
+ <a href="https://twitter.com/MetaGPT_"><img src="https://img.shields.io/twitter/follow/MetaGPT?style=social" alt="Twitter Follow"></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/geekan/MetaGPT"><img src="https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode" alt="Open in Dev Containers"></a>
23
+ <a href="https://codespaces.new/geekan/MetaGPT"><img src="https://img.shields.io/badge/Github_Codespace-Open-blue?logo=github" alt="Open in GitHub Codespaces"></a>
24
+ <a href="https://huggingface.co/spaces/deepwisdom/MetaGPT" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20-Hugging%20Face-blue?color=blue&logoColor=white" /></a>
25
+ </p>
26
+
27
+ 1. MetaGPT は、**1 行の要件** を入力とし、**ユーザーストーリー / 競合分析 / 要件 / データ構造 / API / 文書など** を出力します。
28
+ 2. MetaGPT には、**プロダクト マネージャー、アーキテクト、プロジェクト マネージャー、エンジニア** が含まれています。MetaGPT は、**ソフトウェア会社のプロセス全体を、慎重に調整された SOP とともに提供します。**
29
+ 1. `Code = SOP(Team)` が基本理念です。私たちは SOP を具体化し、LLM で構成されるチームに適用します。
30
+
31
+ ![ソフトウェア会社は LLM ベースの役割で構成されている](resources/software_company_cd.jpeg)
32
+
33
+ <p align="center">ソフトウェア会社のマルチロール図式(順次導入)</p>
34
+
35
+ ## MetaGPT の能力
36
+
37
+
38
+ https://github.com/geekan/MetaGPT/assets/34952977/34345016-5d13-489d-b9f9-b82ace413419
39
+
40
+
41
+
42
+ ## 例(GPT-4 で完全生成)
43
+
44
+ 例えば、`python startup.py "Toutiao のような RecSys をデザインする"`と入力すると、多くの出力が得られます
45
+
46
+ ![Jinri Toutiao Recsys データと API デザイン](resources/workspace/content_rec_sys/resources/data_api_design.png)
47
+
48
+ 解析と設計を含む 1 つの例を生成するのに約 **$0.2**(GPT-4 の API 使用料)、完全なプロジェクトでは約 **$2.0** かかります。
49
+
50
+
51
+
52
+
53
+ ## インストール
54
+
55
+ ### インストールビデオガイド
56
+
57
+ - [Matthew Berman: How To Install MetaGPT - Build A Startup With One Prompt!!](https://youtu.be/uT75J_KG_aY)
58
+
59
+ ### 伝統的なインストール
60
+
61
+ ```bash
62
+ # ステップ 1: Python 3.9+ がシステムにインストールされていることを確認してください。これを確認するには:
63
+ python --version
64
+
65
+ # ステップ 2: リポジトリをローカルマシンにクローンし、インストールする。
66
+ git clone https://github.com/geekan/MetaGPT.git
67
+ cd MetaGPT
68
+ pip install -e.
69
+
70
+ # ステップ 3: startup.py を実行する
71
+ # config.yaml を key.yaml にコピーし、独自の OPENAI_API_KEY を設定します
72
+ python3 startup.py "Write a cli snake game"
73
+
74
+ # ステップ 4 [オプション]: 実行中に PRD ファイルなどのアーティファクトを保存する場合は、ステップ 3 の前にこのステップを実行できます。デフォルトでは、フレームワークには互換性があり、この手順を実行しなくてもプロセス全体を完了できます。
75
+ # NPM がシステムにインストールされていることを確認してください。次に mermaid-js をインストールします。(お使いのコンピューターに npm がない場合は、Node.js 公式サイトで Node.js https://nodejs.org/ をインストールしてください。)
76
+ npm --version
77
+ sudo npm install -g @mermaid-js/mermaid-cli
78
+ ```
79
+
80
+ **注:**
81
+
82
+ - すでに Chrome、Chromium、MS Edge がインストールされている場合は、環境変数 `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` を `true` に設定することで、
83
+ Chromium のダウンロードをスキップすることができます。
84
+
85
+ - このツールをグローバルにインストールする[問題を抱えている](https://github.com/mermaidjs/mermaid.cli/issues/15)人もいます。ローカルにインストールするのが代替の解決策です、
86
+
87
+ ```bash
88
+ npm install @mermaid-js/mermaid-cli
89
+ ```
90
+
91
+ - config.yml に mmdc のコンフィグを記述するのを忘れないこと
92
+
93
+ ```yml
94
+ PUPPETEER_CONFIG: "./config/puppeteer-config.json"
95
+ MMDC: "./node_modules/.bin/mmdc"
96
+ ```
97
+
98
+ - もし `pip install -e.` がエラー `[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'` で失敗したら、代わりに `pip install -e. --user` を実行してみてください
99
+
100
+ - Mermaid charts を SVG、PNG、PDF 形式に変換します。Node.js 版の Mermaid-CLI に加えて、Python 版の Playwright、pyppeteer、または mermaid.ink をこのタスクに使用できるようになりました。
101
+
102
+ - Playwright
103
+ - **Playwright のインストール**
104
+
105
+ ```bash
106
+ pip install playwright
107
+ ```
108
+
109
+ - **必要なブラウザのインストール**
110
+
111
+ PDF変換をサポートするには、Chrominumをインストールしてください。
112
+
113
+ ```bash
114
+ playwright install --with-deps chromium
115
+ ```
116
+
117
+ - **modify `config.yaml`**
118
+
119
+ config.yaml から MERMAID_ENGINE のコメントを外し、`playwright` に変更する
120
+
121
+ ```yaml
122
+ MERMAID_ENGINE: playwright
123
+ ```
124
+
125
+ - pyppeteer
126
+ - **pyppeteer のインストール**
127
+
128
+ ```bash
129
+ pip install pyppeteer
130
+ ```
131
+
132
+ - **自分のブラウザを使用**
133
+
134
+ pyppeteer を使えばインストールされているブラウザを使うことができます、以下の環境を設定してください
135
+
136
+ ```bash
137
+ export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome
138
+ ```
139
+
140
+ ブラウザのインストールにこのコマンドを使わないでください、これは古すぎます
141
+
142
+ ```bash
143
+ pyppeteer-install
144
+ ```
145
+
146
+ - **`config.yaml` を修正**
147
+
148
+ config.yaml から MERMAID_ENGINE のコメントを外し、`pyppeteer` に変更する
149
+
150
+ ```yaml
151
+ MERMAID_ENGINE: pyppeteer
152
+ ```
153
+
154
+ - mermaid.ink
155
+ - **`config.yaml` を修正**
156
+
157
+ config.yaml から MERMAID_ENGINE のコメントを外し、`ink` に変更する
158
+
159
+ ```yaml
160
+ MERMAID_ENGINE: ink
161
+ ```
162
+
163
+ 注: この方法は pdf エクスポートに対応していません。
164
+
165
+ ### Docker によるインストール
166
+ > Windowsでは、"/opt/metagpt"をDockerが作成する権限を持つディレクトリに置き換える必要があります。例えば、"D:\Users\x\metagpt"などです。
167
+
168
+ ```bash
169
+ # ステップ 1: metagpt 公式イメージをダウンロードし、config.yaml を準備する
170
+ docker pull metagpt/metagpt:latest
171
+ mkdir -p /opt/metagpt/{config,workspace}
172
+ docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
173
+ vim /opt/metagpt/config/key.yaml # 設定を変更する
174
+
175
+ # ステップ 2: コンテナで metagpt デモを実行する
176
+ docker run --rm \
177
+ --privileged \
178
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
179
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
180
+ metagpt/metagpt:latest \
181
+ python startup.py "Write a cli snake game"
182
+
183
+ # コンテナを起動し、その中でコマンドを実行することもできます
184
+ docker run --name metagpt -d \
185
+ --privileged \
186
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
187
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
188
+ metagpt/metagpt:latest
189
+
190
+ docker exec -it metagpt /bin/bash
191
+ $ python startup.py "Write a cli snake game"
192
+ ```
193
+
194
+ コマンド `docker run ...` は以下のことを行います:
195
+
196
+ - 特権モードで実行し、ブラウザの実行権限を得る
197
+ - ホスト設定ファイル `/opt/metagpt/config/key.yaml` をコンテナ `/app/metagpt/config/key.yaml` にマップします
198
+ - ホストディレクトリ `/opt/metagpt/workspace` をコンテナディレクトリ `/app/metagpt/workspace` にマップするs
199
+ - デモコマンド `python startup.py "Write a cli snake game"` を実行する
200
+
201
+ ### 自分でイメージをビルドする
202
+
203
+ ```bash
204
+ # また、自分で metagpt イメージを構築することもできます。
205
+ git clone https://github.com/geekan/MetaGPT.git
206
+ cd MetaGPT && docker build -t metagpt:custom .
207
+ ```
208
+
209
+ ## 設定
210
+
211
+ - `OPENAI_API_KEY` を `config/key.yaml / config/config.yaml / env` のいずれかで設定します。
212
+ - 優先順位は: `config/key.yaml > config/config.yaml > env` の順です。
213
+
214
+ ```bash
215
+ # 設定ファイルをコピーし、必要な修正を加える。
216
+ cp config/config.yaml config/key.yaml
217
+ ```
218
+
219
+ | 変数名 | config/key.yaml | env |
220
+ | --------------------------------------- | ----------------------------------------- | ----------------------------------------------- |
221
+ | OPENAI_API_KEY # 自分のキーに置き換える | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
222
+ | OPENAI_API_BASE # オプション | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |
223
+
224
+ ## チュートリアル: スタートアップの開始
225
+
226
+ ```shell
227
+ # スクリプトの実行
228
+ python startup.py "Write a cli snake game"
229
+ # プロジェクトの実施にエンジニアを雇わないこと
230
+ python startup.py "Write a cli snake game" --implement False
231
+ # エンジニアを雇い、コードレビューを行う
232
+ python startup.py "Write a cli snake game" --code_review True
233
+ ```
234
+
235
+ スクリプトを実行すると、`workspace/` ディレクトリに新しいプロジェクトが見つかります。
236
+
237
+ ### プラットフォームまたはツールの設定
238
+
239
+ 要件を述べるときに、どのプラットフォームまたはツールを使用するかを指定できます。
240
+
241
+ ```shell
242
+ python startup.py "pygame をベースとした cli ヘビゲームを書く"
243
+ ```
244
+
245
+ ### 使用方法
246
+
247
+ ```
248
+ 会社名
249
+ startup.py - 私たちは AI で構成されたソフトウェア・スタートアップです。私たちに投資することは、無限の可能性に満ちた未来に力を与えることです。
250
+
251
+ シノプシス
252
+ startup.py IDEA <flags>
253
+
254
+ 説明
255
+ 私たちは AI で構成されたソフトウェア・スタートアップです。私たちに投資することは、無限の可能性に満ちた未来に力を与えることです。
256
+
257
+ 位置引数
258
+ IDEA
259
+ 型: str
260
+ あなたの革新的なアイデア、例えば"スネークゲームを作る。"など
261
+
262
+ フラグ
263
+ --investment=INVESTMENT
264
+ 型: float
265
+ デフォルト: 3.0
266
+ 投資家として、あなたはこの AI 企業に一定の金額を拠出する機会がある。
267
+ --n_round=N_ROUND
268
+ 型: int
269
+ デフォルト: 5
270
+
271
+ 注意事項
272
+ 位置引数にフラグ構文を使うこともできます
273
+ ```
274
+
275
+ ### コードウォークスルー
276
+
277
+ ```python
278
+ from metagpt.team import Team
279
+ from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
280
+
281
+ async def startup(idea: str, investment: float = 3.0, n_round: int = 5):
282
+ """スタートアップを実行する。ボスになる。"""
283
+ company = Team()
284
+ company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()])
285
+ company.invest(investment)
286
+ company.start_project(idea)
287
+ await company.run(n_round=n_round)
288
+ ```
289
+
290
+ `examples` でシングル・ロール(ナレッジ・ベース付き)と LLM のみの例を詳しく見ることができます。
291
+
292
+ ## クイックスタート
293
+
294
+ ローカル環境のインストールや設定は、ユーザーによっては難しいものです。以下のチュートリアルで MetaGPT の魅力をすぐに体験できます。
295
+
296
+ - [MetaGPT クイックスタート](https://deepwisdom.feishu.cn/wiki/CyY9wdJc4iNqArku3Lncl4v8n2b)
297
+
298
+ Hugging Face Space で試す
299
+ - https://huggingface.co/spaces/deepwisdom/MetaGPT
300
+
301
+ ## 引用
302
+
303
+ 現時点では、[arXiv 論文](https://arxiv.org/abs/2308.00352)を引用してください:
304
+
305
+ ```bibtex
306
+ @misc{hong2023metagpt,
307
+ title={MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework},
308
+ author={Sirui Hong and Mingchen Zhuge and Jonathan Chen and Xiawu Zheng and Yuheng Cheng and Ceyao Zhang and Jinlin Wang and Zili Wang and Steven Ka Shing Yau and Zijuan Lin and Liyang Zhou and Chenyu Ran and Lingfeng Xiao and Chenglin Wu and Jürgen Schmidhuber},
309
+ year={2023},
310
+ eprint={2308.00352},
311
+ archivePrefix={arXiv},
312
+ primaryClass={cs.AI}
313
+ }
314
+ ```
315
+
316
+ ## お問い合わせ先
317
+
318
+ このプロジェクトに関するご質問やご意見がございましたら、お気軽にお問い合わせください。皆様のご意見をお待ちしております!
319
+
320
+ - **Email:** [email protected]
321
+ - **GitHub Issues:** 技術的なお問い合わせについては、[GitHub リポジトリ](https://github.com/geekan/metagpt/issues) に新しい issue を作成することもできます。
322
+
323
+ ご質問には 2-3 営業日以内に回答いたします。
324
+
325
+ ## デモ
326
+
327
+ https://github.com/geekan/MetaGPT/assets/2707039/5e8c1062-8c35-440f-bb20-2b0320f8d27d
328
+
329
+ ## 参加する
330
+
331
+ 📢 Discord チャンネルに参加してください!
332
+ https://discord.gg/ZRHeExS6xv
333
+
334
+ お会いできることを楽しみにしています! 🎉
docs/ROADMAP.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ## Roadmap
3
+
4
+ ### Long-term Objective
5
+
6
+ Enable MetaGPT to self-evolve, accomplishing self-training, fine-tuning, optimization, utilization, and updates.
7
+
8
+ ### Short-term Objective
9
+
10
+ 1. Become the multi-agent framework with the highest ROI.
11
+ 2. Support fully automatic implementation of medium-sized projects (around 2000 lines of code).
12
+ 3. Implement most identified tasks, reaching version 0.5.
13
+
14
+ ### Tasks
15
+
16
+ To reach version v0.5, approximately 70% of the following tasks need to be completed.
17
+
18
+ 1. Usability
19
+ 1. Release v0.01 pip package to try to solve issues like npm installation (though not necessarily successfully)
20
+ 2. Support for overall save and recovery of software companies
21
+ 3. Support human confirmation and modification during the process
22
+ 4. Support process caching: Consider carefully whether to add server caching mechanism
23
+ 5. Resolve occasional failure to follow instruction under current prompts, causing code parsing errors, through stricter system prompts
24
+ 6. Write documentation, describing the current features and usage at all levels
25
+ 7. ~~Support Docker~~
26
+ 2. Features
27
+ 1. Support a more standard and stable parser (need to analyze the format that the current LLM is better at)
28
+ 2. ~~Establish a separate output queue, differentiated from the message queue~~
29
+ 3. Attempt to atomize all role work, but this may significantly increase token overhead
30
+ 4. Complete the design and implementation of module breakdown
31
+ 5. Support various modes of memory: clearly distinguish between long-term and short-term memory
32
+ 6. Perfect the test role, and carry out necessary interactions with humans
33
+ 7. Provide full mode instead of the current fast mode, allowing natural communication between roles
34
+ 8. Implement SkillManager and the process of incremental Skill learning
35
+ 9. Automatically get RPM and configure it by calling the corresponding openai page, so that each key does not need to be manually configured
36
+ 3. Strategies
37
+ 1. Support ReAct strategy
38
+ 2. Support CoT strategy
39
+ 3. Support ToT strategy
40
+ 4. Support Reflection strategy
41
+ 4. Actions
42
+ 1. Implementation: Search
43
+ 2. Implementation: Knowledge search, supporting 10+ data formats
44
+ 3. Implementation: Data EDA
45
+ 4. Implementation: Review
46
+ 5. Implementation: Add Document
47
+ 6. Implementation: Delete Document
48
+ 7. Implementation: Self-training
49
+ 8. Implementation: DebugError
50
+ 9. Implementation: Generate reliable unit tests based on YAPI
51
+ 10. Implementation: Self-evaluation
52
+ 11. Implementation: AI Invocation
53
+ 12. Implementation: Learning and using third-party standard libraries
54
+ 13. Implementation: Data collection
55
+ 14. Implementation: AI training
56
+ 15. Implementation: Run code
57
+ 16. Implementation: Web access
58
+ 5. Plugins: Compatibility with plugin system
59
+ 6. Tools
60
+ 1. ~~Support SERPER api~~
61
+ 2. ~~Support Selenium apis~~
62
+ 3. ~~Support Playwright apis~~
63
+ 7. Roles
64
+ 1. Perfect the action pool/skill pool for each role
65
+ 2. Red Book blogger
66
+ 3. E-commerce seller
67
+ 4. Data analyst
68
+ 5. News observer
69
+ 6. Institutional researcher
70
+ 8. Evaluation
71
+ 1. Support an evaluation on a game dataset
72
+ 2. Reproduce papers, implement full skill acquisition for a single game role, achieving SOTA results
73
+ 3. Support an evaluation on a math dataset
74
+ 4. Reproduce papers, achieving SOTA results for current mathematical problem solving process
75
+ 9. LLM
76
+ 1. Support Claude underlying API
77
+ 2. ~~Support Azure asynchronous API~~
78
+ 3. Support streaming version of all APIs
79
+ 4. ~~Make gpt-3.5-turbo available (HARD)~~
80
+ 10. Other
81
+ 1. Clean up existing unused code
82
+ 2. Unify all code styles and establish contribution standards
83
+ 3. Multi-language support
84
+ 4. Multi-programming-language support
docs/install/cli_install.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Traditional Command Line Installation
2
+
3
+ ### Support System and version
4
+ | System Version | Python Version | Supported |
5
+ | ---- | ---- | ----- |
6
+ | macOS 13.x | python 3.9 | Yes |
7
+ | Windows 11 | python 3.9 | Yes |
8
+ | Ubuntu 22.04 | python 3.9 | Yes |
9
+
10
+ ### Detail Installation
11
+ ```bash
12
+ # 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.)
13
+ npm --version
14
+ sudo npm install -g @mermaid-js/mermaid-cli
15
+
16
+ # Step 2: Ensure that Python 3.9+ is installed on your system. You can check this by using:
17
+ python3 --version
18
+
19
+ # Step 3: Clone the repository to your local machine, and install it.
20
+ git clone https://github.com/geekan/MetaGPT.git
21
+ cd MetaGPT
22
+ pip install -e.
23
+ ```
24
+
25
+ **Note:**
26
+
27
+ - If already have Chrome, Chromium, or MS Edge installed, you can skip downloading Chromium by setting the environment variable
28
+ `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true`.
29
+
30
+ - Some people are [having issues](https://github.com/mermaidjs/mermaid.cli/issues/15) installing this tool globally. Installing it locally is an alternative solution,
31
+
32
+ ```bash
33
+ npm install @mermaid-js/mermaid-cli
34
+ ```
35
+
36
+ - don't forget to the configuration for mmdc in config.yml
37
+
38
+ ```yml
39
+ PUPPETEER_CONFIG: "./config/puppeteer-config.json"
40
+ MMDC: "./node_modules/.bin/mmdc"
41
+ ```
42
+
43
+ - 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`
44
+
45
+ - 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.
46
+
47
+ - Playwright
48
+ - **Install Playwright**
49
+
50
+ ```bash
51
+ pip install playwright
52
+ ```
53
+
54
+ - **Install the Required Browsers**
55
+
56
+ to support PDF conversion, please install Chrominum.
57
+
58
+ ```bash
59
+ playwright install --with-deps chromium
60
+ ```
61
+
62
+ - **modify `config.yaml`**
63
+
64
+ uncomment MERMAID_ENGINE from config.yaml and change it to `playwright`
65
+
66
+ ```yaml
67
+ MERMAID_ENGINE: playwright
68
+ ```
69
+
70
+ - pyppeteer
71
+ - **Install pyppeteer**
72
+
73
+ ```bash
74
+ pip install pyppeteer
75
+ ```
76
+
77
+ - **Use your own Browsers**
78
+
79
+ pyppeteer allows you use installed browsers, please set the following envirment
80
+
81
+ ```bash
82
+ export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome
83
+ ```
84
+
85
+ please do not use this command to install browser, it is too old
86
+
87
+ ```bash
88
+ pyppeteer-install
89
+ ```
90
+
91
+ - **modify `config.yaml`**
92
+
93
+ uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer`
94
+
95
+ ```yaml
96
+ MERMAID_ENGINE: pyppeteer
97
+ ```
98
+
99
+ - mermaid.ink
100
+ - **modify `config.yaml`**
101
+
102
+ uncomment MERMAID_ENGINE from config.yaml and change it to `ink`
103
+
104
+ ```yaml
105
+ MERMAID_ENGINE: ink
106
+ ```
107
+
108
+ Note: this method does not support pdf export.
109
+
docs/install/cli_install_cn.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 命令行安装
2
+
3
+ ### 支持的系统和版本
4
+ | 系统版本 | Python 版本 | 是否支持 |
5
+ | ---- | ---- | ----- |
6
+ | macOS 13.x | python 3.9 | 是 |
7
+ | Windows 11 | python 3.9 | 是 |
8
+ | Ubuntu 22.04 | python 3.9 | 是 |
9
+
10
+ ### 详细安装
11
+
12
+ ```bash
13
+ # 第 1 步:确保您的系统上安装了 NPM。并使用npm安装mermaid-js
14
+ npm --version
15
+ sudo npm install -g @mermaid-js/mermaid-cli
16
+
17
+ # 第 2 步:确保您的系统上安装了 Python 3.9+。您可以使用以下命令进行检查:
18
+ python --version
19
+
20
+ # 第 3 步:克隆仓库到您的本地机器,并进行安装。
21
+ git clone https://github.com/geekan/MetaGPT.git
22
+ cd MetaGPT
23
+ pip install -e.
24
+ ```
25
+
26
+ **注意:**
27
+
28
+ - 如果已经安装了Chrome、Chromium或MS Edge,可以通过将环境变量`PUPPETEER_SKIP_CHROMIUM_DOWNLOAD`设置为`true`来跳过下载Chromium。
29
+
30
+ - 一些人在全局安装此工具时遇到问题。在本地安装是替代解决方案,
31
+
32
+ ```bash
33
+ npm install @mermaid-js/mermaid-cli
34
+ ```
35
+
36
+ - 不要忘记在config.yml中为mmdc配置配置,
37
+
38
+ ```yml
39
+ PUPPETEER_CONFIG: "./config/puppeteer-config.json"
40
+ MMDC: "./node_modules/.bin/mmdc"
41
+ ```
42
+
43
+ - 如果`pip install -e.`失败并显示错误`[Errno 13] Permission denied: '/usr/local/lib/python3.11/dist-packages/test-easy-install-13129.write-test'`,请尝试使用`pip install -e. --user`运行。
docs/install/docker_install.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Docker Installation
2
+
3
+ ### Use default MetaGPT image
4
+
5
+ ```bash
6
+ # Step 1: Download metagpt official image and prepare config.yaml
7
+ docker pull metagpt/metagpt:latest
8
+ mkdir -p /opt/metagpt/{config,workspace}
9
+ docker run --rm metagpt/metagpt:latest cat /app/metagpt/config/config.yaml > /opt/metagpt/config/key.yaml
10
+ vim /opt/metagpt/config/key.yaml # Change the config
11
+
12
+ # Step 2: Run metagpt demo with container
13
+ docker run --rm \
14
+ --privileged \
15
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
16
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
17
+ metagpt/metagpt:latest \
18
+ python3 startup.py "Write a cli snake game"
19
+
20
+ # You can also start a container and execute commands in it
21
+ docker run --name metagpt -d \
22
+ --privileged \
23
+ -v /opt/metagpt/config/key.yaml:/app/metagpt/config/key.yaml \
24
+ -v /opt/metagpt/workspace:/app/metagpt/workspace \
25
+ metagpt/metagpt:latest
26
+
27
+ docker exec -it metagpt /bin/bash
28
+ $ python3 startup.py "Write a cli snake game"
29
+ ```
30
+
31
+ The command `docker run ...` do the following things:
32
+
33
+ - Run in privileged mode to have permission to run the browser
34
+ - Map host configure file `/opt/metagpt/config/key.yaml` to container `/app/metagpt/config/key.yaml`
35
+ - Map host directory `/opt/metagpt/workspace` to container `/app/metagpt/workspace`
36
+ - Execute the demo command `python3 startup.py "Write a cli snake game"`
37
+
38
+ ### Build image by yourself
39
+
40
+ ```bash
41
+ # You can also build metagpt image by yourself.
42
+ git clone https://github.com/geekan/MetaGPT.git
43
+ cd MetaGPT && docker build -t metagpt:custom .
44
+ ```