Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGX #1559

Open
wants to merge 1,315 commits into
base: main
Choose a base branch
from
Open

MGX #1559

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1315 commits
Select commit Hold shift + click to select a range
0a1d0e7
Merge branch 'gitlab/mgx_ops' into feature/rfc258
Sep 2, 2024
1976142
fixbug: circular import
Sep 2, 2024
eb38332
fixbug: circular import
Sep 2, 2024
57b57f8
fixbug: circular import
Sep 2, 2024
f365b1f
fixbug: circular import
Sep 2, 2024
d6a6e56
fixbug: error:/bin/sh: 1: Syntax error: "(" unexpected
Sep 2, 2024
4605554
fixbug: _is_fingerprint_changed
Sep 2, 2024
ef846e5
feat: +log
Sep 2, 2024
10b5515
Update the prompt to include the editor and terminal state
Sep 2, 2024
eaf949f
feat: +log
Sep 2, 2024
68c10d0
update engineer2 cmd prompt
Sep 2, 2024
12e0fc7
feat: +log
Sep 2, 2024
a2b2127
feat: +log
Sep 2, 2024
86cc30b
feat: + comments
Sep 2, 2024
100d5af
add SearchQA to DA & Engineer2, add Editor for DA write code
garylin2099 Sep 3, 2024
4ddabd0
guide engineer2 to use editor
Sep 3, 2024
1c872c3
Swe editer
Sep 4, 2024
59fc7b3
Merge branch 'swe_editer' into 'mgx_ops'
garylin2099 Sep 4, 2024
6168690
feat: - knowledge.md
Sep 4, 2024
d5c29a1
Merge branch 'gitlab/mgx_ops' into feature/rfc258
Sep 4, 2024
44d82d3
expand mem window to 100
garylin2099 Sep 4, 2024
cd8bd28
feat: model: Optional[str] = None
Sep 4, 2024
9c4788a
estimate software req complexity before assignment
garylin2099 Sep 4, 2024
a9d0ab2
feat: min_token_count=10k
Sep 4, 2024
efd253a
Merge branch 'opt_speed_quality' into 'mgx_ops'
garylin2099 Sep 4, 2024
76049d9
feat: +comments
Sep 4, 2024
ed0b9e3
feat: +comments
Sep 4, 2024
aa71012
feat: persist_path
Sep 4, 2024
ac29811
Merge branch 'feature/rfc258' into 'mgx_ops'
garylin2099 Sep 4, 2024
1eb3b8f
feat: /data/.index/chats/chat_id
Sep 4, 2024
33b9c57
fix/insert_more_than_one_pre_rsp
Sep 4, 2024
2837dc1
Merge branch 'mgx_ops' into add_swe_agent_ablilities_to_engineer2
Sep 4, 2024
5dcde29
update run swe bench script
Sep 4, 2024
33ac8c5
increase mem window
garylin2099 Sep 5, 2024
c183530
add editor reporter
shenchucheng Sep 5, 2024
2157fea
Merge branch 'feature-editor-reporter' into 'add_swe_agent_ablilities…
garylin2099 Sep 5, 2024
3507513
update: cr增加兜底提示
Sep 5, 2024
c2f9f01
update_engineer_and_editorprompt
Sep 5, 2024
7d859a1
Merge branch 'add_swe_agent_ablilities_to_engineer2' of https://gitla…
Sep 5, 2024
4523615
feat: +Editor.search_index_repo
Sep 5, 2024
8202b32
Merge branch 'mgx_ops' of https://gitlab.deepwisdomai.com/pub/MetaGPT…
Sep 5, 2024
f0c980b
feat: +comments
Sep 5, 2024
93b5716
update: cr增加兜底提示
Sep 5, 2024
285a6bf
feat: +DEFAULT_MIN_TOKEN_COUNT
Sep 5, 2024
ac44f41
update: cr增加兜底提示
Sep 5, 2024
9f4dcf0
Merge remote-tracking branch 'origin/mgx_ops' into feat_zhg
Sep 5, 2024
b4e122a
Merge branch 'feat_zhg' into 'mgx_ops'
Justin-ZL Sep 5, 2024
4254480
revert sweagent to use bash
garylin2099 Sep 5, 2024
ad80dab
feat: +pdf
Sep 5, 2024
e9d7556
add current time for search qa
garylin2099 Sep 5, 2024
3f22d9e
format
garylin2099 Sep 5, 2024
5687b2c
Merge branch 'opt_speed_quality' into 'mgx_ops'
garylin2099 Sep 5, 2024
5aab975
update engineer prompt
Sep 5, 2024
166eb2d
Merge branch 'mgx_ops' into add_swe_agent_ablilities_to_engineer2
Sep 5, 2024
b8e023d
update engineer2 prompt
Sep 5, 2024
32365ad
update engineer2 prompt
Sep 5, 2024
f20d3ca
use long-term memory in rolezero
seehi Sep 6, 2024
93d4c8c
fix conflict
seehi Sep 6, 2024
0f7630e
fix conflict
seehi Sep 6, 2024
95bf4c3
feat: search时不必设置IndexRepo的min/max_token_count
Sep 6, 2024
53ef7be
update comment
seehi Sep 6, 2024
4063186
update run_swe_bechmark script
Sep 6, 2024
a68f9ef
Remove duplicate '_act' in engineer.
Sep 6, 2024
6e49c24
update comment
Sep 6, 2024
6a57cb5
feat: search_index_repo path or filename
Sep 6, 2024
8d93f57
Merge branch 'add_swe_agent_ablilities_to_engineer2' into 'mgx_ops'
garylin2099 Sep 6, 2024
291615b
update swe_bench script
Sep 6, 2024
85c1d07
refactor: cross_repo_search
Sep 6, 2024
78bfc9b
update run_swe_agent_benchmark
Sep 6, 2024
d484182
Merge branch 'add_swe_agent_ablilities_to_engineer2' into run_swe_age…
Sep 6, 2024
fdf2a0e
Merge branch 'feature/rfc258_editor' into 'mgx_ops'
Justin-ZL Sep 9, 2024
5eb3a21
update run_swe_agent_benchmark
Sep 9, 2024
1797fdc
fix conflict
seehi Sep 9, 2024
e2600c0
update comment
seehi Sep 9, 2024
047f1e4
Keep user and AI messages are paired
seehi Sep 9, 2024
31dbff5
Keep user and AI messages are paired
seehi Sep 9, 2024
dbefcb9
remove requirement analyze
Sep 9, 2024
a34394e
Reinforce the default programming languages.
Sep 9, 2024
6365995
remove requirements_constraints
Sep 9, 2024
6896c34
Merge branch 'run_swe_agent_benchmark_script' into 'mgx_ops'
garylin2099 Sep 10, 2024
3de17e5
remove .html file
Sep 10, 2024
8324947
feat: mermaid + font
Sep 10, 2024
5d21d25
update
seehi Sep 10, 2024
a94e282
Merge branch 'feature/mermaid_font' into 'mgx_ops'
garylin2099 Sep 10, 2024
d077cd0
use memory index to get the last user message
seehi Sep 10, 2024
daea102
fixbug: 如果index_builder异常未及时建索引,则自动建索引以防max token
Sep 11, 2024
cb1d0f7
use pure javascript
Sep 11, 2024
b262e5d
automated get image
Sep 11, 2024
2857a99
fix prompt issues.
Sep 11, 2024
81dd72b
update prompt
Sep 11, 2024
d9dacb6
update prompt
Sep 11, 2024
c0d5c03
Change the way of taking over memory
seehi Sep 11, 2024
05221a5
feat: IndexRepo + config
Sep 11, 2024
71f670b
fix:editor can not replace text in empty file
Sep 11, 2024
40a71de
Merge branch 'opt_requirement_analyze' into 'mgx_ops'
garylin2099 Sep 11, 2024
56e4bab
fix issues
Sep 12, 2024
72b23ee
Merge branch 'mgx_ops' of https://gitlab.deepwisdomai.com/pub/MetaGPT…
Sep 12, 2024
4dd51de
Merge branch 'fix/editor_replace_empty_file' into 'mgx_ops'
garylin2099 Sep 12, 2024
42ae38a
feat: +search_index_repo
Sep 12, 2024
3d6286c
feat: rename similarity_search
Sep 12, 2024
cf3b80d
add `enable_longterm_memory` config
seehi Sep 12, 2024
d9ab81b
add `enable_longterm_memory` config
seehi Sep 12, 2024
12d643a
feat: rename similarity_search
Sep 12, 2024
99e5a73
add `enable_longterm_memory` config
seehi Sep 12, 2024
ea9582c
add `enable_longterm_memory` config
seehi Sep 12, 2024
513d131
feat: +similarity_search
Sep 12, 2024
65dc47c
fix code issues
Sep 12, 2024
00cdbbb
feat: +similarity_search
Sep 12, 2024
3d1691a
feat: upload_path
Sep 12, 2024
d7abceb
update comment
Sep 12, 2024
a16535f
add handle_exception
seehi Sep 12, 2024
a939efc
Merge branch 'mgx_ops' into automated-get-image
Sep 12, 2024
b587e81
change metadata typing
seehi Sep 12, 2024
223850c
feat: chat_id
Sep 12, 2024
1c4a819
Merge branch 'fix-metadata-typing' into 'mgx_ops'
Justin-ZL Sep 12, 2024
b8c5e5f
fixbug: files not add to index
Sep 12, 2024
307a6c4
fixbug: files not add to index
Sep 12, 2024
f66cace
feat: +unittest
Sep 12, 2024
e0a104d
write_new_code_fail
Sep 12, 2024
ef9bb21
feat: +unit test
Sep 12, 2024
fdeb43d
update: create a pr to get git access token
Justin-ZL Sep 12, 2024
c9d723d
Merge branch 'git_token' into 'mgx_ops'
Justin-ZL Sep 12, 2024
40b54b4
update: git.py
Justin-ZL Sep 12, 2024
ba6264a
Merge branch 'git_token' into 'mgx_ops'
Justin-ZL Sep 12, 2024
d630d72
update:git.py
Justin-ZL Sep 12, 2024
49b5c7f
Merge branch 'git_token' into 'mgx_ops'
Justin-ZL Sep 12, 2024
09f2546
ignore the lastest command in write new code.
Sep 12, 2024
cf4a449
Merge branch 'automated-get-image' into 'mgx_ops'
garylin2099 Sep 12, 2024
190405a
editor use tmpfile to backup
Sep 12, 2024
b9c74ed
Merge branch 'fix/write_new_code_fail' into 'mgx_ops'
garylin2099 Sep 12, 2024
47bc87d
engineer2 must use browser before git clone.
Sep 13, 2024
be2868d
replace default web technologies to native HTML
Sep 13, 2024
b22d96d
feat: -pdf
Sep 13, 2024
fa68d07
use start_line_number and end_line_number to guide editor.replace
Sep 13, 2024
99d8cbc
fix issues
Sep 13, 2024
baabcf2
Merge branch 'mgx_ops' into fix/engineer_edit_fail
Sep 13, 2024
e4f9af9
fix issues
Sep 13, 2024
72f2aaa
enlarge print_window
Sep 13, 2024
ed0dd9b
update test editor
Sep 13, 2024
aa5b78a
feat: Editor.read + large file check
Sep 13, 2024
2cae99f
delete an empty line
Sep 14, 2024
a80b41d
ignore javascirip validation and add tool_selector in editr class
Sep 14, 2024
384dc78
add engineer2 test script
Sep 14, 2024
120e928
update: pwd not report
Justin-ZL Sep 14, 2024
9d5e871
update: pwd not report
Justin-ZL Sep 14, 2024
726dc65
Update the editor parameters and enhance the engineer experience.
Sep 14, 2024
d6adc24
Merge branch 'fix/engineer_edit_fail' of https://gitlab.deepwisdomai.…
Sep 14, 2024
3ee4bf9
fix typo
Sep 18, 2024
9afb00d
feat: merge mgx_ops
Sep 18, 2024
b112074
fix:line_number and line_content parameters mismatch
Sep 18, 2024
a8aaece
remove the outdated editor results.
Sep 18, 2024
e495ea9
fix:line numbers and line contents do not match.
Sep 19, 2024
d37954d
feat: 优化代码
Sep 19, 2024
deb8bb6
fix:command exists in the code file
Sep 19, 2024
1fa2075
fix typo
Sep 19, 2024
45b20f9
Update terminal.py
shenchucheng Sep 19, 2024
8eab27e
add rule to forbiden repeat finish current task
Sep 20, 2024
486c12e
Merge branch 'fix/engineer_edit_fail' of https://gitlab.deepwisdomai.…
Sep 20, 2024
dccd199
feat: Editor.read + file size检查
Sep 20, 2024
e6b0ba8
Merge branch 'fix/engineer_edit_fail' into 'mgx_ops'
garylin2099 Sep 20, 2024
27f5c0a
feat: +report
Sep 20, 2024
00e4cd9
feat: +report
Sep 20, 2024
7b6dc3d
update llmranker prompt
seehi Sep 20, 2024
57b6108
opt RoleZeroLongTermMemory init
seehi Sep 23, 2024
59d94f7
opt RoleZeroLongTermMemory init
seehi Sep 23, 2024
c69752a
update comment
seehi Sep 24, 2024
2637af2
add static coding instrction in engineer prompt
Sep 25, 2024
eda046f
add incremental development sample in quick think example
Sep 25, 2024
e0ec17e
Merge branch 'feat-memory-opt' into 'mgx_ops'
garylin2099 Sep 25, 2024
a9ec57d
Merge branch 'fixbug/index_max_token' into 'mgx_ops'
garylin2099 Sep 25, 2024
4ea8793
feat: rename file_or_path -> path
Sep 25, 2024
abf988a
Merge branch 'fixbug/similarity_search' into 'mgx_ops'
Justin-ZL Sep 25, 2024
3598c5c
The team leader can only send one message per round.
Sep 25, 2024
722bb72
fix typo
Sep 25, 2024
128312b
Fix: Engineer do not complete all the unit tests task
Sep 25, 2024
955ec26
Add a function to analyze human responses.
Sep 26, 2024
e343def
fix typo
Sep 27, 2024
5cda228
fix typo
Sep 27, 2024
1e004d7
fix typo
Sep 27, 2024
1a937e9
add ask_human to special command list
Sep 27, 2024
cff6f66
fix typo
Sep 27, 2024
f03f2c4
Merge branch 'fix/engineer_write_command_in_code_file' into 'mgx_ops'
garylin2099 Sep 29, 2024
7c0adf5
make the longterm-memory path configurable
seehi Sep 29, 2024
58907d0
create parent folder in Editor.create_file
Sep 29, 2024
b7ef5d6
user commom.awrite in Editr.create_file
Sep 29, 2024
9b854b8
Merge branch 'fix/create_parent_folder_in_Editor.create_file' into 'm…
garylin2099 Sep 29, 2024
f8e4e3a
Merge branch 'feat-memory-opt' into 'mgx_ops'
better629 Sep 29, 2024
7407253
remove llmranker
seehi Sep 29, 2024
4cdbb5e
Merge branch 'feat-memory-opt' into 'mgx_ops'
Justin-ZL Sep 29, 2024
6abebf0
create React/Vue project
Oct 10, 2024
823280c
keep original Architecture and Product Manager
Oct 11, 2024
44bfe1a
fix typo
Oct 11, 2024
67e491d
fix typo
Oct 11, 2024
c95a925
Merge branch 'feature/create_react_project' into 'mgx_ops'
garylin2099 Oct 11, 2024
2965a22
make memory_k configurable
seehi Oct 11, 2024
dd955c8
make similarity_top_k configurable
seehi Oct 11, 2024
444dd1a
check empty content
seehi Oct 11, 2024
be78b10
Merge branch 'fix-memory-opt' into 'mgx_ops'
Justin-ZL Oct 11, 2024
b81c00a
add Deployer tool
Oct 11, 2024
151a171
fobidden using "npm run dev" in terminal
Oct 11, 2024
1b07a42
forbidden npm run dev command
Oct 12, 2024
86ad3ed
Move cmd restrictions from RoleZero to the terminal
Oct 12, 2024
155bf66
Merge branch 'add_deployer_tool_to_engineer' into 'mgx_ops'
garylin2099 Oct 12, 2024
b43ec68
fix deploer can not serialize
Oct 12, 2024
21ddacd
Merge branch 'add_deployer_tool_to_engineer' into fix/deployer_can_no…
Oct 12, 2024
c280fcd
fix delopy path
Oct 12, 2024
253853e
add
Oct 12, 2024
b9cfc29
fix typo
Oct 12, 2024
155da2d
fix typo
Oct 12, 2024
6ae3317
Merge branch 'fix/deployer_can_not_serialisze' into 'mgx_ops'
garylin2099 Oct 12, 2024
dfb8e31
Set deploy_to_public to be asynchronous
Oct 12, 2024
c8ad152
Merge branch 'fix/deploy_function_must_be_async' into 'mgx_ops'
garylin2099 Oct 12, 2024
63abddd
make use_llm_ranker configurable
seehi Oct 12, 2024
80cc5d6
make use_llm_ranker configurable
seehi Oct 12, 2024
68f9267
switch to public chat
garylin2099 Oct 12, 2024
d925d13
rm fixed sop logic from mgx_env to simplify code
garylin2099 Oct 12, 2024
b57f6c4
make quick think msg also public
garylin2099 Oct 14, 2024
4bd7937
quick think tag
garylin2099 Oct 14, 2024
d979556
pm watch UserRequirement if fixed sop
garylin2099 Oct 14, 2024
2b2e4ab
revert to watch user requirement by default
garylin2099 Oct 14, 2024
1fa0abf
add comments
garylin2099 Oct 15, 2024
a5a7324
Enhance the engineer's understanding of the template.
Oct 15, 2024
3b8740f
update prompt: report url when respond and summary
Oct 15, 2024
ebea2c0
Merge branch 'fix/use_template_bad_case' into 'mgx_ops'
garylin2099 Oct 15, 2024
a41956f
fix bad cases
Oct 15, 2024
e2d1037
Merge branch 'fix/react_template_bad_cases' into 'mgx_ops'
garylin2099 Oct 15, 2024
6f40dc6
Merge branch 'public_chat' into 'mgx_ops'
garylin2099 Oct 16, 2024
ff79389
refactor_the_architect
Oct 17, 2024
31e0a46
Merge branch 'feat-memory-opt' into 'mgx_ops'
Justin-ZL Oct 18, 2024
2a53e30
update architect prompt
Oct 18, 2024
2567934
Update openai_api.py
better629 Oct 18, 2024
6879c93
Merge branch 'betterwang-mgx_ops-patch-18744' into 'mgx_ops'
better629 Oct 18, 2024
4067127
Generate mermaid files after completing the system design.
Oct 21, 2024
e531dd9
fix engineer2 prompt
Oct 21, 2024
1ac1da0
Fix: "```mermaid```" exists in the Mermaid file
Oct 21, 2024
b80f8c4
fix typo
Oct 21, 2024
d16bafe
improve fault tolerance when try to stop in ask_human action
Oct 21, 2024
70804d9
Merge branch 'feature/refactor_the_architect' into 'mgx_ops'
garylin2099 Oct 21, 2024
971e9c7
resolve the template path
Oct 21, 2024
3f0227a
Merge branch 'fix/add_dynamic_template_root' into 'mgx_ops'
garylin2099 Oct 21, 2024
1402e79
stop stream report if CancelledError
shenchucheng Oct 23, 2024
6e5dfc1
Merge branch 'fix-stream-report-error' into 'mgx_ops'
Justin-ZL Oct 24, 2024
f9b0262
update: 软件公司重构
Oct 25, 2024
b51dbcd
update: 更新产品需求默认编程语言
Oct 25, 2024
76e641a
update: 根据 CR 意见修改
Oct 29, 2024
806853b
update
Oct 29, 2024
29af174
Merge branch 'product_manager' into 'mgx_ops'
garylin2099 Oct 29, 2024
1c3bb42
rm unused
garylin2099 Oct 31, 2024
01ed973
rm unused da example
garylin2099 Oct 31, 2024
8fe00a1
Merge branch 'rm_unused' into 'mgx_ops'
garylin2099 Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ examples/graph_store.json
examples/image__vector_store.json
examples/index_store.json
.chroma
.chroma_exp_data
.role_memory_data
*~$*
workspace/*
tmp
Expand All @@ -188,3 +190,4 @@ cov.xml
*-structure.json
*.dot
.python-version
tests/data/requirements/*.jpg
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM nikolaik/python-nodejs:python3.9-nodejs20-slim

# Install Debian software needed by MetaGPT and clean up in one RUN command to reduce image size
RUN apt update &&\
apt install -y libgomp1 git chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends &&\
apt install -y libgomp1 git chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends file &&\
apt clean && rm -rf /var/lib/apt/lists/*

# Install Mermaid CLI globally
Expand Down
46 changes: 46 additions & 0 deletions config/config2.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,37 @@ llm:
# - gpt-4 8k: "gpt-4"
# See for more: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/

# Role's custom configuration
roles:
- role: "ProductManager" # role's className or role's role_id
llm:
api_type: "openai" # or azure / ollama / open_llm etc. Check LLMType for more options
base_url: "YOUR_BASE_URL"
api_key: "YOUR_API_KEY"
proxy: "YOUR_PROXY" # for LLM API requests
model: "gpt-4-turbo-1106"
- role: "Architect"
llm:
api_type: "openai" # or azure / ollama / open_llm etc. Check LLMType for more options
base_url: "YOUR_BASE_URL"
api_key: "YOUR_API_KEY"
proxy: "YOUR_PROXY" # for LLM API requests
model: "gpt-35-turbo"
- role: "ProjectManager"
llm:
api_type: "azure"
base_url: "YOUR_BASE_URL"
api_key: "YOUR_API_KEY"
api_version: "YOUR_API_VERSION"
model: "gpt-4-1106"
- role: "Engineer"
llm:
api_type: "azure"
base_url: "YOUR_BASE_URL"
api_key: "YOUR_API_KEY"
api_version: "YOUR_API_VERSION"
model: "gpt-35-turbo-1106"

repair_llm_output: true # when the output is not a valid json, try to repair it

proxy: "YOUR_PROXY" # for tools like requests, playwright, selenium, etc.
Expand Down Expand Up @@ -43,6 +74,21 @@ s3:
secure: false
bucket: "test"

exp_pool:
enabled: false
enable_read: false
enable_write: false
persist_path: .chroma_exp_data # The directory.
retrieval_type: bm25 # Default is `bm25`, can be set to `chroma` for vector storage, which requires setting up embedding.
use_llm_ranker: true # Default is `true`, it will use LLM Reranker to get better result.
collection_name: experience_pool # When `retrieval_type` is `chroma`, `collection_name` is the collection name in chromadb.

role_zero:
enable_longterm_memory: false # Whether to use long-term memory. Default is `false`.
longterm_memory_persist_path: .role_memory_data # The directory to save data.
memory_k: 200 # The capacity of short-term memory.
similarity_top_k: 5 # The number of long-term memories to retrieve.
use_llm_ranker: false # Whether to use LLM Reranker to get better result. Default is `false`.

azure_tts_subscription_key: "YOUR_SUBSCRIPTION_KEY"
azure_tts_region: "eastus"
Expand Down
48 changes: 48 additions & 0 deletions config/vault.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Usage:
# 1. Get value.
# >>> from metagpt.tools.libs.env import get_env
# >>> access_token = await get_env(key="access_token", app_name="github")
# >>> print(access_token)
# YOUR_ACCESS_TOKEN
#
# 2. Get description for LLM understanding.
# >>> from metagpt.tools.libs.env import get_env_description
# >>> descriptions = await get_env_description
# >>> for k, desc in descriptions.items():
# >>> print(f"{key}:{desc}")
# await get_env(key="access_token", app_name="github"):Get github access token
# await get_env(key="access_token", app_name="gitlab"):Get gitlab access token
# ...

vault:
github:
values:
access_token: "YOUR_ACCESS_TOKEN"
descriptions:
access_token: "Get github access token"
gitlab:
values:
access_token: "YOUR_ACCESS_TOKEN"
descriptions:
access_token: "Get gitlab access token"
iflytek_tts:
values:
api_id: "YOUR_APP_ID"
api_key: "YOUR_API_KEY"
api_secret: "YOUR_API_SECRET"
descriptions:
api_id: "Get the API ID of IFlyTek Text to Speech"
api_key: "Get the API KEY of IFlyTek Text to Speech"
api_secret: "Get the API SECRET of IFlyTek Text to Speech"
azure_tts:
values:
subscription_key: "YOUR_SUBSCRIPTION_KEY"
region: "YOUR_REGION"
descriptions:
subscription_key: "Get the subscription key of Azure Text to Speech."
region: "Get the region of Azure Text to Speech."
default: # All key-value pairs whose app name is an empty string are placed below
values:
proxy: "YOUR_PROXY"
descriptions:
proxy: "Get proxy for tools like requests, playwright, selenium, etc."
3 changes: 2 additions & 1 deletion examples/agent_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import re

from metagpt.actions import Action
from metagpt.config2 import config
from metagpt.config2 import Config
from metagpt.const import METAGPT_ROOT
from metagpt.logs import logger
from metagpt.roles import Role
from metagpt.schema import Message

config = Config.default()
EXAMPLE_CODE_FILE = METAGPT_ROOT / "examples/build_customized_agent.py"
MULTI_ACTION_AGENT_CODE_EXAMPLE = EXAMPLE_CODE_FILE.read_text()

Expand Down
15 changes: 15 additions & 0 deletions examples/cr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fire

from metagpt.roles.di.engineer2 import Engineer2
from metagpt.tools.libs.cr import CodeReview


async def main(msg):
role = Engineer2(tools=["Plan", "Editor:write,read", "RoleZero", "ValidateAndRewriteCode", "CodeReview"])
cr = CodeReview()
role.tool_execution_map.update({"CodeReview.review": cr.review, "CodeReview.fix": cr.fix})
await role.run(msg)


if __name__ == "__main__":
fire.Fire(main)
24 changes: 24 additions & 0 deletions examples/data/exp_pool/engineer_exps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[
{
"req": [
{
"role": "user",
"content": "\n# Current Plan\n{'goal': \"Please write a 1048 game using JavaScript and HTML code without using any frameworks, user can play with keyboard. Refer to the system design located at '/tmp/system_design.json' and the project schedule at '/tmp/project_schedule.json' for detailed information.\", 'tasks': []}\n\n# Current Task\n\n\n# Instruction\nBased on the context, write a plan or modify an existing plan to achieve the goal. A plan consists of one to 3 tasks.\nIf plan is created, you should track the progress and update the plan accordingly, such as Plan.finish_current_task, Plan.append_task, Plan.reset_task, Plan.replace_task, etc.\nWhen presented a current task, tackle the task using the available commands.\nPay close attention to new user message, review the conversation history, use RoleZero.reply_to_human to respond to new user requirement.\nNote:\n1. If you keeping encountering errors, unexpected situation, or you are not sure of proceeding, use RoleZero.ask_human to ask for help.\n2. Carefully review your progress at the current task, if your actions so far has not fulfilled the task instruction, you should continue with current task. Otherwise, finish current task.\n3. Each time you finish a task, use RoleZero.reply_to_human to report your progress.\n4. Each time you write a code in your response, write with the Editor directly without preparing a repetitive code block beforehand.\n5. Take on ONE task and write ONE code file in each response. DON'T attempt all tasks in one response.\n6. When not specified, you should write files in a folder named \"src\". If you know the project path, then write in a \"src\" folder under the project path.\n7. When provided system design or project schedule, you MUST read them first before making a plan, then adhere to them in your implementation, especially in the programming language, package, or framework. You MUST implement all code files prescribed in the system design or project schedule. You can create a plan first with each task corresponding to implementing one code file.\n8. Write at most one file per task, do your best to implement THE ONLY ONE FILE. CAREFULLY CHECK THAT YOU DONT MISS ANY NECESSARY CLASS/FUNCTION IN THIS FILE.\n9. COMPLETE CODE: Your code will be part of the entire project, so please implement complete, reliable, reusable code snippets.\n10. When provided system design, YOU MUST FOLLOW \"Data structures and interfaces\". DONT CHANGE ANY DESIGN. Do not use public member functions that do not exist in your design.\n11. Write out EVERY CODE DETAIL, DON'T LEAVE TODO.\n12. To modify code in a file, read the entire file, make changes, and update the file with the complete code, ensuring that no line numbers are included in the final write.\n13. When a system design or project schedule is provided, at the end of the plan, add a CodeRview Task for each file; for example, if there are three files, add three CodeRview Tasks. For each CodeRview Task, just call ValidateAndRewriteCode.run.\n"
}
],
"resp": "\nExplanation: To begin the task of creating a 2048 game using JavaScript and HTML, I need to first read the system design and project schedule documents to understand the specific requirements and architecture outlined for the game development.\n\n```json\n[\n {\n \"command_name\": \"Editor.read\",\n \"args\": {\n \"path\": \"/tmp/system_design.json\"\n }\n },\n {\n \"command_name\": \"Editor.read\",\n \"args\": {\n \"path\": \"/tmp/project_schedule.json\"\n }\n }\n]\n```\n"
},
{
"req": [
{
"role": "user",
"content": "Command Editor.read executed: file_path='/tmp/system_design.json' block_content='001|{\"Implementation approach\":\"We will implement the 2048 game using plain JavaScript and HTML, ensuring no frameworks are used. The game logic will handle tile movements, merging, and game state updates. The UI will be simple and clean, with a responsive design to fit different screen sizes. We will use CSS for styling and ensure the game is playable with keyboard arrow keys. The game will display the current score, have a restart button, and show a game over message when no more moves are possible.\",\"File list\":[\"index.html\",\"style.css\",\"script.js\"],\"Data structures and interfaces\":\"\\\\nclassDiagram\\\\n class Game {\\\\n -grid: int[][]\\\\n -score: int\\\\n +init(): void\\\\n +move(direction: str): void\\\\n +merge(direction: str): void\\\\n +isGameOver(): bool\\\\n +restart(): void\\\\n }\\\\n class UI {\\\\n -game: Game\\\\n +init(): void\\\\n +update(): void\\\\n +showGameOver(): void\\\\n +bindEvents(): void\\\\n }\\\\n Game --> UI\\\\n\",\"Program call flow\":\"\\\\nsequenceDiagram\\\\n participant U as UI\\\\n participant G as Game\\\\n U->>G: init()\\\\n G-->>U: return\\\\n U->>U: bindEvents()\\\\n U->>G: move(direction)\\\\n G->>G: merge(direction)\\\\n G->>U: update()\\\\n U->>U: update()\\\\n U->>G: isGameOver()\\\\n G-->>U: return bool\\\\n alt Game Over\\\\n U->>U: showGameOver()\\\\n end\\\\n U->>G: restart()\\\\n G-->>U: return\\\\n\",\"Anything UNCLEAR\":\"Clarify if there are any specific design preferences or additional features required beyond the basic 2048 game functionality.\"}\\n'\n\nCommand Editor.read executed: file_path='/tmp/project_schedule.json' block_content='001|{\"Required packages\":[\"No third-party dependencies required\"],\"Required Other language third-party packages\":[\"No third-party dependencies required\"],\"Logic Analysis\":[[\"script.js\",\"Contains Game and UI classes, and their methods: init, move, merge, isGameOver, restart, update, showGameOver, bindEvents\"],[\"index.html\",\"Contains the HTML structure for the game UI\"],[\"style.css\",\"Contains the CSS styles for the game UI\"]],\"Task list\":[\"index.html\",\"style.css\",\"script.js\"],\"Full API spec\":\"\",\"Shared Knowledge\":\"The `script.js` file will contain the core game logic and UI handling. The `index.html` file will provide the structure for the game, and `style.css` will handle the styling.\",\"Anything UNCLEAR\":\"Clarify if there are any specific design preferences or additional features required beyond the basic 2048 game functionality.\"}\\n'"
},
{
"role": "user",
"content": "\n# Current Plan\n{'goal': \"Please write a 1048 game using JavaScript and HTML code without using any frameworks, user can play with keyboard. Refer to the system design located at '/tmp/system_design.json' and the project schedule at '/tmp/project_schedule.json' for detailed information.\", 'tasks': []}\n\n# Current Task\n\n\n# Instruction\nBased on the context, write a plan or modify an existing plan to achieve the goal. A plan consists of one to 3 tasks.\nIf plan is created, you should track the progress and update the plan accordingly, such as Plan.finish_current_task, Plan.append_task, Plan.reset_task, Plan.replace_task, etc.\nWhen presented a current task, tackle the task using the available commands.\nPay close attention to new user message, review the conversation history, use RoleZero.reply_to_human to respond to new user requirement.\nNote:\n1. If you keeping encountering errors, unexpected situation, or you are not sure of proceeding, use RoleZero.ask_human to ask for help.\n2. Carefully review your progress at the current task, if your actions so far has not fulfilled the task instruction, you should continue with current task. Otherwise, finish current task.\n3. Each time you finish a task, use RoleZero.reply_to_human to report your progress.\n4. Each time you write a code in your response, write with the Editor directly without preparing a repetitive code block beforehand.\n5. Take on ONE task and write ONE code file in each response. DON'T attempt all tasks in one response.\n6. When not specified, you should write files in a folder named \"src\". If you know the project path, then write in a \"src\" folder under the project path.\n7. When provided system design or project schedule, you MUST read them first before making a plan, then adhere to them in your implementation, especially in the programming language, package, or framework. You MUST implement all code files prescribed in the system design or project schedule. You can create a plan first with each task corresponding to implementing one code file.\n8. Write at most one file per task, do your best to implement THE ONLY ONE FILE. CAREFULLY CHECK THAT YOU DONT MISS ANY NECESSARY CLASS/FUNCTION IN THIS FILE.\n9. COMPLETE CODE: Your code will be part of the entire project, so please implement complete, reliable, reusable code snippets.\n10. When provided system design, YOU MUST FOLLOW \"Data structures and interfaces\". DONT CHANGE ANY DESIGN. Do not use public member functions that do not exist in your design.\n11. Write out EVERY CODE DETAIL, DON'T LEAVE TODO.\n12. To modify code in a file, read the entire file, make changes, and update the file with the complete code, ensuring that no line numbers are included in the final write.\n13. When a system design or project schedule is provided, at the end of the plan, add a CodeRview Task for each file; for example, if there are three files, add three CodeRview Tasks. For each CodeRview Task, just call ValidateAndRewriteCode.run.\n"
}
],
"resp": "\nExplanation: Based on the system design and project schedule, I will create a plan to implement the 2048 game. The plan will consist of tasks to create the necessary files (`index.html`, `style.css`, and `script.js`) and review each file to ensure they meet the design specifications.\n\nHere's the plan:\n\n1. **Task 1**: Create `index.html` - This file will contain the HTML structure necessary for the game's UI.\n2. **Task 2**: Create `style.css` - This file will define the CSS styles to make the game visually appealing and responsive.\n3. **Task 3**: Create `script.js` - This file will contain the JavaScript code for the game logic and UI interactions.\n4. **Code Review Tasks**: Review each file to ensure they meet the project requirements and adhere to the system design.\n\nLet's start by appending the first task to the plan.\n\n```json\n[\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"1\",\n \"dependent_task_ids\": [],\n \"instruction\": \"Create the index.html file with the basic HTML structure for the 2048 game.\",\n \"assignee\": \"Alex\"\n }\n },\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"2\",\n \"dependent_task_ids\": [\"1\"],\n \"instruction\": \"Create the style.css file with the necessary CSS to style the 2048 game.\",\n \"assignee\": \"Alex\"\n }\n },\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"3\",\n \"dependent_task_ids\": [\"1\", \"2\"],\n \"instruction\": \"Create the script.js file containing the JavaScript logic for the 2048 game.\",\n \"assignee\": \"Alex\"\n }\n },\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"4\",\n \"dependent_task_ids\": [\"1\"],\n \"instruction\": \"Use ValidateAndRewriteCode to review the code in index.html to ensure it meets the design specifications.\",\n \"assignee\": \"Alex\"\n }\n },\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"5\",\n \"dependent_task_ids\": [\"2\"],\n \"instruction\": \"Use ValidateAndRewriteCode to review the code in style.css to ensure it meets the design specifications.\",\n \"assignee\": \"Alex\"\n }\n },\n {\n \"command_name\": \"Plan.append_task\",\n \"args\": {\n \"task_id\": \"6\",\n \"dependent_task_ids\": [\"3\"],\n \"instruction\": \"Use ValidateAndRewriteCode to review the code in script.js to ensure it meets the design specifications.\",\n \"assignee\": \"Alex\"\n }\n }\n]\n```\n"
}
]
Loading
Loading