feat: +DEFAULT_MIN_TOKEN_COUNT

This commit is contained in:
莘权 马 2024-09-05 17:32:18 +08:00
parent f0c980be24
commit 285a6bf164
2 changed files with 7 additions and 4 deletions

View file

@ -17,7 +17,7 @@ from pydantic import BaseModel, ConfigDict
from metagpt.config2 import Config
from metagpt.const import DEFAULT_WORKSPACE_ROOT
from metagpt.logs import logger
from metagpt.tools.libs.index_repo import OTHER_TYPE, IndexRepo
from metagpt.tools.libs.index_repo import DEFAULT_MIN_TOKEN_COUNT, OTHER_TYPE, IndexRepo
from metagpt.tools.libs.linter import Linter
from metagpt.tools.tool_registry import register_tool
from metagpt.utils import read_docx
@ -956,7 +956,7 @@ class Editor(BaseModel):
@staticmethod
async def search_index_repo(
query: str, files_or_paths: List[Union[str, Path]], min_token_count: int = 0
query: str, files_or_paths: List[Union[str, Path]], min_token_count: int = DEFAULT_MIN_TOKEN_COUNT
) -> List[str]:
"""Searches the index repository for a given query across specified files or paths.

View file

@ -27,6 +27,9 @@ CHATS_INDEX_ROOT = "/data/.index/chats"
CHATS_ROOT = "/data/chats/"
OTHER_TYPE = "other"
DEFAULT_MIN_TOKEN_COUNT = 10000
DEFAULT_MAX_TOKEN_COUNT = 100000000
class TextScore(BaseModel):
filename: str
@ -41,8 +44,8 @@ class IndexRepo(BaseModel):
)
fingerprint_filename: str = "fingerprint.json"
model: Optional[str] = None
min_token_count: int = 10000
max_token_count: int = 100000000
min_token_count: int = DEFAULT_MIN_TOKEN_COUNT
max_token_count: int = DEFAULT_MAX_TOKEN_COUNT
recall_count: int = 5
embedding: Optional[BaseEmbedding] = Field(default=None, exclude=True)
fingerprints: Dict[str, str] = Field(default_factory=dict)