mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 01:36:29 +02:00
1. 动作优化
1. SummarizeCode动作:用于基于代码进行总结,思考bug、逻辑、todo
2. CodeReview动作优化:目前强制要求回答问题,有更高的成功率了
2. 数据结构
1. Document的标准化:Env->Repo->Document,其中Document/Asset/Code都只用Document
1. 原用于检索的Document改为IndexableDocument
2. Repo结构引入:用于Document装载与元数据装载
3. RepoParser引入:写了一个简单的AST parser(后续可能要换tree-sitter),给出了整库symbol
3. 配置优化
1. 默认更换为gpt-4-1106-preview,以获得最好的效果与成本
2. 提供~/.metagpt作为配置最高优先级目录,从中读取config.yaml
3. workspace可以灵活指定了,在config中配置
4. metagpt作为默认命令行,而非python startup.py
1. 使用新的METAGPT_ROOT生成方式,而非寻找git,以便cli安装
2. 命令行由fire换为了typer,它会带来相对更好的体验
3. project_name可以灵活指定了,在metagpt命令行输入中配置
5. 其他
1. BossRequirement -> UserRequirement
2. 大量错误文本的修正,增加了可读性
3. 中量提示词优化,稍微提升了一些准确率
4. 暂时屏蔽了LongtermMemory相关逻辑,这个逻辑底层调用了langchain的FAISS,会带来~5秒加载耗时
5. 修复了安装包中的部分描述错误
This commit is contained in:
parent
6f345002c4
commit
331d74059f
50 changed files with 699 additions and 387 deletions
|
|
@ -5,44 +5,54 @@
|
|||
@Author : alexanderwu
|
||||
@File : const.py
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
from loguru import logger
|
||||
|
||||
def get_project_root():
|
||||
"""Search upwards to find the project root directory."""
|
||||
current_path = Path.cwd()
|
||||
while True:
|
||||
if (
|
||||
(current_path / ".git").exists()
|
||||
or (current_path / ".project_root").exists()
|
||||
or (current_path / ".gitignore").exists()
|
||||
):
|
||||
# use metagpt with git clone will land here
|
||||
logger.info(f"PROJECT_ROOT set to {str(current_path)}")
|
||||
return current_path
|
||||
parent_path = current_path.parent
|
||||
if parent_path == current_path:
|
||||
# use metagpt with pip install will land here
|
||||
cwd = Path.cwd()
|
||||
logger.info(f"PROJECT_ROOT set to current working directory: {str(cwd)}")
|
||||
return cwd
|
||||
current_path = parent_path
|
||||
import metagpt
|
||||
|
||||
|
||||
PROJECT_ROOT = get_project_root()
|
||||
DATA_PATH = PROJECT_ROOT / "data"
|
||||
WORKSPACE_ROOT = PROJECT_ROOT / "workspace"
|
||||
PROMPT_PATH = PROJECT_ROOT / "metagpt/prompts"
|
||||
UT_PATH = PROJECT_ROOT / "data/ut"
|
||||
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/"
|
||||
TMP = PROJECT_ROOT / "tmp"
|
||||
def get_metagpt_package_root():
|
||||
"""Get the root directory of the installed package."""
|
||||
package_root = Path(metagpt.__file__).parent.parent
|
||||
logger.info(f"Package root set to {str(package_root)}")
|
||||
return package_root
|
||||
|
||||
|
||||
def get_metagpt_root():
|
||||
"""Get the project root directory."""
|
||||
# Check if a project root is specified in the environment variable
|
||||
project_root_env = os.getenv('METAGPT_PROJECT_ROOT')
|
||||
if project_root_env:
|
||||
project_root = Path(project_root_env)
|
||||
logger.info(f"PROJECT_ROOT set from environment variable to {str(project_root)}")
|
||||
else:
|
||||
# Fallback to package root if no environment variable is set
|
||||
project_root = get_metagpt_package_root()
|
||||
return project_root
|
||||
|
||||
|
||||
# METAGPT PROJECT ROOT AND VARS
|
||||
|
||||
METAGPT_ROOT = get_metagpt_root()
|
||||
DEFAULT_WORKSPACE_ROOT = METAGPT_ROOT / "workspace"
|
||||
|
||||
DATA_PATH = METAGPT_ROOT / "data"
|
||||
RESEARCH_PATH = DATA_PATH / "research"
|
||||
TUTORIAL_PATH = DATA_PATH / "tutorial_docx"
|
||||
INVOICE_OCR_TABLE_PATH = DATA_PATH / "invoice_table"
|
||||
UT_PATH = DATA_PATH / "ut"
|
||||
SWAGGER_PATH = UT_PATH / "files/api/"
|
||||
UT_PY_PATH = UT_PATH / "files/ut/"
|
||||
API_QUESTIONS_PATH = UT_PATH / "files/question/"
|
||||
|
||||
SKILL_DIRECTORY = PROJECT_ROOT / "metagpt/skills"
|
||||
TMP = METAGPT_ROOT / "tmp"
|
||||
|
||||
SOURCE_ROOT = METAGPT_ROOT / "metagpt"
|
||||
PROMPT_PATH = SOURCE_ROOT / "prompts"
|
||||
SKILL_DIRECTORY = SOURCE_ROOT / "skills"
|
||||
|
||||
|
||||
# REAL CONSTS
|
||||
|
||||
MEM_TTL = 24 * 30 * 3600
|
||||
YAPI_URL = "http://yapi.deepwisdomai.com/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue