Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

update requirements.txt and fix editor

张建生70123a79d2bd
diff --git a/metagpt/const.py b/metagpt/const.py
index 9dc08b8d4..b47875ff7 100644
--- a/metagpt/const.py
+++ b/metagpt/const.py
@@ -165,3 +165,6 @@ EXPERIENCE_MASK = "<experience>"
# TeamLeader's name
TEAMLEADER_NAME = "Mike"
+
+DEFAULT_MIN_TOKEN_COUNT = 10000
+DEFAULT_MAX_TOKEN_COUNT = 100000000
diff --git a/metagpt/tools/libs/editor.py b/metagpt/tools/libs/editor.py
index 223216d4f..147f54f33 100644
--- a/metagpt/tools/libs/editor.py
+++ b/metagpt/tools/libs/editor.py
@@ -13,8 +13,7 @@ from typing import List, Optional, Union
import tiktoken
from pydantic import BaseModel, ConfigDict
-from metagpt.const import DEFAULT_WORKSPACE_ROOT
-from metagpt.tools.libs.index_repo import DEFAULT_MIN_TOKEN_COUNT, IndexRepo
+from metagpt.const import DEFAULT_MIN_TOKEN_COUNT, DEFAULT_WORKSPACE_ROOT
from metagpt.tools.libs.linter import Linter
from metagpt.tools.tool_registry import register_tool
from metagpt.utils.common import awrite
@@ -1125,7 +1124,12 @@ class Editor(BaseModel):
>>> texts: List[str] = await Editor.similarity_search(query=query, path=file_or_path)
>>> print(texts)
"""
- return await IndexRepo.cross_repo_search(query=query, file_or_path=path)
+ try:
+ from metagpt.tools.libs.index_repo import IndexRepo
+
+ return await IndexRepo.cross_repo_search(query=query, file_or_path=path)
+ except ImportError:
+ raise ImportError("To use the similarity search, you need to install the RAG module.")
@staticmethod
def is_large_file(content: str, mix_token_count: int = 0) -> bool:
diff --git a/requirements.txt b/requirements.txt
index ed8965b46..5aa404e7e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -75,4 +75,6 @@ pygithub~=2.3
htmlmin
fsspec
grep-ast~=0.3.3 # linter
-tree-sitter~=0.21.3 # linter
\ No newline at end of file
+tree-sitter~=0.21.3 # linter
+unidiff==0.7.5 # used at metagpt/tools/libs/cr.py
+httpx==0.27.2
\ No newline at end of file