mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
处理冲突
This commit is contained in:
commit
015212d602
17 changed files with 78 additions and 12 deletions
7
.coveragerc
Normal file
7
.coveragerc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[run]
|
||||
source =
|
||||
./metagpt/
|
||||
omit =
|
||||
*/metagpt/environment/android/*
|
||||
*/metagpt/ext/android_assistant/*
|
||||
*/metagpt/ext/werewolf/*
|
||||
1
.gitattributes
vendored
1
.gitattributes
vendored
|
|
@ -14,6 +14,7 @@
|
|||
*.ico binary
|
||||
*.jpeg binary
|
||||
*.mp3 binary
|
||||
*.mp4 binary
|
||||
*.zip binary
|
||||
*.bin binary
|
||||
|
||||
|
|
|
|||
5
.github/workflows/fulltest.yaml
vendored
5
.github/workflows/fulltest.yaml
vendored
|
|
@ -30,7 +30,10 @@ jobs:
|
|||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sh tests/scripts/run_install_deps.sh
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .[test]
|
||||
npm install -g @mermaid-js/mermaid-cli
|
||||
playwright install --with-deps
|
||||
- name: Run reverse proxy script for ssh service
|
||||
if: contains(github.ref, '-debugger')
|
||||
continue-on-error: true
|
||||
|
|
|
|||
45
.github/workflows/unittest.yaml
vendored
45
.github/workflows/unittest.yaml
vendored
|
|
@ -27,20 +27,57 @@ jobs:
|
|||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sh tests/scripts/run_install_deps.sh
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .[test]
|
||||
npm install -g @mermaid-js/mermaid-cli
|
||||
playwright install --with-deps
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
export ALLOW_OPENAI_API_CALL=0
|
||||
mkdir -p ~/.metagpt && cp tests/config2.yaml ~/.metagpt/config2.yaml
|
||||
pytest tests/ --ignore=tests/metagpt/environment/android_env --ignore=tests/metagpt/ext/android_assistant --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
|
||||
pytest --continue-on-collection-errors tests/ \
|
||||
--ignore=tests/metagpt/environment/android_env \
|
||||
--ignore=tests/metagpt/ext/android_assistant \
|
||||
--ignore=tests/metagpt/ext/stanford_town \
|
||||
--ignore=tests/metagpt/provider/test_bedrock_api.py \
|
||||
--ignore=tests/metagpt/rag/factories/test_embedding.py \
|
||||
--ignore=tests/metagpt/ext/werewolf/actions/test_experience_operation.py \
|
||||
--ignore=tests/metagpt/provider/test_openai.py \
|
||||
--ignore=tests/metagpt/planner/test_action_planner.py \
|
||||
--ignore=tests/metagpt/planner/test_basic_planner.py \
|
||||
--ignore=tests/metagpt/actions/test_project_management.py \
|
||||
--ignore=tests/metagpt/actions/test_write_code.py \
|
||||
--ignore=tests/metagpt/actions/test_write_code_review.py \
|
||||
--ignore=tests/metagpt/actions/test_write_prd.py \
|
||||
--ignore=tests/metagpt/environment/werewolf_env/test_werewolf_ext_env.py \
|
||||
--ignore=tests/metagpt/memory/test_brain_memory.py \
|
||||
--ignore=tests/metagpt/roles/test_assistant.py \
|
||||
--ignore=tests/metagpt/roles/test_engineer.py \
|
||||
--ignore=tests/metagpt/serialize_deserialize/test_write_code_review.py \
|
||||
--ignore=tests/metagpt/test_environment.py \
|
||||
--ignore=tests/metagpt/test_llm.py \
|
||||
--ignore=tests/metagpt/tools/test_metagpt_oas3_api_svc.py \
|
||||
--ignore=tests/metagpt/tools/test_moderation.py \
|
||||
--ignore=tests/metagpt/tools/test_search_engine.py \
|
||||
--ignore=tests/metagpt/tools/test_tool_convert.py \
|
||||
--ignore=tests/metagpt/tools/test_web_browser_engine_playwright.py \
|
||||
--ignore=tests/metagpt/utils/test_mermaid.py \
|
||||
--ignore=tests/metagpt/utils/test_redis.py \
|
||||
--ignore=tests/metagpt/utils/test_tree.py \
|
||||
--ignore=tests/metagpt/serialize_deserialize/test_sk_agent.py \
|
||||
--ignore=tests/metagpt/utils/test_text.py \
|
||||
--ignore=tests/metagpt/actions/di/test_write_analysis_code.py \
|
||||
--ignore=tests/metagpt/provider/test_ark.py \
|
||||
--doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov \
|
||||
--durations=20 | tee unittest.txt
|
||||
- name: Show coverage report
|
||||
run: |
|
||||
coverage report -m
|
||||
- name: Show failed tests and overall summary
|
||||
run: |
|
||||
grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt
|
||||
failed_count=$(grep -E "FAILED|ERROR" unittest.txt | wc -l)
|
||||
if [[ "$failed_count" -gt 0 ]]; then
|
||||
failed_count=$(grep -E "FAILED tests|ERROR tests" unittest.txt | wc -l | tr -d '[:space:]')
|
||||
if [[ $failed_count -gt 0 ]]; then
|
||||
echo "$failed_count failed lines found! Task failed."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -81,3 +81,5 @@ models:
|
|||
# # timeout: 600 # Optional. If set to 0, default value is 300.
|
||||
# # Details: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
|
||||
# pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
|
||||
|
||||
agentops_api_key: "YOUR_AGENTOPS_API_KEY" # get key from https://app.agentops.ai/settings/projects
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
@Author : alexanderwu
|
||||
@File : design_api_an.py
|
||||
"""
|
||||
from typing import List
|
||||
from typing import List,Optional
|
||||
|
||||
from metagpt.actions.action_node import ActionNode
|
||||
from metagpt.utils.mermaid import MMC1, MMC2
|
||||
|
|
@ -45,9 +45,10 @@ REFINED_FILE_LIST = ActionNode(
|
|||
example=["main.py", "game.py", "new_feature.py"],
|
||||
)
|
||||
|
||||
#optional,because low success reproduction of class diagram in non py project.
|
||||
DATA_STRUCTURES_AND_INTERFACES = ActionNode(
|
||||
key="Data structures and interfaces",
|
||||
expected_type=str,
|
||||
expected_type=Optional[str],
|
||||
instruction="Use mermaid classDiagram code syntax, including classes, method(__init__ etc.) and functions with type"
|
||||
" annotations, CLEARLY MARK the RELATIONSHIPS between classes, and comply with PEP8 standards. "
|
||||
"The data structures SHOULD BE VERY DETAILED and the API should be comprehensive with a complete design.",
|
||||
|
|
@ -66,7 +67,7 @@ REFINED_DATA_STRUCTURES_AND_INTERFACES = ActionNode(
|
|||
|
||||
PROGRAM_CALL_FLOW = ActionNode(
|
||||
key="Program call flow",
|
||||
expected_type=str,
|
||||
expected_type=Optional[str],
|
||||
instruction="Use sequenceDiagram code syntax, COMPLETE and VERY DETAILED, using CLASSES AND API DEFINED ABOVE "
|
||||
"accurately, covering the CRUD AND INIT of each object, SYNTAX MUST BE CORRECT.",
|
||||
example=MMC2,
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
@Author : alexanderwu
|
||||
@File : project_management_an.py
|
||||
"""
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
from metagpt.actions.action_node import ActionNode
|
||||
|
||||
REQUIRED_PACKAGES = ActionNode(
|
||||
key="Required packages",
|
||||
expected_type=List[str],
|
||||
expected_type=Optional[List[str]],
|
||||
instruction="Provide required packages in requirements.txt format.",
|
||||
example=["flask==1.1.2", "bcrypt==3.2.0"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class Config(CLIParams, YamlModel):
|
|||
workspace: WorkspaceConfig = WorkspaceConfig()
|
||||
enable_longterm_memory: bool = False
|
||||
code_review_k_times: int = 2
|
||||
agentops_api_key: str = ""
|
||||
|
||||
# Will be removed in the future
|
||||
metagpt_tti_url: str = ""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@File : architect.py
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import WritePRD
|
||||
from metagpt.actions.design_api import WriteDesign
|
||||
from metagpt.roles.role import Role
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@Modified By: mashenquan, 2023/11/27. Add `PrepareDocuments` action according to Section 2.2.3.5.1 of RFC 135.
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import UserRequirement, WritePRD
|
||||
from metagpt.actions.prepare_documents import PrepareDocuments
|
||||
from metagpt.roles.role import Role, RoleReactMode
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@File : project_manager.py
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import WriteTasks
|
||||
from metagpt.actions.design_api import WriteDesign
|
||||
from metagpt.roles.role import Role
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
of SummarizeCode.
|
||||
"""
|
||||
|
||||
|
||||
from metagpt.actions import DebugError, RunCode, WriteTest
|
||||
from metagpt.actions.summarize_code import SummarizeCode
|
||||
from metagpt.const import MESSAGE_ROUTE_TO_NONE
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
import agentops
|
||||
import typer
|
||||
|
||||
from metagpt.const import CONFIG_ROOT
|
||||
|
|
@ -38,6 +39,9 @@ def generate_repo(
|
|||
)
|
||||
from metagpt.team import Team
|
||||
|
||||
if config.agentops_api_key != "":
|
||||
agentops.init(config.agentops_api_key, tags=["software_company"])
|
||||
|
||||
config.update_via_cli(project_path, project_name, inc, reqa_file, max_auto_summarize_code)
|
||||
ctx = Context(config=config)
|
||||
|
||||
|
|
@ -68,6 +72,9 @@ def generate_repo(
|
|||
company.run_project(idea)
|
||||
asyncio.run(company.run(n_round=n_round))
|
||||
|
||||
if config.agentops_api_key != "":
|
||||
agentops.end_session("Success")
|
||||
|
||||
return ctx.repo
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ class Team(BaseModel):
|
|||
self.run_project(idea=idea, send_to=send_to)
|
||||
|
||||
while n_round > 0:
|
||||
if self.env.is_idle:
|
||||
logger.debug("All roles are idle.")
|
||||
break
|
||||
n_round -= 1
|
||||
self._check_balance()
|
||||
await self.env.run()
|
||||
|
|
|
|||
|
|
@ -74,3 +74,4 @@ rank-bm25==0.2.2 # for tool recommendation
|
|||
gymnasium==0.29.1
|
||||
boto3~=1.34.69
|
||||
spark_ai_python~=0.3.30
|
||||
agentops
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ def is_subset(subset, superset) -> bool:
|
|||
superset = {"prompt": "hello", "kwargs": {"temperature": 0.0, "top-p": 0.0}}
|
||||
is_subset(subset, superset)
|
||||
```
|
||||
>>>False
|
||||
|
||||
"""
|
||||
for key, value in subset.items():
|
||||
if key not in superset:
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ class MockLLM(OriginalLLM):
|
|||
raise ValueError(
|
||||
"In current test setting, api call is not allowed, you should properly mock your tests, "
|
||||
"or add expected api response in tests/data/rsp_cache.json. "
|
||||
f"The prompt you want for api call: {msg_key}"
|
||||
)
|
||||
# Call the original unmocked method
|
||||
rsp = await ask_func(*args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue