MetaGPT/metagpt/const.py

85 lines
2.3 KiB
Python
Raw Permalink Normal View History

2023-06-30 17:10:48 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2023/5/1 11:59
@Author : alexanderwu
@File : const.py
"""
from pathlib import Path
def get_project_root():
2023-07-27 08:40:32 -05:00
"""Search upwards to find the project root directory."""
2023-06-30 17:10:48 +08:00
current_path = Path.cwd()
while True:
2023-09-18 12:46:15 +08:00
if (
(current_path / ".git").exists()
or (current_path / ".project_root").exists()
or (current_path / ".gitignore").exists()
):
2023-06-30 17:10:48 +08:00
return current_path
parent_path = current_path.parent
if parent_path == current_path:
raise Exception("Project root not found.")
current_path = parent_path
PROJECT_ROOT = get_project_root()
2023-09-18 12:46:15 +08:00
DATA_PATH = PROJECT_ROOT / "data"
WORKSPACE_ROOT = PROJECT_ROOT / "workspace"
PROMPT_PATH = PROJECT_ROOT / "metagpt/prompts"
UT_PATH = PROJECT_ROOT / "data/ut"
2023-06-30 17:10:48 +08:00
SWAGGER_PATH = UT_PATH / "files/api/"
UT_PY_PATH = UT_PATH / "files/ut/"
API_QUESTIONS_PATH = UT_PATH / "files/question/"
YAPI_URL = "http://yapi.deepwisdomai.com/"
2023-09-18 12:46:15 +08:00
TMP = PROJECT_ROOT / "tmp"
2023-08-08 22:59:26 +08:00
RESEARCH_PATH = DATA_PATH / "research"
TUTORIAL_PATH = DATA_PATH / "tutorial_docx"
2023-09-18 12:46:15 +08:00
SKILL_DIRECTORY = PROJECT_ROOT / "metagpt/skills"
MEM_TTL = 24 * 30 * 3600
2023-09-30 19:54:35 +08:00
### MineCraft ###
CKPT_DIR = PROJECT_ROOT / "metagpt/ckpt"
LOG_DIR = PROJECT_ROOT / "logs"
DEFAULT_WARMUP = {
"context": 15,
"biome": 10,
"time": 15,
"nearby_blocks": 0,
"other_blocks": 10,
"nearby_entities": 5,
"health": 15,
"hunger": 15,
"position": 0,
"equipment": 0,
"inventory": 0,
"optional_inventory_items": 7,
"chests": 0,
"completed_tasks": 0,
"failed_tasks": 0,
}
CURRICULUM_OB = [
"context",
"biome",
"time",
"nearby_blocks",
"other_blocks",
"nearby_entities",
"health",
"hunger",
"position",
"equipment",
"inventory",
"chests",
"completed_tasks",
"failed_tasks",
]
CORE_INVENTORY_ITEMS = r".*_log|.*_planks|stick|crafting_table|furnace"
r"|cobblestone|dirt|coal|.*_pickaxe|.*_sword|.*_axe", # curriculum_agent: only show these items in inventory before optional_inventory_items reached in warm up