mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-02 14:45:17 +02:00
update requirements.txt and fix editor
This commit is contained in:
parent
f3ced99c92
commit
70123a79d2
3 changed files with 13 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue