🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fixbug: circular import
莘权 马1976142c2836
diff --git a/metagpt/tools/libs/index_repo.py b/metagpt/tools/libs/index_repo.pyindex 720fec4fd..dc23987c9 100644--- a/metagpt/tools/libs/index_repo.py+++ b/metagpt/tools/libs/index_repo.py@@ -11,7 +11,6 @@ from pydantic import BaseModel, Field, model_validatorfrom metagpt.config2 import Configfrom metagpt.logs import logger-from metagpt.rag.engines import SimpleEnginefrom metagpt.rag.factories.embedding import RAGEmbeddingFactoryfrom metagpt.rag.schema import FAISSIndexConfig, FAISSRetrieverConfig, LLMRankerConfigfrom metagpt.utils.common import aread, awrite, generate_fingerprint, list_files@@ -100,6 +99,8 @@ class IndexRepo(BaseModel):await self._add_batch(filenames=filter_filenames, delete_filenames=delete_filenames)async def _add_batch(self, filenames: List[Union[str, Path]], delete_filenames: List[Union[str, Path]]):+ from metagpt.rag.engines import SimpleEngine+if not filenames:returnengine = None@@ -160,6 +161,8 @@ class IndexRepo(BaseModel):return pathnames, excludesasync def _search(self, query: str, filters: Set[str]) -> List[NodeWithScore]:+ from metagpt.rag.engines import SimpleEngine+if not Path(self.filename).exists():return []engine = SimpleEngine.from_index(